creating header with axis2 java2wsdl - how?
I am using org.apache.axis2 to create wsdl. Our code is implementing ScemaGenerator and has our additions. I am trying to开发者_Python百科 find a way to create the wsdl with the header definition, that will include userName and password. How can I do that through the code and not through file editing after it was created? and If I have no choice and I need to edit the file, what is the correct sintax to do it? What I wrote is creating a wsdl parsing error when it is used for wsdl2Java. My code:
<wsdl:message name="wsDirectLoginRequest">
<wsdl:part name="parameters" element="ns:wsDirectLogin">
</wsdl:part>
<wsdl:part name="request_header" element="intf:pswd">
</wsdl:message>
...
<wsdl:input message="ns:wsDirectLoginRequest" wsaw:Action="urn:wsDirectLogin">
<wsdlsoap:header message="intf:wsDirectLoginRequest" part="request_header" use="literal"/>
<wsdlsoap:body use="literal" parts="parameters"/>
</wsdl:input>
...
What am I doing wrong? Thank you
There is no way to do this with the DefaultSchemaGenerator comes with Axis2.
What is the wsdl error you get? Please look at here for a correct wsdl[1].
But as pointed out in a earlier comment, it is better to thing whether you need to use WS-Security (using rampart) or add headers manually.
[1] http://wso2.org/node/2935/
精彩评论