[python-win32] Accessing a dictionary like object using WebServices from Win32
Gary Hubbard
hubbardsoftware at sbcglobal.net
Mon Nov 22 23:40:53 CET 2010
Hi
I am trying to communicate with a vendor's WebService, using PyWin32. I am
successful using most of the methods, but I don't know how to interpret those
returning a dictionary like object.
Obfuscating the vendor name with XXX everywhere, to avoid checking on whether it
is acceptable to communicate about this, the code looks like
sc = win32com.client.Dispatch("MSSOAP.SoapClient")
sc.mssoapinit("http://localhost:1024/wsdl/IXXXWebService")
sc.connect()
ret = sc.ReadMeasureDataParam(paramName)
Under C# or VB, ret would be a dictionary like object with 6 different keys,
such as LongName and ShortName, accessed as ret.LongName, etc. Using that under
PyWin32 gives an attribute error, but I can index with the [0] to [5].
Unfortunately, doing that still returns an object I don't know how to interpret.
There are several other functions that have the same issue, but I think the
basic problem is identical.
The relevant XML code follows. I manually chopped the code apart, eliminating
what I though was unnecessary.
Thanks,
XML Code follows:
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:xs="http://www.w3.org/2001/XMLSchema" name="IXXXWebServiceservice"
targetNamespace="http://tempuri.org/" xmlns:tns="http://tempuri.org/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:ns1="urn:XXXWebServiceIntf">
<types>
<xs:schema targetNamespace="urn:XXXWebServiceIntf"
xmlns="urn:XXXWebServiceIntf">
<xs:complexType name="TXXXMeasureParam">
<xs:sequence>
<xs:element name="ShortName" type="xs:string"/>
<xs:element name="LongName" type="xs:string"/>
<xs:element name="Factor" type="xs:double"/>
<xs:element name="Offset" type="xs:double"/>
<xs:element name="ValueUnit" type="xs:string"/>
<xs:element name="Precision" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</types>
<message name="ReadMeasureDataParam11Request">
<part name="signal" type="xs:string"/>
</message>
<message name="ReadMeasureDataParam11Response">
<part name="return" type="ns1:TXXXMeasureParam"/>
</message>
<portType name="IXXXWebService">
<operation name="ReadMeasureDataParam">
<input message="tns:ReadMeasureDataParam11Request"/>
<output message="tns:ReadMeasureDataParam11Response"/>
</operation>
</portType>
<binding name="IXXXWebServicebinding" type="tns:IXXXWebService">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="ReadMeasureDataParam">
<soap:operation
soapAction="urn:XXXWebServiceIntf-IXXXWebService#ReadMeasureDataParam"
style="rpc"/>
<input message="tns:ReadMeasureDataParam11Request">
<soap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:XXXWebServiceIntf-IXXXWebService"/>
</input>
<output message="tns:ReadMeasureDataParam11Response">
<soap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:XXXWebServiceIntf-IXXXWebService"/>
</output>
</operation>
</binding>
<service name="IXXXWebServiceservice">
<port name="IXXXWebServicePort" binding="tns:IXXXWebServicebinding">
<soap:address location="http://172.31.234.44:1024/soap/IXXXWebService"/>
</port>
</service>
</definitions>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20101122/adfd6a86/attachment.html>
More information about the python-win32
mailing list