使用 axis2 java2wsdl 创建标头 - 如何?
我正在使用 org.apache.axis2 创建 wsdl。我们的代码正在实现 ScemaGenerator 并添加了一些内容。我正在尝试找到一种方法来创建带有标头定义的 wsdl,其中包括用户名和密码。如何通过代码而不是创建后通过文件编辑来做到这一点?如果我别无选择并且需要编辑文件,那么正确的语法是什么?我写的是在用于 wsdl2Java 时创建 wsdl 解析错误。我的代码:
<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>
...
我做错了什么? 谢谢
I am using org.apache.axis2 to create wsdl. Our code is implementing ScemaGenerator and has our additions. I am trying to 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 Axis2 附带的 DefaultSchemaGenerator 无法做到这一点。
您收到的 wsdl 错误是什么?请查看此处以获得正确的 wsdl[1]。
但正如之前的评论中指出的那样,最好确定是否需要使用 WS-Security(使用 Rampart)或手动添加标头。
[1] http://wso2.org/node/2935/
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/