You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Chris McClelland (JIRA)" <ji...@apache.org> on 2007/08/05 11:23:52 UTC

[jira] Commented: (CXF-885) You cannot have some methods WRAPPED and others BARE in the same service

    [ https://issues.apache.org/jira/browse/CXF-885?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12517749 ] 

Chris McClelland commented on CXF-885:
--------------------------------------

Also (probably related, but much less serious), the inclusion of another WRAPPED method with @RequestWrapper and @ResponseWrapper, like this:

@WebMethod(operationName="Arithmetic")
@RequestWrapper(localName="Arithmetic", targetNamespace=NS_URI, className="com.foo.Arithmetic")
@ResponseWrapper(localName="ArithmeticResponse", targetNamespace=NS_URI, className="com.foo.ArithmeticResponse")
@SOAPBinding(parameterStyle=SOAPBinding.ParameterStyle.WRAPPED)
public void arithmetic(
    @WebParam(targetNamespace=NS_URI, name="Num1")
    double num1,
    @WebParam(targetNamespace=NS_URI, name="Num2")
    double num2,
    @WebParam(targetNamespace=NS_URI, name="Add", mode=Mode.OUT)
    Holder<Double> add,
    @WebParam(targetNamespace=NS_URI, name="Sub", mode=Mode.OUT)
    Holder<Double> sub,
    @WebParam(targetNamespace=NS_URI, name="Mul", mode=Mode.OUT)
    Holder<Double> mul,
    @WebParam(targetNamespace=NS_URI, name="Div", mode=Mode.OUT)
    Holder<Double> div)
{
        add.value=num1 + num2;
        sub.value=num1 - num2;
        mul.value=num1 * num2;
        div.value=num1 / num2;
}

...introduces a spurious namespace declaration in the hello() response:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <ns1:HelloResponse xmlns:ns1="http://foo.com">
      <Result xmlns:ns2="http://foo.com">Hello Dan and Chris</Result>
    </ns1:HelloResponse>
  </soap:Body>
</soap:Envelope>

The 'ns2' prefix is never used.

> You cannot have some methods WRAPPED and others BARE in the same service
> ------------------------------------------------------------------------
>
>                 Key: CXF-885
>                 URL: https://issues.apache.org/jira/browse/CXF-885
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.1
>         Environment: Linux, SunJDK1.6.0_01
>            Reporter: Chris McClelland
>            Priority: Minor
>             Fix For: 2.1
>
>
> If I deploy a service like this:
> @WebService(targetNamespace="http://foo.com")
> public class Test {
> 	@WebMethod(operationName="Simple")
> 	@WebResult(name="SimpleResponse", targetNamespace=NS_URI)
> 	@SOAPBinding(parameterStyle=SOAPBinding.ParameterStyle.BARE)
> 	public String simple(@WebParam(name="Simple") String req)
> 	{
> 		return "Hello " + req;
> 	}
> 	@WebMethod(operationName="Hello")
> 	@WebResult(name="Result")
> 	@SOAPBinding(parameterStyle=SOAPBinding.ParameterStyle.WRAPPED)
> 	public String hello(
> 		@WebParam(name="A") String a,
> 		@WebParam(name="B") String b)
> 	{
> 		return "Hello " + a + " and " + b;
> 	}
> }
> And then call the hello() method like this:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>   <soap:Body>
>     <req:Hello xmlns:req="http://foo.com">
>       <A>Dan</A>
>       <B>Chris</B>
>     </req:Hello>
>   </soap:Body>
> </soap:Envelope>
> ...I get this (incorrect) response:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>   <soap:Body>
>     <Result>Hello Dan and Chris</Result>
>   </soap:Body>
> </soap:Envelope>
> It's incorrect because the WSDL promises that the response will be an unqualified 'Result' element locally-valid within an {http://foo.com}:HelloResponse element.
> Now if I switch the simple() method to WRAPPED, and try calling hello() again, I get the correct response:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>   <soap:Body>
>     <ns1:HelloResponse xmlns:ns1="http://foo.com">
>       <Result>Hello Dan and Chris</Result>
>     </ns1:HelloResponse>
>   </soap:Body>
> </soap:Envelope>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.