You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Peter4Work <pe...@gmail.com> on 2011/08/13 10:49:48 UTC

Aegis binding that property value becomes null

Hi,

I am now testing Aegis(2.1) with WebSphere 7 using CXF (2.4.1). I have
modified little in the Helloworld sample app to try to pass user name to
server side by an object called User. In the outgoing message from client
side, it contains value like this:

**********************
Payload: <soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns1:sayHi
User xmlns:ns1="http://spring.demo/"><User><ns2:name
xmlns:ns2="http://spring.demo">User123</ns2:nam
e></User></ns1:sayHiUser></soap:Body></soap:Envelope>
**********************

But, on the server side, the value of name is null in the User object. I am
not sure what is going wrong. Please help.

Following is the config and interface for reference:

****************************
Interface:
package demo.spring;

import javax.jws.WebService;
import javax.jws.WebParam;
import demo.spring.User;

//@WebService(targetNamespace="http://spring.demo")
@WebService
public interface HelloWorld {
    String sayHi(String text);

    String sayHiUser(@WebParam(name = "User") User user);
}

****************************
User.java:
package demo.spring;

import org.apache.cxf.aegis.type.java5.XmlElement;

public class User {
        private String name;
        public User () {
        }

//@XmlElement
public String getName() {
        return name;
}
public void setName(String name) {
        this.name = name;
}
}

****************************
Client side Spring configure:
<beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:cxf="http://cxf.apache.org/core" 

        xsi:schemaLocation="
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd 
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schema/jaxws.xsd">


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

<import resource="classpath:META-INF/cxf/cxf.xml" /> 
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /> 
<import resource="classpath:META-INF/cxf/cxf-extension-http.xml" /> 

<bean id="aegisDatabinding"
class="org.apache.cxf.aegis.databinding.AegisDatabinding"  scope="prototype"
/>

<bean id="jaxws-and-aegis-service-factory"
class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"
scope="prototype"> 
<property name="wrapped" value="true" /> 
<property name="dataBinding" ref="aegisDatabinding"/> 
<property name="serviceConfigurations"> 
<list> 
<bean class="org.apache.cxf.jaxws.support.JaxWsServiceConfiguration"/> 
<bean
class="org.apache.cxf.aegis.databinding.XFireCompatibilityServiceConfiguration"/> 
<bean class="org.apache.cxf.service.factory.DefaultServiceConfiguration"/> 
</list> </property>
</bean> 

    <bean id="client" class="demo.spring.HelloWorld"
      factory-bean="clientFactory" factory-method="create"/>
   
        <bean id="clientFactory"
class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
         
          <property name="serviceClass" value="demo.spring.HelloWorld"/>
         
                <property name="address"
value="http://localhost:9080/test/HelloWorldImplService"/>
 
                <property name="dataBinding" ref="aegisDatabinding" />
               
        </bean>

         
</beans>

****************************
Server side configure:
<beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:cxf="http://cxf.apache.org/core" 
        xsi:schemaLocation="
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd 
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">

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

        <import resource="classpath:META-INF/cxf/cxf.xml" />
        <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
        <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

<bean id="aegisBean"
class="org.apache.cxf.aegis.databinding.AegisDatabinding"
scope="prototype"/> 
<bean id="jaxws-and-aegis-service-factory"
class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"
scope="prototype"> 
<property name="wrapped" value="true" /> 
<property name="dataBinding" ref="aegisBean"/> 
<property name="serviceConfigurations"> 
<list> 
<bean class="org.apache.cxf.jaxws.support.JaxWsServiceConfiguration"/> 
<bean
class="org.apache.cxf.aegis.databinding.XFireCompatibilityServiceConfiguration"/> 
<bean class="org.apache.cxf.service.factory.DefaultServiceConfiguration"/> 
</list> </property>
</bean> 
<jaxws:endpoint id="my_service_endpoint"
implementor="demo.spring.HelloWorldImpl" address="/HelloWorld"> 
<jaxws:serviceFactory> <ref bean="jaxws-and-aegis-service-factory" />
</jaxws:serviceFactory> 
</jaxws:endpoint>
</beans>

BTW, from the websphere console, I often saw this system out when it receive
request from client:
 org.apache.axis2.jaxws.message.databinding.JAXBUtils createJAXBContextValue
Both ObjectFactory & package-info not found in package hierachy


Does it mean it still keep to use JAXB instead of Aegis?

Thanks. 

--
View this message in context: http://cxf.547215.n5.nabble.com/Aegis-binding-that-property-value-becomes-null-tp4695764p4695764.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Aegis binding that property value becomes null

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

You can add system property to the script which start Websphere like
-Djavax.xml.ws.spi.Provider=org.apache.cxf.jaxws22.spi.ProviderImpl
This can ensure pick up cxf as jaxws implementation.

Freeman
On 2011-8-18, at 下午6:37, Peter4Work wrote:

> If so, how can to enforce Websphere to use CXF? I have already tried  
> to
> disable IBMWSEngine by adding JVM argument mentioned in CXF deployment
> section.
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Aegis-binding-that-property-value-becomes-null-tp4695764p4711656.html
> Sent from the cxf-user mailing list archive at Nabble.com.

---------------------------------------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com










Re: Aegis binding that property value becomes null

Posted by Peter4Work <pe...@gmail.com>.
If so, how can to enforce Websphere to use CXF? I have already tried to
disable IBMWSEngine by adding JVM argument mentioned in CXF deployment
section.

--
View this message in context: http://cxf.547215.n5.nabble.com/Aegis-binding-that-property-value-becomes-null-tp4695764p4711656.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Aegis binding that property value becomes null

Posted by Daniel Kulp <dk...@apache.org>.

