[
https://issues.apache.org/jira/browse/CXF-3659?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Daniel Kulp resolved CXF-3659.
------------------------------
Resolution: Not A Problem
Fix Version/s: Invalid
Assignee: Daniel Kulp
This is working per JAX-WS spec. When generating code, we're only supposed to
look at the messages that are pointed to from the portType, not the binding.
Thus, by moving the header out of that message, it's no longer visible and the
normal unwrapping rules can trigger. You can add "-exsh true" to the
wsdl2java command to have it re-generate the header, but it does retain the
unwrapping.
With 2.4.2, you will be able to also add -bareMethods flag to force it to stay
in bare mode.
> wsdl2java fails to generate consistent Java from equivilent valid but
> slightly different WSDL, e.g. soap_header example
> -----------------------------------------------------------------------------------------------------------------------
>
> Key: CXF-3659
> URL: https://issues.apache.org/jira/browse/CXF-3659
> Project: CXF
> Issue Type: Bug
> Components: Tooling
> Affects Versions: 2.1.10, 2.0.13, 2.3, 2.2.12, 2.4, 2.4.1
> Environment: JDK 1.6_u20
> Reporter: Martin
> Assignee: Daniel Kulp
> Priority: Critical
> Labels: header, soap, wsdl, wsdl2java
> Fix For: Invalid
>
>
> Using the CXF distributed sample _soap_header_, by a small valid modification
> simplifying the wsdl, the generated code is altered significantly, with the
> parameters for the SOAP Body parameter being dropped.
> Sample from the unmodified CXF sample wsdl:
> {code}
> @WebResult(name = "outHeaderResponse", targetNamespace =
> "http://apache.org/cxf/sample/headers/body/", partName = "the_response")
> @WebMethod
> public org.apache.cxf.sample.headers.body.OutHeaderResponse outHeader(
> @WebParam(partName = "me", name = "outHeader", targetNamespace =
> "http://apache.org/cxf/sample/headers/body/")
> org.apache.cxf.sample.headers.body.OutHeader me,
> @WebParam(partName = "header_info", mode = WebParam.Mode.INOUT, name
> = "SOAPHeaderInfo", targetNamespace =
> "http://apache.org/cxf/sample/headers/header/", header = true)
>
> javax.xml.ws.Holder<org.apache.cxf.sample.headers.header.SOAPHeaderData>
> headerInfo
> );
> {code}
>
> Sample output from modified wsdl processing:
> {code}
> @WebResult(name = "responseType", targetNamespace = "")
> @RequestWrapper(localName = "outHeader", targetNamespace =
> "http://apache.org/cxf/sample/headers/body/", className =
> "org.apache.cxf.sample.headers.body.OutHeader")
> @WebMethod
> @ResponseWrapper(localName = "outHeaderResponse", targetNamespace =
> "http://apache.org/cxf/sample/headers/body/", className =
> "org.apache.cxf.sample.headers.body.OutHeaderResponse")
> public java.lang.String outHeader(
> @WebParam(name = "requestType", targetNamespace = "")
> java.lang.String requestType
> );
> {code}
> Note the missing *header* parameter in the modified wsdl vs unmodified wsdl:
> {code}
> @WebParam(partName = "header_info", mode = WebParam.Mode.INOUT, name
> = "SOAPHeaderInfo", targetNamespace =
> "http://apache.org/cxf/sample/headers/header/", header = true)
>
> javax.xml.ws.Holder<org.apache.cxf.sample.headers.header.SOAPHeaderData>
> headerInfo
> {code}
> Here is an example call from the original sample wsdl:
> {code:xml}
> <!-- the message def -->
> <message name="inHeaderRequest">
> <part element="tns:inHeader" name="me"/>
> <part element="tns:SOAPHeaderInfo" name="header_info"/>
> </message>
> <message name="inHeaderResponse">
> <part element="tns:inHeaderResponse" name="the_response"/>
> </message>
> <!-- the related operation in the binding -->
> <operation name="inHeader">
> <soap:operation soapAction="" style="document"/>
> <input name="inHeaderRequest">
> <soap:body parts="me" use="literal"/>
> <soap:header message="tns:inHeaderRequest" part="header_info"
> use="literal"/>
> </input>
> <output name="inHeaderResponse">
> <soap:body use="literal"/>
> </output>
> </operation>
> {code}
> And the modified wsdl that is not apparently parsed correctly:
> {code:xml}
> <!-- the message def -->
> <message name="HeaderInfo">
> <part element="tns:SOAPHeaderInfo" name="header_info"/>
> </message>
> <message name="inHeaderRequest">
> <part element="tns:inHeader" name="me"/>
> </message>
> <message name="inHeaderResponse">
> <part element="tns:inHeaderResponse" name="the_response"/>
> </message>
> <!-- the related operation in the binding -->
> <operation name="inHeader">
> <soap:operation soapAction="" style="document"/>
> <input name="inHeaderRequest">
> <soap:body parts="me" use="literal"/>
> <soap:header message="tns:HeaderInfo" part="header_info"
> use="literal"/>
> </input>
> <output name="inHeaderResponse">
> <soap:body use="literal"/>
> </output>
> </operation>
> {code}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira