Topic
  • 5 replies
  • Latest Post - ‏2012-04-05T18:50:18Z by scott_klement
SystemAdmin
SystemAdmin
535 Posts

Pinned topic create Stubs with wsdl2ws

‏2012-04-04T07:41:42Z |
Hi

i want to consume a Webservice written in PHP from my system i.
The WS is very easy and based on the following WSDL

<!--?xml version =
'1.0' encoding =
'UTF-8' ?--> <definitions name=
"shopws" targetnamespace=
"http:/test.de/shopws.wsdl" xmlns:tns=
"http:/test.de/shopws.wsdl" xmlns:soap=
"http:/schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd=
"http:/www.w3.org/2001/XMLSchema" xmlns=
"http:/schemas.xmlsoap.org/wsdl/"> <message name=
"artikelupdateRequest"> <part name=
"xmlin" type=
"xsd:string"> </part></message> <message name=
"artikelupdateResponse"> <part name=
"xmlout" type=
"xsd:string"> </part></message> <porttype name=
"artikelupdatePortType"> <operation name=
"artikelupdate"> <input message=
"tns:artikelupdateRequest"> <output message=
"tns:artikelupdateResponse"> </output></operation> </porttype> <binding name=
"artikelupdateBinding" type=
"tns:artikelupdatePortType"> <soap:binding style=
"document" transport=
"http:/schemas.xmlsoap.org/soap/http"> <operation name=
"artikelupdate"> <soap:operation soapaction=
"urn:shopws#artikelupdate" style=
"document"> <input> <soap:body use=
"encoded" namespace=
"urn:shopws" encodingstyle=
"http:/schemas.xmlsoap.org/soap/encoding/"> <output> <soap:body use=
"encoded" namespace=
"urn:shopws" encodingstyle=
"http:/schemas.xmlsoap.org/soap/encoding/"> </soap:body></output> </soap:body></soap:operation></operation> </soap:binding></binding> <service name=
"artikelupdateService"> <port name=
"artikelupdatePort" binding=
"tns:artikelupdateBinding"> <soap:address location=
"http:/test.de/shopws.php5"> </soap:address></port> </service> </definitions>


If i try to create the Stubs with wsdl2ws i get the following error

wsdl2ws.sh -o/outputdir/rpg -lrpg -s/qsys.lib/mylib.lib/wsrpg.srvpgm http:/test.de/shopws.php5?wsdl java.lang.NullPointerException at org.apache.axis.wsdl.wsdl2ws.info.WSDLInfo.addDocumentStyleOutputMessageToMethodInfo(Unknown Source) at org.apache.axis.wsdl.wsdl2ws.info.WSDLInfo.processServiceMethods(Unknown Source) at org.apache.axis.wsdl.wsdl2ws.WSDL2Ws.generateWrappers(Unknown Source) at com.ibm.systemi.iws.client.codegen.axis.scripts.WSDL2WS.generateStubs(WSDL2WS.java:129) at com.ibm.systemi.iws.client.codegen.axis.scripts.WSDL2WS.startStubGeneration(WSDL2WS.java:62) at com.ibm.systemi.iws.client.codegen.axis.scripts.WSDL2WS.main(WSDL2WS.java:121) Code generation failed. Please see errors above.


Can anybody give me some help where to look for the error ?

