最近参与一个电信的项目, 对方提供的WSDL,都添加了Webservice Policy的配置,导致我无法用Axis2的WSDL2Java来生成代码。
在每个input 的message 里,它都加上了一个policy的配置
<s1:operation name="viewBill">
<s4:operation soapAction="viewBill" style="document"/>
<s1:input>
<wsp:Policy>
<wsp:PolicyReference URI="#Auth.xml"/>
</wsp:Policy>
<s4:header message="s3:accountManagementServiceRequestHeader" part="request_header" use="literal"/>
<s4:body use="literal"/>
</s1:input>
................
这个Auth.xml附加在了WSDL的最后
<wsp:UsingPolicy s1:Required="true"/>
<wsp:Policy s0:Id="Auth.xml">
<wssp:Identity xmlns:wssp="http://www.bea.com/wls90/security/policy">
<wssp:SupportedTokens>
<wssp:SecurityToken TokenType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken">
<wssp:UsePassword Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"/>
</wssp:SecurityToken>
</wssp:SupportedTokens>
</wssp:Identity>
</wsp:Policy>
编译的时候Axis2报如下错误: #Auth.xml can't be resolved
PS: 附件是WSDL 文件。
电信的wsdl用axis生成应该没有问题。
我就是用这个生成的。你可以试试用wtp来生成。