Генерации заглушки с JAX-WS, которая не
Я пытаюсь создать заглушку с помощью jax-ws для службы администрирования сервера идентификации WSO2 https://xx.xx.xx.xx:9447/services/RemoteUserStoreManagerService?wsdl .
Я скачал wsdl, но когда я запускаю:
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.
Вот схема wsdl вокруг строки 679 файла, где появляется первая ошибка (не публикуя всю схему, потому что она довольно большая):
<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>
2 ответа:
Попробуйте добавить выходное сообщение во все операции wsdl. Интересно отметить, что
wsimport
не жалуется на работуgetUserClaimValuesForClaims
, и этот метод имеет определенное выходное сообщение.EDIT : вы можете редактировать wsdl без страха, потому что эти проблемные методы имеют тип возврата void, поэтому вы можете поместить все, что хотите, в качестве типа возврата и просто игнорировать его. Другими словами, при вызове веб-службы Вас интересуют только входные параметры, так как эти методы фактически не возвращают что-нибудь. Поэтому сделайте следующее:
- сделайте копию wsdl, например назовите ее
client.wsdl
- добавьте выходное сообщение ко всем операциям, которые его не имеют
- создание клиента веб-службы из
client.wsdl
(Не меняйте службу !)- вызовите методы веб-службы и проигнорируйте возвращаемый тип для этих "проблемных" методов
Ответ Милена Микича был превосходным и привел меня к правильному решению. Я подумал, что приведу пример того, как сделать то, что он предложил. Обратите внимание из списка ошибок, что ошибки приходят парами:
[ERROR] operation "updateCredential" has an invalid style line 679 of file:/C:/tmp/RemoteUserStoreManagerService.xml . . . [ERROR] operation "updateCredential" has an invalid style line 1205 of file:/C:/tmp/RemoteUserStoreManagerService.xml . . .
Образец WSDL OP включал только первые 2 ошибки, но решение одинаково для всех. Результатом становится:
<wsdl:operation name="updateCredential"> <wsdl:input message="ns:updateCredentialRequest" wsaw:Action="urn:updateCredential"/> <wsdl:output message="" /> <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:output message="" /> <wsdl:fault message="ns:RemoteUserStoreManagerServiceUserStoreException" name="RemoteUserStoreManagerServiceUserStoreException" wsaw:Action="urn:setUserClaimValueRemoteUserStoreManagerServiceUserStoreException"/> </wsdl:operation>