2012-08-28 5 views
6

Ich versuche, einen Stub mit Jax-Ws für den WSO2 Identity Server-Verwaltungsdienst https://xx.xx.xx.xx:9447/services/RemoteUserStoreManagerService?wsdl zu generieren.Generieren von Stubs mit Jax-ws schlägt fehl

Ich habe die WSDL-Datei heruntergeladen, aber wenn ich laufe:

wsimport -p org.wso2 RemoteUserStoreManagerService.xml 

erhalte ich die folgenden Fehler

[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. 

Hier ist die Wsdl Schema um Zeile 679 der Datei, in der erste Fehler auftritt (das ganze Schema nicht posten, weil es ziemlich groß ist):

 <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> 

Antwort

3

Versuchen Sie, Ausgabenachrichten in allen hinzuzufügen WSDL-Operationen. Es ist interessant zu bemerken, dass wsimport nicht auf getUserClaimValuesForClaims Operation beschwert, und diese Methode hat Ausgabe Nachricht definiert.

BEARBEITEN: Sie können wsdl ohne Angst bearbeiten, weil diese problematischen Methoden void Rückgabetyp haben, so dass Sie setzen können, was Sie wollen, als Rückgabetyp und einfach ignorieren. Mit anderen Worten, beim Aufruf des Web-Service sind Sie nur an den Eingabeparametern interessiert, da diese Methoden eigentlich nichts zurückgeben. Deshalb gehen Sie wie folgt:

  1. eine Kopie Wsdl Stellen, zum Beispiel nennen es client.wsdl
  2. Ausgabenachricht an alle Operationen hinzufügen, die es nicht haben
  3. einen Web-Service-Client generieren von client.wsdl (nicht den Dienst ändern!)
  4. Anruf Web-Service-Methoden und ignorieren den Rückgabetyp für diese „problematischen“ Einsen
+0

Ich habe das bemerkt, aber das Problem ist, dass dieser Service in der WSO2 Kohlenstoffkern gebaut wird und ich bin mir nicht sicher, wie und wenn ich es ändern kann. Ich denke, ich brauche eine Art Workaround. – Ivo

+0

Nun, versuchen Sie zuerst, nur WSDL zu optimieren, ohne den Dienst zu ändern. Es ist möglich (nicht sicher für diesen speziellen Fall, obwohl), habe es oft getan. –

+0

Danke, ich habe das ausprobiert und es hat gut funktioniert, es sind jedoch neue Fehler aufgetreten. – Ivo

0

Miljen Mikics Antwort war ausgezeichnet und brachte mich zur richtigen Lösung. Ich dachte, ich würde ein Beispiel geben, wie man das macht, was er vorgeschlagen hat. Hinweis aus der Fehlerliste, die die Fehler kommen in Paaren:

[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 
. 
. 
. 

der WSDL-Probe des OP enthielt nur die ersten 2 Fehler, aber die Lösung ist ähnlich für alle. Das Ergebnis wird:

<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>