SOAP using ZSI talking to .NET Web Service

Russell Russell.Every at MentumGroup.com
Tue Aug 19 06:53:17 CEST 2003


Using Python 2.3 and ZSI 1.2 I am having problems getting information
back from a test web service running on a PC on our LAN.

The SOAP request details (from the .asmxfile) are as follows:

POST /rjetest/rjetestservice.asmx HTTP/1.1
Host: grouse
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://RJE.com/RJETestItDoc"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <RJETestItDoc xmlns="http://RJE.com">
      <i>int</i>
      <extra>string</extra>
    </RJETestItDoc>
  </soap:Body>
</soap:Envelope>

and the response details (from the .asmx) are:

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <RJETestItDocResponse xmlns="http://RJE.com">
      <RJETestItDocResult>string</RJETestItDocResult>
    </RJETestItDocResponse>
  </soap:Body>
</soap:Envelope>


The Python program is:

import sys
from ZSI.client import Binding, TC

class fooRequest:
	def __init__(self, i, extra):
		self.i = i
		self.extra = extra

fooRequest.typecode = TC.Struct(fooRequest, [TC.Integer('i'),
TC.String('extra')], 'RJETestItDoc')


url1 = 'http://grouse/rjetest/rjetestservice.asmx'
soapaction ='http://RJE.com/RJETestItDoc'
namespace = 'http://RJE.com'

host = 'grouse'
port = 80

dict = {
		'soap' :	'http://schemas.xmlsoap.org/wsdl/soap/',
		's' :		'http://www.w3.org/2001/XMLSchema',
		's0' : 		'http://RJE.com',
		'http' :	'http://schemas.xmlsoap.org/wsdl/http/',
		'tm' :		'http://microsoft.com/wsdl/mime/textMatching/',
		'mime' :	'http://schemas.xmlsoap.org/wsdl/mime/',
		'soapenc' :	'http://schemas.xmlsoap.org/soap/encoding/'
		}
i = 10
extra = 'A lovely day at the office'

b = Binding(url=url1, ns=namespace, host=host, port=port, nsdict=dict,
soapaction=soapaction, tracefile=sys.stdout)
b.Send(url1, 'RJETestItDoc', fooRequest(i, extra))
x = b.ReceiveSOAP()


The SOAP response via the Python program is:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><RJETestItDocResponse
xmlns="http://RJE.com">
<RJETestItDocResult>********** A lovely day at the office
**********</RJETestItDocResult>
</RJETestItDocResponse></soap:Body></soap:Envelope>

and looks fine (to me anyway).

However...  I can't figure out how to get the text from response.  Any
advice would be very much appreciated.  The input values are being
correctly received by the web service.




More information about the Python-list mailing list