> BTW, from the websphere console, I often saw this system out when it receive
> request from client:
>  org.apache.axis2.jaxws.message.databinding.JAXBUtils createJAXBContextValue
> Both ObjectFactory & package-info not found in package hierachy
> 
> 

This sounds like you aren't even using CXF, or WebSphere is not picking up 
CXF.  It's using the stack built into WebSphere which is axis2 based. 

Dan



On Saturday, August 13, 2011 1:49:48 AM Peter4Work wrote:
> Hi,
> 
> I am now testing Aegis(2.1) with WebSphere 7 using CXF (2.4.1). I have
> modified little in the Helloworld sample app to try to pass user name to
> server side by an object called User. In the outgoing message from client
> side, it contains value like this:
> 
> **********************
> Payload: <soap:Envelope
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns1:sayHi
> User xmlns:ns1="http://spring.demo/"><User><ns2:name
> xmlns:ns2="http://spring.demo">User123</ns2:nam
> e></User></ns1:sayHiUser></soap:Body></soap:Envelope>
> **********************
> 
> But, on the server side, the value of name is null in the User object. I am
> not sure what is going wrong. Please help.
> 
> Following is the config and interface for reference:
> 
> ****************************
> Interface:
> package demo.spring;
> 
> import javax.jws.WebService;
> import javax.jws.WebParam;
> import demo.spring.User;
> 
> //@WebService(targetNamespace="http://spring.demo")
> @WebService
> public interface HelloWorld {
>     String sayHi(String text);
> 
>     String sayHiUser(@WebParam(name = "User") User user);
> }
> 
> ****************************
> User.java:
> package demo.spring;
> 
> import org.apache.cxf.aegis.type.java5.XmlElement;
> 
> public class User {
>         private String name;
>         public User () {
>         }
> 
> //@XmlElement
> public String getName() {
>         return name;
> }
> public void setName(String name) {
>         this.name = name;
> }
> }
> 
> ****************************
> Client side Spring configure:
> <beans xmlns="http://www.springframework.org/schema/beans"
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>         xmlns:jaxws="http://cxf.apache.org/jaxws"
> xmlns:cxf="http://cxf.apache.org/core"
> 
>         xsi:schemaLocation="
> http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schema/jaxws.xsd">
> 
> 
> <cxf:bus> <cxf:features> <cxf:logging/> </cxf:features> </cxf:bus>
> 
> <import resource="classpath:META-INF/cxf/cxf.xml" />
> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
> 
> <bean id="aegisDatabinding"
> class="org.apache.cxf.aegis.databinding.AegisDatabinding"  scope="prototype"
> />
> 
> <bean id="jaxws-and-aegis-service-factory"
> class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"
> scope="prototype">
> <property name="wrapped" value="true" />
> <property name="dataBinding" ref="aegisDatabinding"/>
> <property name="serviceConfigurations">
> <list>
> <bean class="org.apache.cxf.jaxws.support.JaxWsServiceConfiguration"/>
> <bean
> class="org.apache.cxf.aegis.databinding.XFireCompatibilityServiceConfigurati
> on"/> <bean
> class="org.apache.cxf.service.factory.DefaultServiceConfiguration"/>
> </list> </property>
> </bean>
> 
>     <bean id="client" class="demo.spring.HelloWorld"
>       factory-bean="clientFactory" factory-method="create"/>
> 
>         <bean id="clientFactory"
> class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
> 
>           <property name="serviceClass" value="demo.spring.HelloWorld"/>
> 
>                 <property name="address"
> value="http://localhost:9080/test/HelloWorldImplService"/>
> 
>                 <property name="dataBinding" ref="aegisDatabinding" />
> 
>         </bean>
> 
> 
> </beans>
> 
> ****************************
> Server side configure:
> <beans xmlns="http://www.springframework.org/schema/beans"
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>         xmlns:jaxws="http://cxf.apache.org/jaxws"
> xmlns:cxf="http://cxf.apache.org/core"
>         xsi:schemaLocation="
> http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
> 
> <cxf:bus> <cxf:features> <cxf:logging/> </cxf:features> </cxf:bus>
> 
>         <import resource="classpath:META-INF/cxf/cxf.xml" />
>         <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
>         <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
> 
> <bean id="aegisBean"
> class="org.apache.cxf.aegis.databinding.AegisDatabinding"
> scope="prototype"/>
> <bean id="jaxws-and-aegis-service-factory"
> class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"
> scope="prototype">
> <property name="wrapped" value="true" />
> <property name="dataBinding" ref="aegisBean"/>
> <property name="serviceConfigurations">
> <list>
> <bean class="org.apache.cxf.jaxws.support.JaxWsServiceConfiguration"/>
> <bean
> class="org.apache.cxf.aegis.databinding.XFireCompatibilityServiceConfigurati
> on"/> <bean
> class="org.apache.cxf.service.factory.DefaultServiceConfiguration"/>
> </list> </property>
> </bean>
> <jaxws:endpoint id="my_service_endpoint"
> implementor="demo.spring.HelloWorldImpl" address="/HelloWorld">
> <jaxws:serviceFactory> <ref bean="jaxws-and-aegis-service-factory" />
> </jaxws:serviceFactory>
> </jaxws:endpoint>
> </beans>
> 
> BTW, from the websphere console, I often saw this system out when it receive
> request from client:
>  org.apache.axis2.jaxws.message.databinding.JAXBUtils createJAXBContextValue
> Both ObjectFactory & package-info not found in package hierachy
> 
> 
> Does it mean it still keep to use JAXB instead of Aegis?
> 
> Thanks.
> 
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/Aegis-binding-that-property-value-becomes-n
> ull-tp4695764p4695764.html Sent from the cxf-user mailing list archive at
> Nabble.com.
-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com