cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: [jira] Created: (CXF-1478) WebParam ignored in service implementation
Date Fri, 14 Mar 2008 18:34:27 GMT


> ServerFactoryBean svrFactory = new ServerFactoryBean();

Use the JaxWsServerFactoryBean instead.   The "simple" frontend doesn't 
know anything about the jaxws annotations.

Dan



On Friday 14 March 2008, Damien B (JIRA) wrote:
> WebParam ignored in service implementation
> ------------------------------------------
>
>                  Key: CXF-1478
>                  URL: https://issues.apache.org/jira/browse/CXF-1478
>              Project: CXF
>           Issue Type: Bug
>     Affects Versions: 2.0.4
>             Reporter: Damien B
>
>
> I have a very simple WSDL (see attached file), Doc/Lit/bare.
> I generate with WSDL2Java server + impl. The generated Jax-WS
> interface looks like this: public interface TestDocLit {
>
>     @ResponseWrapper(localName = "operation1Response", targetNamespace
> = "http://www.example.org/TestDocLit/", className =
> "org.example.testdoclit.Operation1Response") @RequestWrapper(localName
> = "operation1", targetNamespace =
> "http://www.example.org/TestDocLit/", className =
> "org.example.testdoclit.Operation1") @WebResult(name = "out",
> targetNamespace = "")
>     @WebMethod(action =
> "http://www.example.org/TestDocLit/operation1") public
> java.lang.String operation1(
>         @WebParam(name = "par1", targetNamespace = "")
>         int par1
>     );
> }
>
> We note that WebParam is correct (no namespace, "par1").
>
> The service is tested like this:
> ServerFactoryBean svrFactory = new ServerFactoryBean();
> svrFactory.setServiceClass(TestDocLit.class);
> svrFactory.setAddress(url);
> svrFactory.setServiceBean(new TestDocLitImpl());
> svrFactory.create();
>
> final Service service = Service.create(TestDocLit_Service.SERVICE);
> service.addPort(TestDocLit_Service.TestDocLitSOAP,
> SOAPBinding.SOAP11HTTP_BINDING, url);
> service.getPort(TestDocLit_Service.TestDocLitSOAP,
> TestDocLit.class).operation1(42);
>
> The message sent by the client seems correct:
> <soap:Envelope
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2
>:operation1
> xmlns:ns2="http://www.example.org/TestDocLit/"><par1>42</par1></ns2:op
>eration1></soap:Body></soap:Envelope>
>
> But debugging through DocLiteralInInterceptor::getPara, it appears
> that the service expects a ("http://testdoclit.example.org/":"arg0"),
> whereas it receives a ("":par1), thus, we have in return the dreaded:
> null while invoking public abstract java.lang.String
> org.example.testdoclit.TestDocLit.operation1(int) with params [null].
>
> So, the server has basically lost the parameter's name, and added a
> target namespace which (maybe) not due. At
> http://localhost:9000/TestDocLit?wsdl, the generated WSDL exposes this
> fact as well: <wsdl:message name="operation1">
>     <wsdl:part element="tns:operation1" name="parameters">
>     </wsdl:part>
>   </wsdl:message>
> and tns:operation1 is defined below:
> <xsd:element name="operation1" type="tns:operation1"/>
> <xsd:complexType name="operation1">
> <xsd:sequence>
> <xsd:element name="arg0" type="xsd:int"/>
> </xsd:sequence>



-- 
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog

Mime
View raw message