From: <sou...@dc...> - 2004-08-30 14:56:52
|
I'm trying to interact with a customer's SOAP implementation (which I can't change). I'm using the ZSI SOAP implementation ... and have had success firing up a SOAP service on my own laptop (real men run -CURRENT). I've had some solvable problems. The customer's SOAP implementation insists that SOAP-Action be namespace#method rather than the URL as is default for ZSI. So far, I 've gotten to this code snippet (URL changed to protect the guilty): from ZSI.client import Binding from ZSI import TC logfile = open('/usr/home/dgilbert/devel/SoftGrabber/packetlog', 'w') con = Binding(url = '/scripts/soap/Grabber.pl', tracefile = logfile, ns = 'Grabber', host = 'www.notforyou.com') result = con.RPC(None, 'bye', (), TC.Any(), soapaction="Grabber#bye") print type(result) print result With the customer's SOAP server, I get the following: [3:7:307]dgilbert@canoe:~/devel/SoftGrabber> ./SoftGrabber.py Traceback (most recent call last): File "./SoftGrabber.py", line 16, in ? result = con.RPC(None, 'bye', (), TC.Any(), soapaction="Grabber#bye") File "/usr/local/lib/python2.3/site-packages/ZSI/client.py", line 125, in RPC return self.Receive(replytype, **kw) File "/usr/local/lib/python2.3/site-packages/ZSI/client.py", line 249, in Receive self.ReceiveSOAP(**kw) File "/usr/local/lib/python2.3/site-packages/ZSI/client.py", line 221, in ReceiveSOAP raise TypeError( TypeError: Response is "text/plain", not "text/xml" As you see above, I asked for a logfile: [3:9:309]dgilbert@canoe:~/devel/SoftGrabber> less packetlog _________________________________ Mon Aug 30 10:24:42 2004 REQUEST: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ZSI="http://www.zolera.com/schemas/ZSI/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns="Grabber" > <SOAP-ENV:Body> <bye> </bye> </SOAP-ENV:Body> </SOAP-ENV:Envelope> _________________________________ Mon Aug 30 10:24:42 2004 RESPONSE: Server: Microsoft-IIS/5.0 Date: Mon, 30 Aug 2004 14:28:49 GMT Connection: close Content-Length: 511 Content-Type: text/xml; charset=utf-8 SOAPServer: SOAP::Lite/Perl/0.55 <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENC="http:// schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlso ap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/ " xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3 .org/1999/XMLSchema"><SOAP-ENV:Body><namesp1:byeResponse xmlns:namesp1="Grabber" ><s-gensym3 xsi:type="xsd:string">GOODBYE</s-gensym3></namesp1:byeResponse></SOA P-ENV:Body></SOAP-ENV:Envelope> Now, from that dump, you might immediately say that the problem is that the client's server (my ... that's unnecessarily confusing) is spitting out an extra carriage return in the headers ... between "Content: close" and "Contect-Length: 511" This is not the case. For this, I turn to ethereal. The following is a TCP recontstruction with both send and receive streams merged into one time ordered stream. I will add '>' for lines from the client and '<' for lines from the server: >POST /scripts/soap/Grabber.pl HTTP/1.1 >Host: www.qualitytrack.com >Accept-Encoding: identity >Content-length: 451 >Content-type: text/xml; charset=utf-8 >SOAPAction: Grabber#bye > > <HTTP/1.1 100 Continue <Server: Microsoft-IIS/5.0 <Date: Mon, 30 Aug 2004 14:28:49 GMT < < ><SOAP-ENV:Envelope > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" > xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > xmlns:ZSI="http://www.zolera.com/schemas/ZSI/" > SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" > xmlns="Grabber" > ><SOAP-ENV:Body> ><bye> ></bye> ></SOAP-ENV:Body> ></SOAP-ENV:Envelope> > <HTTP/1.1 200 OK <Server: Microsoft-IIS/5.0 <Date: Mon, 30 Aug 2004 14:28:49 GMT <Connection: close <HTTP/1.1 200 OK <Content-Length: 511 <Content-Type: text/xml; charset=utf-8 <SOAPServer: SOAP::Lite/Perl/0.55 < < <<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema"><SOAP-ENV:Body><namesp1:byeResponse xmlns:namesp1="Grabber"><s-gensym3 xsi:type="xsd:string">GOODBYE</s-gensym3></namesp1:byeResponse></SOAP-ENV:Body></SOAP-ENV:Envelope> < Interesting. Note that there are two HTTP/1.1 responses. The first has no content-type ... is this why the error is that the content-type is text/plain? The second is actually the response. Is there something about ZSI's interface the the http library that can't handle this? Is this technically wrong? Help? Dave. |