From: Joshua B. <jrb...@lb...> - 2007-07-18 21:38:28
|
Here is an example Echo service with WSDL and unittests: zsi/ samples/Echo/Echo.wsdl zsi/test/wsdl2py/test_Echo.py zsi/test/wsdl2py/test/servers/EchoServer.py If this isn't what you're looking for, do you have a WSDL? -josh On Jul 18, 2007, at 8:30 AM, Arye wrote: > Hello again, > I am coming back to this after a long delay. > I do need the server stubs now. In section 3.4 (Service =20 > implementation) > of the User's guide, you give an example but I am having some trouble > translating it to a simple echo. > > def soap_Echo(self, ps): > rsp =3D EchoServer_server.EchoServer.soap_Echo(self, ps) > *** > return rsp > > Could you please once again explain what needs to be done > before returning rsp? > I did find many echo examples.None seems to apply to version 2.1. > > Sincerely, > Arye. > On 5/23/07, Joshua Boverhof <jrb...@lb...> wrote: >> sorry for the confusion. my bad. >> >> I'm using SVN slated to become "ZSI-2.1", which by default generates >> modules >> >> _client -- client stubs, Locator, Port >> _types -- schema type classes >> _server -- server stubs >> >> So server stubs are generated too, but of course you don't have to >> use it. >> >> You're correct, all I did to get this to work was specify >> >> typed=3DTrue >> >> and that should work for you too. >> >> -josh >> >> On May 21, 2007, at 10:53 AM, Arye wrote: >> >> > Dear Joshua Boverhof, >> > Thanks for looking into this. I am coming back to this after >> > a little delay. >> > >> > Can you please specify the version of ZSI you are using. >> > I am using version 2.0 with Python2.4 and the generated >> > file name is "TemperatureService_services.py" and >> > not "TemperatureService_client.py". >> > >> > Did you just manually replace "typed=3DTrue" by "typed=3DFalse" >> > between your two call ? >> > >> > These must be really stupid questions. >> > Sorry about that. >> > Ary=E9. >> > >> > On 5/4/07, Joshua Boverhof <jrb...@lb...> wrote: >> >> There actually used to be a unittest for this service. I appear >> >> to have >> >> removed it some time ago, usually I do this because either the >> >> service >> >> is unreliable, the WSDL has errors or the service doesn't reflect >> >> the WSDL. >> >> >> >> So the problem is the service will not digest the "zipcode" >> >> because it >> >> can't locate a "deserializer" because the item is untyped.. >> >> Unfortunately this means the service is broke, or at least very >> >> fragile, >> >> since this information is implied by the WSDL and should not be >> >> specified. >> >> >> >> Unfortunately many more services will break if you specify the >> >> "xsi:type". damned if you do damned if you don't. >> >> >> >> -josh >> >> >> >> boverhof@koresh:/tmp/TEST> cat run.py >> >> import sys >> >> from TemperatureService_client import * >> >> >> >> loc =3D TemperatureServiceLocator() >> >> port =3D loc.getTemperaturePort(tracefile=3Dsys.stdout) >> >> msg =3D getTempRequest() >> >> msg.Zipcode =3D 91020 >> >> rsp =3D port.getTemp(msg) >> >> >> >> >> >> boverhof@koresh:/tmp/TEST> mkdir BK >> >> boverhof@koresh:/tmp/TEST> cd BK >> >> boverhof@koresh:/tmp/TEST/BK> !w >> >> wsdl2py -b http://www.xmethods.net/sd/2001/TemperatureService.wsdl >> >> boverhof@koresh:/tmp/TEST/BK> cd .. >> >> boverhof@koresh:/tmp/TEST> diff TemperatureService_client.py BK/ >> >> TemperatureService_client.py >> >> 43c43 >> >> < _getTempRequestTypecode =3D Struct(pname=3D("urn:xmethods- >> >> Temperature","getTemp"), ofwhat=3D[ZSI.TC.String(pname=3D"zipcode", >> >> aname=3D"_zipcode", typed=3DTrue, encoded=3DNone, minOccurs=3D1, >> >> maxOccurs=3D1, nillable=3DTrue)], pyclass=3DNone, = encoded=3D"urn:xmethods- >> >> Temperature") >> >> --- >> >> > _getTempRequestTypecode =3D Struct(pname=3D("urn:xmethods- >> >> Temperature","getTemp"), ofwhat=3D[ZSI.TC.String(pname=3D"zipcode", >> >> aname=3D"_zipcode", typed=3DFalse, encoded=3DNone, minOccurs=3D1, >> >> maxOccurs=3D1, nillable=3DTrue)], pyclass=3DNone, = encoded=3D"urn:xmethods- >> >> Temperature") >> >> boverhof@koresh:/tmp/TEST> python run.py >> >> >> >> _________________________________ Fri May 4 07:45:48 2007 =20 >> REQUEST: >> >> <SOAP-ENV:Envelope xmlns:SOAP-ENC=3D"http://schemas.xmlsoap.org/=20= >> soap/ >> >> encoding/" xmlns:SOAP-ENV=3D"http://schemas.xmlsoap.org/soap/ >> >> envelope/" xmlns:ZSI=3D"http://www.zolera.com/schemas/ZSI/" >> >> xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema" xmlns:xsi=3D"http:// >> >> www.w3.org/2001/XMLSchema-instance" SOAP-=20 >> ENV:encodingStyle=3D"http:// >> >> schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Header></SOAP- >> >> ENV:Header><SOAP-ENV:Body xmlns:ns1=3D"urn:xmethods- >> >> Temperature"><ns1:getTemp><zipcode>91020</zipcode></ns1:getTemp></ >> >> SOAP-ENV:Body></SOAP-ENV:Envelope> >> >> _________________________________ Fri May 4 07:45:48 2007 =20 >> RESPONSE: >> >> 500 >> >> Internal Server Error >> >> ------- >> >> Date: Fri, 04 May 2007 19:19:33 GMT >> >> Server: Enhydra-MultiServer/3.1.1b1 >> >> Status: 500 >> >> Content-Type: text/xml; charset=3Dutf-8 >> >> Servlet-Engine: Enhydra Application Server/3.1.1b1 (JSP 1.1; >> >> Servlet 2.2; Java 1.5.0_11; Linux 2.4.7-10smp i386; >> >> java.vendor=3DSun Microsystems Inc.) >> >> Content-Length: 559 >> >> Set-Cookie: JSESSIONID=3D-P8MszckjIq1_heih7cj8G6D;Path=3D/soap >> >> X-Cache: MISS from www.xmethods.net >> >> Connection: close >> >> >> >> <?xml version=3D'1.0' encoding=3D'UTF-8'?> >> >> <SOAP-ENV:Envelope xmlns:SOAP-ENV=3D"http://schemas.xmlsoap.org/=20= >> soap/ >> >> envelope/" xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" >> >> xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema"> >> >> <SOAP-ENV:Body> >> >> <SOAP-ENV:Fault> >> >> <faultcode>SOAP-ENV:Client</faultcode> >> >> <faultstring>No Deserializer found to deserialize a >> >> ':zipcode' using encoding style 'http:// >> >> schemas.xmlsoap.org/soap/encoding/'.</faultstring> >> >> <faultactor>/soap/servlet/rpcrouter</faultactor> >> >> </SOAP-ENV:Fault> >> >> >> >> </SOAP-ENV:Body> >> >> </SOAP-ENV:Envelope> >> >> >> >> _________________________________ Fri May 4 07:48:03 2007 =20 >> REQUEST: >> >> <SOAP-ENV:Envelope xmlns:SOAP-ENC=3D"http://schemas.xmlsoap.org/=20= >> soap/ >> >> encoding/" xmlns:SOAP-ENV=3D"http://schemas.xmlsoap.org/soap/ >> >> envelope/" xmlns:ZSI=3D"http://www.zolera.com/schemas/ZSI/" >> >> xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema" xmlns:xsi=3D"http:// >> >> www.w3.org/2001/XMLSchema-instance" SOAP-=20 >> ENV:encodingStyle=3D"http:// >> >> schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Header></SOAP- >> >> ENV:Header><SOAP-ENV:Body xmlns:ns1=3D"urn:xmethods- >> >> Temperature"><ns1:getTempRequest><zipcode>91020</zipcode></ >> >> ns1:getTempRequest></SOAP-ENV:Body></SOAP-ENV:Envelope> >> >> _________________________________ Fri May 4 07:48:03 2007 =20 >> RESPONSE: >> >> 500 >> >> Internal Server Error >> >> ------- >> >> Date: Fri, 04 May 2007 19:22:16 GMT >> >> Server: Enhydra-MultiServer/3.1.1b1 >> >> Status: 500 >> >> Content-Type: text/xml; charset=3Dutf-8 >> >> Servlet-Engine: Enhydra Application Server/3.1.1b1 (JSP 1.1; >> >> Servlet 2.2; Java 1.5.0_11; Linux 2.4.7-10smp i386; >> >> java.vendor=3DSun Microsystems Inc.) >> >> Content-Length: 559 >> >> Set-Cookie: JSESSIONID=3DwJMrUzZzJ77SPnvx7VRuY--y;Path=3D/soap >> >> X-Cache: MISS from www.xmethods.net >> >> Connection: close >> >> >> >> <?xml version=3D'1.0' encoding=3D'UTF-8'?> >> >> <SOAP-ENV:Envelope xmlns:SOAP-ENV=3D"http://schemas.xmlsoap.org/=20= >> soap/ >> >> envelope/" xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" >> >> xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema"> >> >> <SOAP-ENV:Body> >> >> <SOAP-ENV:Fault> >> >> <faultcode>SOAP-ENV:Client</faultcode> >> >> <faultstring>No Deserializer found to deserialize a >> >> ':zipcode' using encoding style 'http:// >> >> schemas.xmlsoap.org/soap/encoding/'.</faultstring> >> >> <faultactor>/soap/servlet/rpcrouter</faultactor> >> >> </SOAP-ENV:Fault> >> >> >> >> </SOAP-ENV:Body> >> >> </SOAP-ENV:Envelope> >> >> >> >> _________________________________ Fri May 4 07:51:41 2007 =20 >> REQUEST: >> >> <SOAP-ENV:Envelope xmlns:SOAP-ENC=3D"http://schemas.xmlsoap.org/=20= >> soap/ >> >> encoding/" xmlns:SOAP-ENV=3D"http://schemas.xmlsoap.org/soap/ >> >> envelope/" xmlns:ZSI=3D"http://www.zolera.com/schemas/ZSI/" >> >> xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema" xmlns:xsi=3D"http:// >> >> www.w3.org/2001/XMLSchema-instance" SOAP-=20 >> ENV:encodingStyle=3D"http:// >> >> schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Header></SOAP- >> >> ENV:Header><SOAP-ENV:Body xmlns:ns1=3D"urn:xmethods- >> >> Temperature"><ns1:getTemp><zipcode xsi:type=3D"xsd:string">91020</ >> >> zipcode></ns1:getTemp></SOAP-ENV:Body></SOAP-ENV:Envelope> >> >> _________________________________ Fri May 4 07:51:42 2007 =20 >> RESPONSE: >> >> 200 >> >> OK >> >> ------- >> >> Date: Fri, 04 May 2007 19:26:39 GMT >> >> Server: Enhydra-MultiServer/3.1.1b1 >> >> Status: 200 >> >> Content-Type: text/xml; charset=3Dutf-8 >> >> Servlet-Engine: Enhydra Application Server/3.1.1b1 (JSP 1.1; >> >> Servlet 2.2; Java 1.5.0_11; Linux 2.4.7-10smp i386; >> >> java.vendor=3DSun Microsystems Inc.) >> >> Content-Length: 467 >> >> Set-Cookie: JSESSIONID=3Dv4b2But3PCPBU5pyPUrgTQVA;Path=3D/soap >> >> X-Cache: MISS from www.xmethods.net >> >> >> >> <?xml version=3D'1.0' encoding=3D'UTF-8'?> >> >> <SOAP-ENV:Envelope xmlns:SOAP-ENV=3D"http://schemas.xmlsoap.org/=20= >> soap/ >> >> envelope/" xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" >> >> xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema"> >> >> <SOAP-ENV:Body> >> >> <ns1:getTempResponse xmlns:ns1=3D"urn:xmethods-Temperature" SOAP- >> >> ENV:encodingStyle=3D"http://schemas.xmlsoap.org/soap/encoding/"> >> >> <return xsi:type=3D"xsd:float">-999.0</return> >> >> </ns1:getTempResponse> >> >> >> >> </SOAP-ENV:Body> >> >> </SOAP-ENV:Envelope> >> >> >> >> >> >> >> >> >> >> >> >> Arye wrote: >> >> > Hello all, >> >> > >> >> > I had no success in calling the "getTemp" method of the >> >> > "http://www.xmethods.net/sd/2001/TemperatureService.wsdl" =20 >> service, >> >> > using ZSI. >> >> > >> >> > The call works fine with SOAPpy. >> >> > >> >> > I tried to compare the XML envelopes sent and it seems to me =20 >> that >> >> > the ZSI XML envelope is missing the "<?xml version=3D'1.0' >> >> > encoding=3D'UTF-8'?>" header >> >> > when compared to the envelope sent by SOAPpy. >> >> > >> >> > I tried all this with the latest versions of all modules and >> >> Python24 >> >> > as well as Python25. >> >> > Any help in getting the call to go through with ZSI would be >> >> greatly >> >> > appreciated. >> >> > Arye. >> >> > >> >> > >> >> =20 >> --------------------------------------------------------------------- >> >> ---- >> >> > This SF.net email is sponsored by DB2 Express >> >> > Download DB2 Express C - the FREE version of DB2 express and =20 >> take >> >> > control of your XML. No limits. Just data. Click to get it now. >> >> > http://sourceforge.net/powerbar/db2/ >> >> > _______________________________________________ >> >> > Pywebsvcs-talk mailing list >> >> > Pyw...@li... >> >> > https://lists.sourceforge.net/lists/listinfo/pywebsvcs-talk >> >> > Also archived at http://groups.google.com/group/pywebsvcs >> >> > >> >> >> |