You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Glen Mazza <gl...@gmail.com> on 2008/07/27 02:16:55 UTC
Adding interceptors to a SOAP client using Spring
Hello, for my DoubleIt SOAP client[1] I would like to add a few interceptors.
I know how to do that programmatically[2], but don't know how to do that via
Spring configuration. In the cxf.xml that I place in the SOAP client's
classpath, I would like interceptors to be declaratively added in this type
of manner:
<jaxws:client
name="{http://www.example.org/DoubleIt}DoubleItPort.http-conduit">
<jaxws:features>
<bean class="org.apache.cxf.feature.LoggingFeature"/>
</jaxws:features>
<jaxws:outInterceptors>
<ref bean="TimestampSignEncrypt_Request"/>
</jaxws:outInterceptors>
<jaxws:inInterceptors>
<ref bean="TimestampSignEncrypt_Response"/>
</jaxws:inInterceptors>
</jaxws:client>
But jaxws:client appears to create a new SOAP client (and NPE's because I'm
not providing enough information)--it doesn't add these interceptors to my
WSClient as I'd like. Is there a way to do what I'm trying to do? Also,
what are the attributes to jaxws:client above that I need to add to tie
these interceptors to my WSClient class?
Thanks,
Glen
[1] http://www.jroller.com/gmazza/date/20080417#WFstep10
[2] http://www.jroller.com/gmazza/entry/using_cxf_and_wss4j_to (Step #2)
--
View this message in context: http://www.nabble.com/Adding-interceptors-to-a-SOAP-client-using-Spring-tp18672098p18672098.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: Adding interceptors to a SOAP client using Spring
Posted by Glen Mazza <gl...@gmail.com>.
I think I have found the solution--it's to use JaxWSProxyFactoryBean:
http://cwiki.apache.org/CXF20DOC/jax-ws-configuration.html#JAX-WSConfiguration-ConfiguringaClientProxy
Funny, I haven't had a need to use this class up until now.
Glen
Glen Mazza wrote:
>
> Hello, for my DoubleIt SOAP client[1] I would like to add a few
> interceptors. I know how to do that programmatically[2], but don't know
> how to do that via Spring configuration. In the cxf.xml that I place in
> the SOAP client's classpath, I would like interceptors to be declaratively
> added in this type of manner:
>
> <jaxws:client
> name="{http://www.example.org/DoubleIt}DoubleItPort.http-conduit">
> <jaxws:features>
> <bean class="org.apache.cxf.feature.LoggingFeature"/>
> </jaxws:features>
> <jaxws:outInterceptors>
> <ref bean="TimestampSignEncrypt_Request"/>
> </jaxws:outInterceptors>
> <jaxws:inInterceptors>
> <ref bean="TimestampSignEncrypt_Response"/>
> </jaxws:inInterceptors>
> </jaxws:client>
>
> But jaxws:client appears to create a new SOAP client (and NPE's because
> I'm not providing enough information)--it doesn't add these interceptors
> to my WSClient as I'd like. Is there a way to do what I'm trying to do?
> Also, what are the attributes to jaxws:client above that I need to add to
> tie these interceptors to my WSClient class?
>
> Thanks,
> Glen
>
> [1] http://www.jroller.com/gmazza/date/20080417#WFstep10
> [2] http://www.jroller.com/gmazza/entry/using_cxf_and_wss4j_to (Step #2)
>
>
--
View this message in context: http://www.nabble.com/Adding-interceptors-to-a-SOAP-client-using-Spring-tp18672098p18677180.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: Adding interceptors to a SOAP client using Spring
Posted by Daniel Kulp <dk...@apache.org>.
On Jul 28, 2008, at 11:27 AM, Glen Mazza wrote:
>
> I'll try that again (I got it working with JaxWSProxyFactoryBean,
> BTW). But
> isn't createdFromAPI="true" is for when you doing Endpoint.publish()
> or
> similar to create the SOAP client? I'm not doing that in my clients
> ([1],
> below).
>
> If I can attach interceptors to an already existing client endpoint
> via
> jaxws:client, then what is the business case for
> JaxWSProxyFactoryBean?
> When would you need the latter--or is just an alternative method of
> doing
> the same thing?
Basically, under the covers, the jaxws:client element in the spring
config is just configuring a JaxWsProxyFactoryBean. That's pretty
much how it works. With the createdFromApi attribute set, that bean
is pretty much used as configuration of the bean used during the
"service.getDoubleItPort()" call. If createdFromAPI is not set, we
add the "create" call as the spring factory method and you can get the
bean from the application context by name.
Dan
>
>
> Thanks,
> Glen
>
>
> dkulp wrote:
>>
>>
>> jaxws:client should work fine. The wsdl_first demo uses it to
>> configure schema validation.
>>
>> Basically, you need to make sure the "name" is correct (no http-
>> conduit on the end) and add the "createdFromAPI="true"" attribute.
>>
>>
>> Dan
>>
>>
>> On Jul 26, 2008, at 8:16 PM, Glen Mazza wrote:
>>
>>>
>>> Hello, for my DoubleIt SOAP client[1] I would like to add a few
>>> interceptors.
>>> I know how to do that programmatically[2], but don't know how to do
>>> that via
>>> Spring configuration. In the cxf.xml that I place in the SOAP
>>> client's
>>> classpath, I would like interceptors to be declaratively added in
>>> this type
>>> of manner:
>>>
>>> <jaxws:client
>>> name="{http://www.example.org/DoubleIt}DoubleItPort.http-conduit">
>>> <jaxws:features>
>>> <bean class="org.apache.cxf.feature.LoggingFeature"/>
>>> </jaxws:features>
>>> <jaxws:outInterceptors>
>>> <ref bean="TimestampSignEncrypt_Request"/>
>>> </jaxws:outInterceptors>
>>> <jaxws:inInterceptors>
>>> <ref bean="TimestampSignEncrypt_Response"/>
>>> </jaxws:inInterceptors>
>>> </jaxws:client>
>>>
>>> But jaxws:client appears to create a new SOAP client (and NPE's
>>> because I'm
>>> not providing enough information)--it doesn't add these interceptors
>>> to my
>>> WSClient as I'd like. Is there a way to do what I'm trying to do?
>>> Also,
>>> what are the attributes to jaxws:client above that I need to add to
>>> tie
>>> these interceptors to my WSClient class?
>>>
>>> Thanks,
>>> Glen
>>>
>>> [1] http://www.jroller.com/gmazza/date/20080417#WFstep10
>>> [2] http://www.jroller.com/gmazza/entry/using_cxf_and_wss4j_to (Step
>>> #2)
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Adding-interceptors-to-a-SOAP-client-using-Spring-tp18672098p18672098.html
>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>
>>
>> ---
>> Daniel Kulp
>> dkulp@apache.org
>> http://www.dankulp.com/blog
>>
>>
>>
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Adding-interceptors-to-a-SOAP-client-using-Spring-tp18672098p18690911.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
---
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog
Re: web service's observer not found problem
Posted by Glen Mazza <gl...@gmail.com>.
Our bad grammar to the rescue! Googling "Can't find the the request"
returned 1270 hits...please check if any solve your problem--and let us know
if you could find it. (Sorry, I've never seen that message before so am
unsure what the problem is.)
The culprit is the method at line 105 here: http://tinyurl.com/6647le. If
you're really desperate (actually, it doesn't take too much time and is
quite educational) you can debug/code trace CXF at runtime[1] if you think
that would help.
Glen
PS -- Just fixed the grammar.
[1] http://www.jroller.com/gmazza/date/20071212 (this is for Tomcat, but
perhaps Jetty is the same here).
Shelly Handa wrote:
>
> WARNING: Can't find the the request for
> http://localhost:8080/services/HelloWorldService's Observer
>
--
View this message in context: http://www.nabble.com/Adding-interceptors-to-a-SOAP-client-using-Spring-tp18672098p18766910.html
Sent from the cxf-user mailing list archive at Nabble.com.
web service's observer not found problem
Posted by Shelly Handa <s....@mpstechnologies.com>.
Hi,
I have successfully implemented webservice using CXF 2.1.1 but sometimes I
get following error while running the server but other times it works fine.
I have merged the webservice code with other application running on
apfuse.So It's using mix of jars appfuse jars+cxf jars.
I have removed the overlapping jars of cxf with appfuse's jars.
I don't think this problem is due to appfuse as I encountered this problem
even without merging cxf code with other application code.
Right now I am using jetty to publish it.
I am unable to find the reason of this behavior .Can you help me resolving
this issue?
The error it displays is:
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromWSDL
INFO: Creating Service {HelloWorldService}HelloWorldService from WSDL:
file:/C:/usr/hello/wsdl/ HelloWorld.wsdl
Jul 29, 2008 3:41:04 PM org.apache.cxf.endpoint.ServerImpl
initDestination
INFO: Setting the server's publish address to be
http://localhost:8080/services/HelloWorldService
Jul 29, 2008 3:41:04 PM
org.apache.cxf.transport.servlet.ServletController
invoke
WARNING: Can't find the the request for
http://localhost:8080/services/HelloWorldService's Observer
Regards,
Shelly Handa
Re: Adding interceptors to a SOAP client using Spring
Posted by Daniel Kulp <dk...@apache.org>.
What version of CXF? 2.1 or 2.1.1? Definitely try again with 2.1.1
as there could be an error in there that was being swallowed.
Dan
On Jul 29, 2008, at 6:16 AM, Shelly Handa wrote:
> Hi ,
>
> I am creating a web service using CXF.
>
> Sometimes while accesing the web service I get the following message
> other
> times it works fine.
> I don't understand why it's responding this way.
>
>
> ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
> Jul 29, 2008 3:40:49 PM
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean
> buildServiceFromWSDL
> INFO: Creating Service {HelloWorldService}HelloWorldService from WSDL:
> file:/C:/usr/pubstats/wsdl/ HelloWorld.wsdl
> Jul 29, 2008 3:41:04 PM org.apache.cxf.endpoint.ServerImpl
> initDestination
> INFO: Setting the server's publish address to be
> http://localhost:8080/services/HelloWorldService
> Jul 29, 2008 3:41:04 PM
> org.apache.cxf.transport.servlet.ServletController
> invoke
> WARNING: Can't find the the request for
> http://localhost:8080/services/HelloWorldService's Observer
>
>
> Can you please help me resolving this issue?
>
> Regards,
>
> Shelly Handa
>
>
---
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog
RE: Adding interceptors to a SOAP client using Spring
Posted by Shelly Handa <s....@mpstechnologies.com>.
Hi ,
I am creating a web service using CXF.
Sometimes while accesing the web service I get the following message other
times it works fine.
I don't understand why it's responding this way.
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Jul 29, 2008 3:40:49 PM
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromWSDL
INFO: Creating Service {HelloWorldService}HelloWorldService from WSDL:
file:/C:/usr/pubstats/wsdl/ HelloWorld.wsdl
Jul 29, 2008 3:41:04 PM org.apache.cxf.endpoint.ServerImpl initDestination
INFO: Setting the server's publish address to be
http://localhost:8080/services/HelloWorldService
Jul 29, 2008 3:41:04 PM org.apache.cxf.transport.servlet.ServletController
invoke
WARNING: Can't find the the request for
http://localhost:8080/services/HelloWorldService's Observer
Can you please help me resolving this issue?
Regards,
Shelly Handa
Re: Adding interceptors to a SOAP client using Spring
Posted by Glen Mazza <gl...@gmail.com>.
I'll try that again (I got it working with JaxWSProxyFactoryBean, BTW). But
isn't createdFromAPI="true" is for when you doing Endpoint.publish() or
similar to create the SOAP client? I'm not doing that in my clients ([1],
below).
If I can attach interceptors to an already existing client endpoint via
jaxws:client, then what is the business case for JaxWSProxyFactoryBean?
When would you need the latter--or is just an alternative method of doing
the same thing?
Thanks,
Glen
dkulp wrote:
>
>
> jaxws:client should work fine. The wsdl_first demo uses it to
> configure schema validation.
>
> Basically, you need to make sure the "name" is correct (no http-
> conduit on the end) and add the "createdFromAPI="true"" attribute.
>
>
> Dan
>
>
> On Jul 26, 2008, at 8:16 PM, Glen Mazza wrote:
>
>>
>> Hello, for my DoubleIt SOAP client[1] I would like to add a few
>> interceptors.
>> I know how to do that programmatically[2], but don't know how to do
>> that via
>> Spring configuration. In the cxf.xml that I place in the SOAP
>> client's
>> classpath, I would like interceptors to be declaratively added in
>> this type
>> of manner:
>>
>> <jaxws:client
>> name="{http://www.example.org/DoubleIt}DoubleItPort.http-conduit">
>> <jaxws:features>
>> <bean class="org.apache.cxf.feature.LoggingFeature"/>
>> </jaxws:features>
>> <jaxws:outInterceptors>
>> <ref bean="TimestampSignEncrypt_Request"/>
>> </jaxws:outInterceptors>
>> <jaxws:inInterceptors>
>> <ref bean="TimestampSignEncrypt_Response"/>
>> </jaxws:inInterceptors>
>> </jaxws:client>
>>
>> But jaxws:client appears to create a new SOAP client (and NPE's
>> because I'm
>> not providing enough information)--it doesn't add these interceptors
>> to my
>> WSClient as I'd like. Is there a way to do what I'm trying to do?
>> Also,
>> what are the attributes to jaxws:client above that I need to add to
>> tie
>> these interceptors to my WSClient class?
>>
>> Thanks,
>> Glen
>>
>> [1] http://www.jroller.com/gmazza/date/20080417#WFstep10
>> [2] http://www.jroller.com/gmazza/entry/using_cxf_and_wss4j_to (Step
>> #2)
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Adding-interceptors-to-a-SOAP-client-using-Spring-tp18672098p18672098.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>
> ---
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
>
>
>
>
>
>
--
View this message in context: http://www.nabble.com/Adding-interceptors-to-a-SOAP-client-using-Spring-tp18672098p18690911.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: Adding interceptors to a SOAP client using Spring
Posted by Daniel Kulp <dk...@apache.org>.
jaxws:client should work fine. The wsdl_first demo uses it to
configure schema validation.
Basically, you need to make sure the "name" is correct (no http-
conduit on the end) and add the "createdFromAPI="true"" attribute.
Dan
On Jul 26, 2008, at 8:16 PM, Glen Mazza wrote:
>
> Hello, for my DoubleIt SOAP client[1] I would like to add a few
> interceptors.
> I know how to do that programmatically[2], but don't know how to do
> that via
> Spring configuration. In the cxf.xml that I place in the SOAP
> client's
> classpath, I would like interceptors to be declaratively added in
> this type
> of manner:
>
> <jaxws:client
> name="{http://www.example.org/DoubleIt}DoubleItPort.http-conduit">
> <jaxws:features>
> <bean class="org.apache.cxf.feature.LoggingFeature"/>
> </jaxws:features>
> <jaxws:outInterceptors>
> <ref bean="TimestampSignEncrypt_Request"/>
> </jaxws:outInterceptors>
> <jaxws:inInterceptors>
> <ref bean="TimestampSignEncrypt_Response"/>
> </jaxws:inInterceptors>
> </jaxws:client>
>
> But jaxws:client appears to create a new SOAP client (and NPE's
> because I'm
> not providing enough information)--it doesn't add these interceptors
> to my
> WSClient as I'd like. Is there a way to do what I'm trying to do?
> Also,
> what are the attributes to jaxws:client above that I need to add to
> tie
> these interceptors to my WSClient class?
>
> Thanks,
> Glen
>
> [1] http://www.jroller.com/gmazza/date/20080417#WFstep10
> [2] http://www.jroller.com/gmazza/entry/using_cxf_and_wss4j_to (Step
> #2)
>
> --
> View this message in context: http://www.nabble.com/Adding-interceptors-to-a-SOAP-client-using-Spring-tp18672098p18672098.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
---
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog