I am trying to use SOAPy to access a temperature conversion Web service, for example to do a FahrenheitToCelcius temperature conversion.
The WSDL file of the webservice defines the input message of the FahrenheitToCelcius operation as:-
<input message="tns:FahrenheitToCelciusSoapRequest"/>
with the FahrenheitToCelciusSoapRequest message defined as:-
<message name="FahrenheitToCelciusSoapRequest">
<part name="parameters" element="tns:FahrenheitToCelcius"/>
</message>
The data element here, FahrenheitToCelcius, is defined as a complexType in the WSDL definition as:-
<xs:element name="CelciusToFahrenheit">
<xs:complexType>
<xs:sequence>
<xs:element name="nCelcius" type="xs:decimal"/>
</xs:sequence>
</xs:complexType>
</xs:element>
I am having a problem in how I pass the decimal value into the function call to the FahrenheitToCelcius operation / function. The code below generates an error message. How do I pass the FarenheitRequest parameter into the function? I have included the full WSDL file listing below.
Code
from SOAPpy import WSDL
import warnings warnings.simplefilter('ignore', DeprecationWarning)
wsdl_url = 'http://webservices.daehosting.com/services/TemperatureConversions.wso?wsdl' server = WSDL.Proxy(wsdl_url) print server.methods.keys()
callInfo = server.methods['FahrenheitToCelcius']
print callInfo.inparams[0].name print callInfo.inparams[0].type
result = server.FahrenheitToCelcius(12)
Output
[u'FahrenheitToCelcius', u'WindChillInCelcius', u'CelciusToFahrenheit', u'WindChillInFahrenheit'] parameters (u'http://webservices.daehosting.com/temperature', u'FahrenheitToCelcius') Traceback (most recent call last): File "H:\My Python\Examples\SOAPy\DIP SOAP Server\temp_soap_client.py", line 15, in result = server.FahrenheitToCelcius('FahrenheitToCelciusSoapResponse',12) File "C:\Python26\lib\site-packages\SOAPpy\Client.py", line 470, in call return self.__r_call(*args, **kw) File "C:\Python26\lib\site-packages\SOAPpy\Client.py", line 492, in __r_call self._hd, self._ma) File "C:\Python26\lib\site-packages\SOAPpy\Client.py", line 363, in __call config = self.config) File "C:\Python26\lib\site-packages\SOAPpy\Client.py", line 252, in call raise HTTPError(code, msg) SOAPpy.Errors.HTTPError:
WSDL File
http://webservices.daehosting.com/services/TemperatureConversions.wso?wsdl