You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by Peter4Work <pe...@gmail.com> on 2011/07/28 09:44:04 UTC

Aegis problem: message has value but Java property value is null in server side

Hi,

I am now testing Aegis(2.1) with WebSphere 6.1 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-problem-message-has-value-but-Java-property-value-is-null-in-server-side-tp4641589p4641589.html
Sent from the cxf-issues mailing list archive at Nabble.com.