You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Marcel Stör <ma...@frightanic.com> on 2012/03/07 16:59:45 UTC

No logging interceptor when using jaxws:client?

I have a cxf.xml that contains

   <cxf:bus>
     <cxf:features>
       <cxf:logging/>
     </cxf:features>
   </cxf:bus>

   <http:conduit name="*.http-conduit">
     <http:client ProxyServer="${proxyHost}" 
ProxyServerPort="${proxyPort}" ReceiveTimeout="${readTimeout}" 
NonProxyHosts="${nonProxyHosts}"/>
     <http:proxyAuthorization>
       <sec:UserName>${proxyUser}</sec:UserName>
       <sec:Password>${proxyPassword}</sec:Password>
     </http:proxyAuthorization>
   </http:conduit>
	
Then in the Spring application context XML file I have

<jaxws:client id="whatever-ID" serviceClass="whatever-class" 
address="${whatever-URL}" />

for each service I have a client for.

The problem: I don't see any SOAP message being logged by the in/out 
interceptors used by the bus (as configured in cxf.xml). If I use 
org.apache.cxf.jaxws.JaxWsProxyFactoryBean instead in the Spring 
configuration it works:

   <bean id="whatever-factory" 
class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
     <property name="serviceClass" value="whatever-class" />
     <property name="address" value="${whatever-URL}" />
   </bean>

   <bean id="whatever-ID" factory-bean="whatever-factory" 
factory-method="create" />
	
Why is that? Looking at the documentation and the source code didn't 
help for me.

Cheers,
Marcel

-- 
Marcel Stör, http://www.frightanic.com
Couchsurfing: http://www.couchsurfing.com/people/marcelstoer
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

Re: No logging interceptor when using jaxws:client?

Posted by Marcel Stör <ma...@frightanic.com>.
On 07.03.2012 19:58, Daniel Kulp wrote:
>
> When using any of our namespace handlers, they look for a Bus object
> specifically in that Spring context.  If there isn't one there, they create
> one for the context.    In this case, not only would it not get the bus, it
> wouldn't have your conduit properties picked up either.
>
> Your best bet is to import your config below directly into your other spring
> context.

I just did - no effect. I see that that the logging interceptors are 
instantiated, though.

Then I moved the <jaxws:client> configuration to cxf.xml which was still 
imported into the "regular" Spring XML files - no effect.

Then I dumped the cxf.xml, moved the <http:conduit> configuration to the 
Spring XML file and added

<jaxws:features>
   <bean class="org.apache.cxf.feature.LoggingFeature"/>
</jaxws:features>

to all the <jaxws:client> definitions. This works.

Thanks for pointing me into the right direction. However, this feels 
like a quirk. After reading 
http://cxf.apache.org/docs/jax-ws-configuration.html I assumed that if I 
had the <cxf:bus> configuration right there'd be a Spring bean 'cxf' 
which apparently is the default bus being used for all <jaxws:client> 
endpoints.

Cheers,
Marcel

> On Wednesday, March 07, 2012 04:59:45 PM Marcel Stör wrote:
>> I have a cxf.xml that contains
>>
>>     <cxf:bus>
>>       <cxf:features>
>>         <cxf:logging/>
>>       </cxf:features>
>>     </cxf:bus>
>>
>>     <http:conduit name="*.http-conduit">
>>       <http:client ProxyServer="${proxyHost}"
>> ProxyServerPort="${proxyPort}" ReceiveTimeout="${readTimeout}"
>> NonProxyHosts="${nonProxyHosts}"/>
>>       <http:proxyAuthorization>
>>         <sec:UserName>${proxyUser}</sec:UserName>
>>         <sec:Password>${proxyPassword}</sec:Password>
>>       </http:proxyAuthorization>
>>     </http:conduit>
>>
>> Then in the Spring application context XML file I have
>>
>> <jaxws:client id="whatever-ID" serviceClass="whatever-class"
>> address="${whatever-URL}" />
>>
>> for each service I have a client for.
>>
>> The problem: I don't see any SOAP message being logged by the in/out
>> interceptors used by the bus (as configured in cxf.xml). If I use
>> org.apache.cxf.jaxws.JaxWsProxyFactoryBean instead in the Spring
>> configuration it works:
>>
>>     <bean id="whatever-factory"
>> class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
>>       <property name="serviceClass" value="whatever-class" />
>>       <property name="address" value="${whatever-URL}" />
>>     </bean>
>>
>>     <bean id="whatever-ID" factory-bean="whatever-factory"
>> factory-method="create" />
>>
>> Why is that? Looking at the documentation and the source code didn't
>> help for me.
>>
>> Cheers,
>> Marcel


-- 
Marcel Stör, http://www.frightanic.com
Couchsurfing: http://www.couchsurfing.com/people/marcelstoer
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

Re: Missing option in codegen Maven plugin?