By jo
Updated on 2012-04-05T18:50:18Z at 2012-04-05T18:50:18Z by scott_klement
  • scott_klement
    scott_klement
    245 Posts

    Re: create Stubs with wsdl2ws

    ‏2012-04-04T19:06:37Z  
    The WSDL file that you've posted is not a legitimate XML document. (It's not well-formed.)

    Is it possible that you made a copy/paste error when you posted it?

    If not, I'd say you have big problems, because your web services tools are creating invalid WSDL files.
  • amra1
    amra1
    45 Posts

    Re: create Stubs with wsdl2ws

    ‏2012-04-05T00:30:48Z  
    I should also add that the wsdl2ws tool only supports SOAP style of document/literal.
  • SystemAdmin
    SystemAdmin
    535 Posts

    Re: create Stubs with wsdl2ws

    ‏2012-04-05T07:32:57Z  
    ok, i tried to change my wsdl to an wellformed wsdl file.
    
    <?xml version=
    "1.0" encoding=
    "UTF-8"?> <wsdl:definitions name=
    "shopws" xmlns:wsdl=
    "http://schemas.xmlsoap.org/wsdl/" targetNamespace=
    "http://ids-edv.de/Testumgebung/idsws" xmlns:tns=
    "http://ids-edv.de/Testumgebung/idsws" xmlns:wsaw=
    "http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap=
    "http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd=
    "http://www.w3.org/2001/XMLSchema" xmlns=
    "http://schemas.xmlsoap.org/wsdl/"> <wsdl:message name=
    "artikelupdateRequest"> <wsdl:part name=
    "xmlin" type=
    "xsd:string"/> </wsdl:message> <wsdl:message name=
    "artikelupdateResponse"> <wsdl:part name=
    "xmlout" type=
    "xsd:string"/> </wsdl:message> <wsdl:portType name=
    "artikelupdatePortType"> <wsdl:operation name=
    "artikelupdate"> <wsdl:input message=
    "tns:artikelupdateRequest" wsaw:Action=
    "urn:artikelupdate"/> <wsdl:output message=
    "tns:artikelupdateResponse" wsaw:Action=
    "urn:artikelupdateResponse"/> </wsdl:operation> </wsdl:portType> <wsdl:binding name=
    "artikelupdateBinding" type=
    "tns:artikelupdatePortType"> <soap:binding transport=
    "http://schemas.xmlsoap.org/soap/http" style=
    "document"/> <wsdl:operation name=
    "artikelupdate"> <soap:operation soapAction=
    "urn:artikelupdate" style=
    "document"/> <wsdl:input> <soap:body use=
    "literal"/> </wsdl:input> <wsdl:output> <soap:body use=
    "literal"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name=
    "artikelupdateService"> <wsdl:port name=
    "artikelupdatePort" binding=
    "tns:artikelupdateBinding"> <soap:address location=
    "http://ids-edv.de/Testumgebung/idsws/testws.php5"/> </wsdl:port> </wsdl:service> </wsdl:definitions>
    


    but there ist still the same error.
    i have no idea where to look whatgoing wrong.
  • SystemAdmin
    SystemAdmin
    535 Posts

    Re: create Stubs with wsdl2ws

    ‏2012-04-05T14:34:28Z  
    ok, something was wrong with the WSDL-File.
    I created a new one with Zend Studio and it worked fine.

    I think amra1 post was the solution fpr the problem.

    Thanks so far
  • scott_klement
    scott_klement
    245 Posts

    Re: create Stubs with wsdl2ws

    ‏2012-04-05T18:50:18Z  
    ok, i tried to change my wsdl to an wellformed wsdl file.
    <pre class="jive-pre"> <?xml version= "1.0" encoding= "UTF-8"?> <wsdl:definitions name= "shopws" xmlns:wsdl= "http://schemas.xmlsoap.org/wsdl/" targetNamespace= "http://ids-edv.de/Testumgebung/idsws" xmlns:tns= "http://ids-edv.de/Testumgebung/idsws" xmlns:wsaw= "http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap= "http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd= "http://www.w3.org/2001/XMLSchema" xmlns= "http://schemas.xmlsoap.org/wsdl/"> <wsdl:message name= "artikelupdateRequest"> <wsdl:part name= "xmlin" type= "xsd:string"/> </wsdl:message> <wsdl:message name= "artikelupdateResponse"> <wsdl:part name= "xmlout" type= "xsd:string"/> </wsdl:message> <wsdl:portType name= "artikelupdatePortType"> <wsdl:operation name= "artikelupdate"> <wsdl:input message= "tns:artikelupdateRequest" wsaw:Action= "urn:artikelupdate"/> <wsdl:output message= "tns:artikelupdateResponse" wsaw:Action= "urn:artikelupdateResponse"/> </wsdl:operation> </wsdl:portType> <wsdl:binding name= "artikelupdateBinding" type= "tns:artikelupdatePortType"> <soap:binding transport= "http://schemas.xmlsoap.org/soap/http" style= "document"/> <wsdl:operation name= "artikelupdate"> <soap:operation soapAction= "urn:artikelupdate" style= "document"/> <wsdl:input> <soap:body use= "literal"/> </wsdl:input> <wsdl:output> <soap:body use= "literal"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name= "artikelupdateService"> <wsdl:port name= "artikelupdatePort" binding= "tns:artikelupdateBinding"> <soap:address location= "http://ids-edv.de/Testumgebung/idsws/testws.php5"/> </wsdl:port> </wsdl:service> </wsdl:definitions> </pre>

    but there ist still the same error.
    i have no idea where to look whatgoing wrong.
    Jogi,

    In your first example, the fact that the document wasn't well-formed was only the beginning! IT wasn't well-formed because the closing tags were missing from some of the elements. But, on top of that, it wasn't a valid WSDL because you the capitalization wrong on some of the attributes, and an incorrect structure (in some cases, tags from the WSDL namespace were nested inside tags from the SOAP namespace, which is legal in XML, but makes no logical sense when you consider the purpose of a WSDL document.)

    I have to assume your first example was typed by hand, because I can't imagine a tool generating something like that.

    Also, your first example uses the document/encoded style -- which is no WS-I compliant, and honestly, I don't I've ever seen anyone use document/encoded before.

    The second example was well-formed, and specifies the (very popular) document/literal encoding style, which is good -- unfortunately, it doesn't follow the rules of that encoding style! It would be a legitimate RPC/encoded document, but it specifies document/literal... Mainly, it was missing the <types> declaration with the corresponding schema that's required with document/literal.

    You say you generated another one that worked (but didn't post it here). If that works, great... but, if you do want to type up your own WSDL and make it work, I suggest studying the WSDL standard thoroughly, and finding a tool (like SoapUI) that you can use to help you check and verify that your document is valid.