Hello to all,
I try to generate WS via the spring configuration but I think I haven't the right configuration. My Pojos have a namespace set to http://pojo.company.com <http://pojo.company.com/> (Package reverse) And my services exposed have a namespace set to MyService (defined in the CXF config) My problem is in WSDL result those namespaces aren't respected: all types are mapped to the service namespace and the pojos (which are used in the services) are also mapped to the service namespace. I read that CXF use the JAXB annotations in pojo to set the namespace but it doesn't work... (I also try to use required, nillable without any success:-() The only thing I found is to set per default the namespace if it's not set: (in the CXF config) <jaxws:dataBinding> <bean class="org.apache.cxf.jaxb.JAXBDataBinding"> <property name="contextProperties"> <map> <entry> <key> <value>com.sun.xml.bind.defaultNamespaceRemap</value> </key> <value>http://pojo.company.com <http://pojo.company.com/> </value> </entry> </map> </property> </bean> </jaxws:dataBinding> It works but this say that my Pojo aren't well configured with JAXB or CXF isn't well configured for JAXB pojo. Thanks for your help! Maxime. Details about my tests: CXF conf (Spring): -------------------------- <jaxws:server id="MyService" serviceClass="com.company.MyService" serviceBean= "com.company.MyServiceImpl" address="/MyService" bindingId="http://www.w3.org/2003/05/soap/bindings/HTTP/"> </jaxws:server> Service: ----------- @WebService(serviceName="MyService", name="MyService", targetNamespace="MyService",portName="MyService PortType") public interface MyService { public String myMethod(@WebParam(name="aValue") String aValue, @WebParam(name="aPojo") MyDefinedPojo aPojo) } Pojo: ------- @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name="MyDefinedPojo", namespace="http://pojo.compamy.com") public class MyDefinedPojo { @XmlElement(name="left", namespace="http://pojo.compamy.com", nillable=true,required=true) protected String left; @XmlElement(name="right", namespace="http://pojo.compamy.com", nillable=true,required=false) protected String right; public MyDefinedPojo() {} public String getLeft() { return this.left; } public void setLeft(String data) { this.left=data; } public String getRight() { return this.right; } public void setRight(String data) { this.right=data; } } The result : --------------- <wsdl:definitions name="MyService" targetNamespace="MyService" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="MyService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <wsdl:types> <xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="MyService" xmlns:tns="MyService" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="myMethod" type="tns:myMethod" /> <xs:element name="myMethodResponse" type="tns:myMethodResponse" /> <xs:complexType name="myMethod"> <xs:sequence> <xs:element minOccurs="0" name="aValue" type="xs:string" /> <xs:element minOccurs="0" name="aPojo" type="tns:MyDefinedPojo" /> </xs:sequence> </xs:complexType> <xs:complexType name="MyDefinedPojo"> <xs:sequence> <xs:element minOccurs="0" name="leftValue" type="xs:unsignedShort" /> <xs:element minOccurs="0" name="rightValue" type="xs:unsignedShort" /> </xs:sequence> </xs:complexType> </wsdl:types> ... And I expect: ------------------- <wsdl:definitions name="MyService" targetNamespace="MyService" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="MyService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <wsdl:types> <xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://pojo.company.com <http://pojo.company.com/> " xmlns:tns="http://pojo.company.com <http://pojo.company.com/> " xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:complexType name="MyDefinedPojo"> <xs:sequence> <xs:element minOccurs="0" name="leftValue" type="xs:unsignedShort" /> <xs:element minOccurs="0" name="rightValue" type="xs:unsignedShort" /> </xs:sequence> </xs:complexType> </xs:schema> <xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="MyService" xmlns:ns1="http://pojo.company.com <http://pojo.company.com/> " xmlns:tns="MyService" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="myMethod" type="tns:myMethod" /> <xs:element name="myMethodResponse" type="tns:myMethodResponse" /> <xs:complexType name="encodePassword"> <xs:sequence> <xs:element minOccurs="0" name="aValue" type="xs:string" /> <xs:element minOccurs="0" name="aPojo" type="ns1:MyDefinedPojo" /> </xs:sequence> </xs:complexType> </wsdl:types> .... This email was sent to you by Thomson Reuters, the global news and information company. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of Thomson Reuters.
