用jax-ws生成存根失败 [英] Generating stubs with jax-ws fails
问题描述
我正在尝试使用jax-ws为WSO2 Identity Server管理服务生成存根
I am trying to generate a stub using jax-ws for the WSO2 Identity Server admin service https://xx.xx.xx.xx:9447/services/RemoteUserStoreManagerService?wsdl.
我已经下载了wsdl,但是当我运行时:
I've downloaded the wsdl but when I run:
wsimport -p org.wso2 RemoteUserStoreManagerService.xml
我收到以下错误
[ERROR] operation "updateCredential" has an invalid style
line 679 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "setUserClaimValue" has an invalid style
line 683 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "deleteUserClaimValues" has an invalid style
line 692 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "deleteUserClaimValue" has an invalid style
line 696 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "updateCredentialByAdmin" has an invalid style
line 705 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "deleteRole" has an invalid style
line 739 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "deleteUser" has an invalid style
line 748 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "updateRoleName" has an invalid style
line 762 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "updateRoleListOfUser" has an invalid style
line 766 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "addUser" has an invalid style
line 780 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "addRole" has an invalid style
line 784 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "updateUserListOfRole" has an invalid style
line 788 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "setUserClaimValues" has an invalid style
line 797 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "updateCredential" has an invalid style
line 857 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "setUserClaimValue" has an invalid style
line 878 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "deleteUserClaimValues" has an invalid style
line 887 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "deleteUserClaimValue" has an invalid style
line 908 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "updateCredentialByAdmin" has an invalid style
line 917 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "deleteRole" has an invalid style
line 1010 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "deleteUser" has an invalid style
line 1019 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "updateRoleName" has an invalid style
line 1040 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "updateRoleListOfUser" has an invalid style
line 1061 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "addUser" has an invalid style
line 1094 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "addRole" has an invalid style
line 1103 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "updateUserListOfRole" has an invalid style
line 1112 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "setUserClaimValues" has an invalid style
line 1121 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "updateCredential" has an invalid style
line 1205 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "setUserClaimValue" has an invalid style
line 1226 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "deleteUserClaimValues" has an invalid style
line 1235 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "deleteUserClaimValue" has an invalid style
line 1256 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "updateCredentialByAdmin" has an invalid style
line 1265 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "deleteRole" has an invalid style
line 1358 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "deleteUser" has an invalid style
line 1367 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "updateRoleName" has an invalid style
line 1388 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "updateRoleListOfUser" has an invalid style
line 1409 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "addUser" has an invalid style
line 1442 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "addRole" has an invalid style
line 1451 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "updateUserListOfRole" has an invalid style
line 1460 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] operation "setUserClaimValues" has an invalid style
line 1469 of file:/C:/tmp/RemoteUserStoreManagerService.xml
[ERROR] missing required property "style" of element "operation"
Failed to parse the WSDL.
这是出现第一个错误的文件的第679行附近的wsdl模式(不发布整个模式,因为它很大):
Here's the wsdl schema around line 679 of the file where the first error appears (not posting the whole schema, because it's rather large):
<wsdl:operation name="updateCredential">
<wsdl:input message="ns:updateCredentialRequest" wsaw:Action="urn:updateCredential"/>
<wsdl:fault message="ns:RemoteUserStoreManagerServiceUserStoreException" name="RemoteUserStoreManagerServiceUserStoreException" wsaw:Action="urn:updateCredentialRemoteUserStoreManagerServiceUserStoreException"/>
</wsdl:operation>
<wsdl:operation name="setUserClaimValue">
<wsdl:input message="ns:setUserClaimValueRequest" wsaw:Action="urn:setUserClaimValue"/>
<wsdl:fault message="ns:RemoteUserStoreManagerServiceUserStoreException" name="RemoteUserStoreManagerServiceUserStoreException" wsaw:Action="urn:setUserClaimValueRemoteUserStoreManagerServiceUserStoreException"/>
</wsdl:operation>
<wsdl:operation name="getUserClaimValuesForClaims">
<wsdl:input message="ns:getUserClaimValuesForClaimsRequest" wsaw:Action="urn:getUserClaimValuesForClaims"/>
<wsdl:output message="ns:getUserClaimValuesForClaimsResponse" wsaw:Action="urn:getUserClaimValuesForClaimsResponse"/>
<wsdl:fault message="ns:RemoteUserStoreManagerServiceUserStoreException" name="RemoteUserStoreManagerServiceUserStoreException" wsaw:Action="urn:getUserClaimValuesForClaimsRemoteUserStoreManagerServiceUserStoreException"/>
</wsdl:operation>
推荐答案
尝试在所有wsdl操作中添加输出消息.有趣的是,注意到wsimport
不会抱怨getUserClaimValuesForClaims
操作,并且该方法已定义了输出消息.
Try adding output message in all wsdl operations. It is interesting to notice that wsimport
doesn't complain on getUserClaimValuesForClaims
operation, and that method has output message defined.
编辑:您可以不用担心而编辑wsdl,因为这些有问题的方法的返回类型为空,因此您可以将所需的内容都作为返回类型,而无需理会.换句话说,在调用Web服务时,您仅对输入参数感兴趣,因为这些方法实际上不返回任何内容.因此,请执行以下操作:
EDIT: You can edit wsdl without fear because these problematic methods have void return type so you can put whatever you want as a return type and simply ignore it. In other words, when calling Web service you are only interested in the input parameters since these methods actually don't return anything. Therefore, do the following:
- 复制一份wsdl,例如将其命名为
client.wsdl
- 将输出消息添加到没有该消息的所有操作中
- 从
client.wsdl
生成Web服务客户端(不要更改服务!) - 调用Web服务方法,并忽略这些有问题的"方法的返回类型
- Make a copy of wsdl, for example name it
client.wsdl
- Add output message to all operations which don't have it
- Generate a Web service client from
client.wsdl
(don't change the service!) - Call Web service methods and ignore the return type for these "problematic" ones
这篇关于用jax-ws生成存根失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!