I'm generating code (with wsgen) from wsdl. One of the operations I defined in my binding use headers, like this:
<wsdl:operation name="getData">
<soap:operation soapAction=""/>
<wsdl:input>
<soap:header message="common:myRequestHeaders" part="sessionID" use="literal"/>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output><soap:body use="literal"/>
</wsdl:operation>
the myRequestHeaders message looks like:
<wsdl:message name="myRequestHeaders">
<wsdl:part name="sessionId" element="xs:string"/>
</wsdl:message>
Now, when I generate my code, the web method that is generated uses 'string' as the name of the parameter, instead of 'sessionId' as I'd rather have:
@WebMethod(operationName = "getData" action = "")
public Data getData(
@WebParam(name="string", header="true") String string,
@WebParam(name="path") String path);
wsgen should use 'sessionId' for the parameter name instead of the element's type name.
in my schema, I added the following element (targetnamespace has prefix 'tns' in wsdl):
<xs:element name="sessionId" type="xs:string"/>
then in my message definitions, I use
<wsdl:message name="myRequestHeaders">
<wsdl:part name="sessionId" element="tns:sessionId"/>
</wsdl:message>
this does work, it generates correct names in code.