Posted by Marcel Stör <ma...@frightanic.com>.
On 19.03.2012 16:14, Daniel Kulp wrote:
> On Monday, March 19, 2012 02:25:09 PM David Karlsen wrote:
>> >  It would be very handy if these could be resolved as classpath:
>> >  resources like in spring.
> You MIGHT be able to with CXF.  I haven't actually tried this, but I think
> this should work:
>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-codegen-plugin</artifactId>
> <version>${cxf-plugin.version}</version>
> <dependencies>
>     <dependency>
>            <groupId>my.group.id</groupId>
>            <artifactId>myArtifactId</artifactId>
>            <version>1.0</version>
>       </dependency>
> </dependency>
> <executions>
>     <execution>
>       <id>generate-soap-client</id>
>       <configuration>
>         <wsdlOptions>
>           <wsdlOption>
>             <wsdl>classpath:my.wsdl</wsdl>
> ....
>
> Adding the dependency should throw the jar on the classpath for the plugin
> and the classpath: URL should allow CXF to load it from there.

It does work indeed, although I still don't understand /why/ this works. 
After all 'classpath:' isn't a "real" URL.

Cheers,
Marcel

-- 
Marcel Stör, http://www.frightanic.com
Couchsurfing: http://www.couchsurfing.com/people/marcelstoer
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

Re: Missing option in codegen Maven plugin?

Posted by Daniel Kulp <dk...@apache.org>.
On Monday, March 19, 2012 02:25:09 PM David Karlsen wrote:
> It would be very handy if these could be resolved as classpath:
> resources like in spring.

You MIGHT be able to with CXF.  I haven't actually tried this, but I think 
this should work:

<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf-plugin.version}</version>
<dependencies>
   <dependency>
          <groupId>my.group.id</groupId>
          <artifactId>myArtifactId</artifactId>
          <version>1.0</version>
     </dependency>
</dependency>
<executions>
   <execution>
     <id>generate-soap-client</id>
     <configuration>
       <wsdlOptions>
         <wsdlOption>
           <wsdl>classpath:my.wsdl</wsdl>
....

Adding the dependency should throw the jar on the classpath for the plugin 
and the classpath: URL should allow CXF to load it from there.    

Like I said, I haven't tried it before, but might be worth a shot.  :-)


Dan





> 
> 2012/3/17 Marcel Stör <ma...@frightanic.com>:
> > In the past I've been using the codegen Maven plugin like this:
> > 
> > <groupId>org.apache.cxf</groupId>
> > <artifactId>cxf-codegen-plugin</artifactId>
> > <version>${cxf-plugin.version}</version>
> > <executions>
> >  <execution>
> >    <id>generate-soap-client</id>
> >    <configuration>
> >      <wsdlOptions>
> >        <wsdlOption>
> >          <wsdl>${basedir}/src/main/wsdl/my.wsdl</wsdl>
> > 
> > Obviously this required the WDSL file to be present in the module.
> > 
> > Now I was looking into referencing the WSDL from a JAR dependency.
> > Example 5 in the manual[1] shows that this can be achieved given that
> > there's a Maven artifact with just the WSDL in it.
> > In my case, however, the WSDL is stored as a regular resource in a JAR
> > file that contains other artifacts. So, it's my.jar!/my.wsdl in Java
> > JAR notation.
> > 
> > Looking at WsdlArtifact.java[2] I saw no option which would allow me to
> > achieve what I want.
> > 
> > It tried
> > 
> > <wsdlOptions>
> >  <wsdlOption>
> >    <wsdl>${settings.localRepository}/path-to-my.jar!/my.wsdl</wsdl>
> >  </wsdlOption>
> > </wsdlOptions>
> > 
> > which failed. I've never written a Maven plugin but from looking at
> > AbstractCodegenMoho.java[3] I'm now convinced that it can't be done.
> > 
> > Is this correct?
> > 
> > Cheers,
> > Marcel
> > 
> > 
> > [1]
> > http://cxf.apache.org/docs/maven-cxf-codegen-plugin-wsdl-to-java.html
> > [2]
> > http://svn.apache.org/repos/asf/cxf/trunk/maven-plugins/codegen-plugin/s
> > rc/main/java/org/apache/cxf/maven_plugin/WsdlArtifact.java [3]
> > http://svn.apache.org/repos/asf/cxf/trunk/maven-plugins/codegen-plugin/s
> > rc/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
> > 
> > --
> > Marcel Stör, http://www.frightanic.com
> > Couchsurfing: http://www.couchsurfing.com/people/marcelstoer
> > O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com


Re: Missing option in codegen Maven plugin?

Posted by David Karlsen <da...@gmail.com>.
It would be very handy if these could be resolved as classpath:
resources like in spring.

