Hi ,
This is an issue in CXF . Can you log it into
https://issues.apache.org/jira/browse/CXF with your
test case ?
Thanks
Jim
Nianhua Li wrote:
Dear list,
I am using the java-first approach with spring configuration on cxf 2.0.3
and tomcat 5.5. I specified namespace for all the input and output
parameters via @WebParam and @WebResult annotation. But the namespace was
somehow missing from the SOAP message.
Let's use the "java_first_spring_support" sample shipped with cxf 2.0.3 as
an example. If I add some ws annotations to the service interface
"HelloWorld.java":
==================================
@WebService(name="MyHelloWorldService",
targetNamespace="http://nstest.helloworld")
@SOAPBinding( parameterStyle=SOAPBinding.ParameterStyle.WRAPPED,
style=SOAPBinding.Style.DOCUMENT,
use= SOAPBinding.Use.LITERAL )
public interface HelloWorld {
@WebMethod
@WebResult(name="MyResult", targetNamespace="http://nstest.helloworld")
String sayHi(@WebParam(name="MyInput",
targetNamespace="http://nstest.helloworld") String text);
}
==================================
Deploy it to tomcat, generate a cxf client from WSDL, and invoke the
service.
=================================
The SOAP request:
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
<ns2:sayHi
xmlns:ns2="http://nstest.helloworld"><MyInput>ABC</MyInput></ns2:say
Hi></soap:Body></soap:Envelope>
The SOAP response:
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
<ns1:sayHiResponse xmlns:ns1="http://nstest.helloworld"><MyResult>Hello
ABC</My
Result></ns1:sayHiResponse></soap:Body></soap:Envelope>
===================================
Notice that both input and output parameter (MyInput and MyResult) have no
namesapce. How can I make the namespace available? Should I add
@RequestWrapper annotation?
The namespace is available in WSDL though. Here is the related part:
===================================
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:ns1="http://nstest.helloworld"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="MyHelloWorldService"
targetNamespace="http://nstest.helloworld">
<wsdl:types>
<xsd:schema xmlns="http://nstest.helloworld"
xmlns:tns="http://spring.demo/"
attributeFormDefault="unqualified"
elementFormDefault="unqualified"
targetNamespace="http://nstest.helloworld"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<import xmlns="http://www.w3.org/2001/XMLSchema"
namespace="http://spring.demo/"/>
<xsd:element name="sayHi" type="sayHi"/>
<xsd:complexType name="sayHi">
<xsd:sequence>
<xsd:element minOccurs="0" name="MyInput" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="sayHiResponse" type="sayHiResponse"/>
<xsd:complexType name="sayHiResponse">
<xsd:sequence>
<xsd:element minOccurs="0" name="MyResult" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="sayHi">
<wsdl:part element="ns1:sayHi" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="sayHiResponse">
<wsdl:part element="ns1:sayHiResponse" name="parameters">
</wsdl:part>
</wsdl:message>
...
</wsdl:definitions>
==================================
Could somebody help me out on this problem please? Many thanks in advance.
nianhua