This is part of the wrapped doc/lit standard.   That requires the first part in 
the message in the wsdl to represent the parameters that are passed to the 
method.    Headers are stuck after that.

Dan


On Nov 1, 2012, at 4:48 AM, timis <[email protected]> wrote:

> Hi guys,
> I've found a feature or bug during java ->wsdl -> java process. If one of
> parameters is marked as @WebParam(header = true) it will be last parameter
> in generated SEI on a client side.
> There is an example of it. (apache cxf 2.6.2)
> WebService
> 
> package com.test.foo;
> 
> import javax.jws.WebMethod;
> import javax.jws.WebParam;
> import javax.jws.WebService;
> 
> 
> @WebService(
>               serviceName = "FooService",
>               name = "Foo"
> )
> public class FooWS {
> 
>       @WebMethod
>       public Foo getFoo(
>                       @WebParam(header = true, name = "context") String 
> context,
>                       @WebParam(name = "arg") String arg
>       ) {
>               return new Foo("hello");
>       }
> }
> 
> then java ->wsdl 
> java2ws.bat -wsdl -cp . com.test.foo.FooWS
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions name="FooService" targetNamespace="http://foo.test.com/";
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
> xmlns:tns="http://foo.test.com/";
> xmlns:xsd="http://www.w3.org/2001/XMLSchema";
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";>
>  <wsdl:types>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
> xmlns:tns="http://foo.test.com/"; attributeFormDefault="unqualified"
> elementFormDefault="unqualified" targetNamespace="http://foo.test.com/";>
> <xs:element name="getFoo" type="tns:getFoo"/>
> <xs:element name="getFooResponse" type="tns:getFooResponse"/>
> <xs:complexType name="getFoo">
> <xs:sequence>
> <xs:element minOccurs="0" name="arg" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> <xs:complexType name="getFooResponse">
> <xs:sequence>
> <xs:element minOccurs="0" name="return" type="tns:foo"/>
> </xs:sequence>
> </xs:complexType>
> <xs:complexType name="foo">
> <xs:sequence>
> <xs:element minOccurs="0" name="str" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> <xs:element name="context" nillable="true" type="xs:string"/>
> </xs:schema>
>  </wsdl:types>
>  <wsdl:message name="getFooResponse">
>    <wsdl:part name="parameters" element="tns:getFooResponse">
>    </wsdl:part>
>  </wsdl:message>
>  <wsdl:message name="getFoo">
>    <wsdl:part name="parameters" element="tns:getFoo">
>    </wsdl:part>
>    <wsdl:part name="context" element="tns:context">
>    </wsdl:part>
>  </wsdl:message>
>  <wsdl:portType name="Foo">
>    <wsdl:operation name="getFoo">
>      <wsdl:input name="getFoo" message="tns:getFoo">
>    </wsdl:input>
>      <wsdl:output name="getFooResponse" message="tns:getFooResponse">
>    </wsdl:output>
>    </wsdl:operation>
>  </wsdl:portType>
>  <wsdl:binding name="FooServiceSoapBinding" type="tns:Foo">
>    <soap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http"/>
>    <wsdl:operation name="getFoo">
>      <soap:operation soapAction="" style="document"/>
>      <wsdl:input name="getFoo">
>        <soap:header message="tns:getFoo" part="context" use="literal">
>        </soap:header>
>        <soap:body parts="parameters" use="literal"/>
>      </wsdl:input>
>      <wsdl:output name="getFooResponse">
>        <soap:body use="literal"/>
>      </wsdl:output>
>    </wsdl:operation>
>  </wsdl:binding>
>  <wsdl:service name="FooService">
>    <wsdl:port name="FooPort" binding="tns:FooServiceSoapBinding">
>      <soap:address location="http://localhost:9090/FooPort"/>
>    </wsdl:port>
>  </wsdl:service>
> </wsdl:definitions>
> 
> you can see that order of parameters have changed  
> 
>  <wsdl:message name="getFoo">
>    <wsdl:part name="parameters" element="tns:getFoo">
>    </wsdl:part>
>    <wsdl:part name="context" element="tns:context">
>    </wsdl:part>
>  </wsdl:message>
> 
> then java → wsdl
> wsdl2java.bat FooService.wsdl
> 
> now SEI looks like
> 
> package com.test.foo;
> 
> import javax.jws.WebMethod;
> import javax.jws.WebParam;
> import javax.jws.WebResult;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding;
> import javax.xml.bind.annotation.XmlSeeAlso;
> 
> /**
> * This class was generated by Apache CXF 2.6.2
> * 2012-11-01T12:09:35.926+04:00
> * Generated source version: 2.6.2
> * 
> */
> @WebService(targetNamespace = "http://foo.test.com/";, name = "Foo")
> @XmlSeeAlso({ObjectFactory.class})
> @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
> public interface Foo {
> 
>    @WebResult(name = "getFooResponse", targetNamespace =
> "http://foo.test.com/";, partName = "parameters")
>    @WebMethod
>    public GetFooResponse getFoo(
>        @WebParam(partName = "parameters", name = "getFoo", targetNamespace
> = "http://foo.test.com/";)
>        GetFoo parameters,
>        @WebParam(partName = "context", name = "context", targetNamespace =
> "http://foo.test.com/";, header = true)
>        java.lang.String context
>    );
> }
> you can see that order of parameters have changed.
> Is it a bug or feature ? How can I manage order of parameters? Are there any
> workarounds?
> 
> 
> 
> --
> View this message in context: 
> http://cxf.547215.n5.nabble.com/WebParam-header-true-and-it-s-place-in-generated-SEI-tp5717680.html
> Sent from the cxf-user mailing list archive at Nabble.com.

-- 
Daniel Kulp
[email protected] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Reply via email to