2012/3/17 Marcel Stör <ma...@frightanic.com>:
> In the past I've been using the codegen Maven plugin like this:
>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-codegen-plugin</artifactId>
> <version>${cxf-plugin.version}</version>
> <executions>
>  <execution>
>    <id>generate-soap-client</id>
>    <configuration>
>      <wsdlOptions>
>        <wsdlOption>
>          <wsdl>${basedir}/src/main/wsdl/my.wsdl</wsdl>
>
> Obviously this required the WDSL file to be present in the module.
>
> Now I was looking into referencing the WSDL from a JAR dependency. Example 5
> in the manual[1] shows that this can be achieved given that there's a Maven
> artifact with just the WSDL in it.
> In my case, however, the WSDL is stored as a regular resource in a JAR file
> that contains other artifacts. So, it's my.jar!/my.wsdl in Java JAR
> notation.
>
> Looking at WsdlArtifact.java[2] I saw no option which would allow me to
> achieve what I want.
>
> It tried
>
> <wsdlOptions>
>  <wsdlOption>
>    <wsdl>${settings.localRepository}/path-to-my.jar!/my.wsdl</wsdl>
>  </wsdlOption>
> </wsdlOptions>
>
> which failed. I've never written a Maven plugin but from looking at
> AbstractCodegenMoho.java[3] I'm now convinced that it can't be done.
>
> Is this correct?
>
> Cheers,
> Marcel
>
>
> [1] http://cxf.apache.org/docs/maven-cxf-codegen-plugin-wsdl-to-java.html
> [2]
> http://svn.apache.org/repos/asf/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlArtifact.java
> [3]
> http://svn.apache.org/repos/asf/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
>
> --
> Marcel Stör, http://www.frightanic.com
> Couchsurfing: http://www.couchsurfing.com/people/marcelstoer
> O< ascii ribbon campaign - stop html mail - www.asciiribbon.org



-- 
--
David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen

Missing option in codegen Maven plugin?

Posted by Marcel Stör <ma...@frightanic.com>.
In the past I've been using the codegen Maven plugin like this:

<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf-plugin.version}</version>
<executions>
   <execution>
     <id>generate-soap-client</id>
     <configuration>
       <wsdlOptions>
         <wsdlOption>
           <wsdl>${basedir}/src/main/wsdl/my.wsdl</wsdl>

Obviously this required the WDSL file to be present in the module.

Now I was looking into referencing the WSDL from a JAR dependency. 
Example 5 in the manual[1] shows that this can be achieved given that 
there's a Maven artifact with just the WSDL in it.
In my case, however, the WSDL is stored as a regular resource in a JAR 
file that contains other artifacts. So, it's my.jar!/my.wsdl in Java JAR 
notation.

Looking at WsdlArtifact.java[2] I saw no option which would allow me to 
achieve what I want.

It tried

<wsdlOptions>
   <wsdlOption>
     <wsdl>${settings.localRepository}/path-to-my.jar!/my.wsdl</wsdl>
   </wsdlOption>
</wsdlOptions>

which failed. I've never written a Maven plugin but from looking at 
AbstractCodegenMoho.java[3] I'm now convinced that it can't be done.

Is this correct?

Cheers,
Marcel


[1] http://cxf.apache.org/docs/maven-cxf-codegen-plugin-wsdl-to-java.html
[2] 
http://svn.apache.org/repos/asf/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WsdlArtifact.java
[3] 
http://svn.apache.org/repos/asf/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java

-- 
Marcel Stör, http://www.frightanic.com
Couchsurfing: http://www.couchsurfing.com/people/marcelstoer
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

Re: No logging interceptor when using jaxws:client?

Posted by Daniel Kulp <dk...@apache.org>.
When using any of our namespace handlers, they look for a Bus object 
specifically in that Spring context.  If there isn't one there, they create 
one for the context.    In this case, not only would it not get the bus, it 
wouldn't have your conduit properties picked up either.

Your best bet is to import your config below directly into your other spring 
context.


Dan


On Wednesday, March 07, 2012 04:59:45 PM Marcel Stör wrote:
> I have a cxf.xml that contains
> 
>    <cxf:bus>
>      <cxf:features>
>        <cxf:logging/>
>      </cxf:features>
>    </cxf:bus>
> 
>    <http:conduit name="*.http-conduit">
>      <http:client ProxyServer="${proxyHost}"
> ProxyServerPort="${proxyPort}" ReceiveTimeout="${readTimeout}"
> NonProxyHosts="${nonProxyHosts}"/>
>      <http:proxyAuthorization>
>        <sec:UserName>${proxyUser}</sec:UserName>
>        <sec:Password>${proxyPassword}</sec:Password>
>      </http:proxyAuthorization>
>    </http:conduit>
> 
> Then in the Spring application context XML file I have
> 
> <jaxws:client id="whatever-ID" serviceClass="whatever-class"
> address="${whatever-URL}" />
> 
> for each service I have a client for.
> 
> The problem: I don't see any SOAP message being logged by the in/out
> interceptors used by the bus (as configured in cxf.xml). If I use
> org.apache.cxf.jaxws.JaxWsProxyFactoryBean instead in the Spring
> configuration it works:
> 
>    <bean id="whatever-factory"
> class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
>      <property name="serviceClass" value="whatever-class" />
>      <property name="address" value="${whatever-URL}" />
>    </bean>
> 
>    <bean id="whatever-ID" factory-bean="whatever-factory"
> factory-method="create" />
> 
> Why is that? Looking at the documentation and the source code didn't
> help for me.
> 
> Cheers,
> Marcel
-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com