simple SOAP method doesn't work,


G

Grzegorz Smith

Hi All. I 'm learning ZSI to use SOAP and I desperately need help. I'm
working on example from tutorial -> (examples/server/send_response/
simple/wsdl/).
Here are my wsdl files -> http://pastebin.com/873488.
I made wsdl2py wsdl2py --complexType --file=binding.wsdl and get
Example_services.py and Example_Services_types.py.
Here is the Example_services.py -> http://pastebin.com/873492
and Example_Services_types.py -> http://pastebin.com/873494
Now I use cgi script for getting request/ sending response.
Script is runned by apache2.0.
It looks like this:
#!c:\opt\python24\python
from Example_services import EchoResponse
def echo(message):
response = EchoResponse()
response._Message = message
return response

from ZSI import dispatch
dispatch.AsCGI()

Now i write 2 scripts to test my Soap webservices. First is write just
like in guide.html
from Example_services import *
loc = ExampleServiceLocator()
port = loc.getExample()
req = EchoRequest()
req._Message='test'

resp = port.echo(req)
print resp

and I get:
Traceback (most recent call last):
File "test.py", line 9, in ?
resp = port.echo(req)
File "I:\Prace\PRYWATNE\test\Example_services.py", line 41, in echo
response = self.binding.Receive(typecode)
File "I:\Prace\PRYWATNE\test\client.py", line 497, in Receive

File "I:\Prace\PRYWATNE\test\client.py", line 397, in ReceiveSOAP

File "C:\opt\Python24\lib\site-packages\zsi-2.0_rc3-py2.4.egg\ZSI
\parse.py", line 59, in __init__
File "c:\opt\python24\lib\site-packages\PyXML-0.8.4-py2.4-win32.egg
\_xmlplus\dom\ext\reader\__init__.py", line 60, in
fromString
return self.fromStream(stream, ownerDoc)
File "c:\opt\python24\lib\site-packages\PyXML-0.8.4-py2.4-win32.egg
\_xmlplus\dom\ext\reader\PyExpat.py", line 65, in f
romStream
success = self.parser.ParseFile(stream)
xml.parsers.expat.ExpatError: unclosed token: line 12, column 152

Second looks like this:
import sys
from ZSI.client import Binding
b = Binding(url='http://127.0.0.1/cgi-bin/cgi.py',
tracefile=sys.stdout)
print b.echo('test')
and i get:
_________________________________ Fri Feb 02 13:05:06 2007 REQUEST:
<SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/
encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org
/soap/envelope/" xmlns:ZSI="http://www.zolera.com/schemas/ZSI/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" SOAP-
ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-
ENV:
Header></SOAP-ENV:Header><SOAP-ENV:Body><echo SOAP-
ENC:arrayType="xsd:anyType[1]" xsi:type="SOAP-ENC:Array"><element id=
"oad1c20" xsi:type="xsd:string">test</element></echo></SOAP-ENV:Body></
SOAP-ENV:Envelope>
_________________________________ Fri Feb 02 13:05:07 2007 RESPONSE:
200
OK
-------
Date: Fri, 02 Feb 2007 12:05:06 GMT
Server: Apache/2.0.59 (Win32) DAV/2 PHP/5.1.6 mod_python/3.2.10 Python/
2.4.3 SVN/1.4.2
Content-Length: 453
Content-Type: text/xml; charset="utf-8"

<SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/
encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org
/soap/envelope/" xmlns:ZSI="http://www.zolera.com/schemas/ZSI/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Header></SOAP-ENV:Header><SOAP-ENV:Body
xmlns:ns1="urn:Example"><ns
1:echoResponse><Message>test</Message></ns1:echoResponse></SOAP-
ENV:Body></SOAP-ENV:Envelope>
Traceback (most recent call last):
File "testSoap.py", line 12, in ?
zPalca()
File "testSoap.py", line 7, in zPalca
print b.echo('test')
File "I:\Prace\PRYWATNE\test\client.py", line 42, in __call__

File "I:\Prace\PRYWATNE\test\client.py", line 171, in RPC

File "I:\Prace\PRYWATNE\test\client.py", line 502, in Receive

File "I:\Prace\PRYWATNE\test\client.py", line 436, in Receive

File "C:\opt\Python24\lib\site-packages\zsi-2.0_rc3-py2.4.egg\ZSI
\parse.py", line 323, in Parse
File "C:\opt\Python24\lib\site-packages\zsi-2.0_rc3-py2.4.egg\ZSI
\TC.py", line 573, in parse
File "C:\opt\Python24\lib\site-packages\zsi-2.0_rc3-py2.4.egg\ZSI
\TC.py", line 542, in parse_into_dict_or_list
File "C:\opt\Python24\lib\site-packages\zsi-2.0_rc3-py2.4.egg\ZSI
\TC.py", line 572, in parse
ZSI.EvaluateException: Any cannot parse untyped element
[Element trace: /SOAP-ENV:Envelope/SOAP-ENV:Body/ns1:echoResponse/
Message]

Can anyone tell me what I'm doing wrong?
I read guide and think do everything in right way, but it's not
working
Thanks for any help I really ned this
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top