pythonwsdlsoappy

What's wrong with my Python SOAPpy webservice call?


I am playing around trying to call a simple SOAP webservice using the following code in the Python interpreter:

from SOAPpy import WSDL
wsdl = "http://www.webservicex.net/whois.asmx?wsdl"
proxy = WSDL.Proxy(wsdl)
proxy.soapproxy.config.dumpSOAPOut=1
proxy.soapproxy.config.dumpSOAPIn=1
proxy.GetWhoIS(HostName="google.com")

(Yep, I'm new to Python, doing the diveintopython thing...)

The call to the GetWhoIS method fails - otherwise I wouldn't be asking here, I guess. Here's my outgoing SOAP:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
  SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/1999/XMLSchema">
  <SOAP-ENV:Body>
    <GetWhoIS SOAP-ENC:root="1">
      <HostName xsi:type="xsd:string">google.com</HostName>
    </GetWhoIS>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

And here's the incoming response.

<?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>
    <soap:Fault>
      <faultcode>soap:Server</faultcode>
      <faultstring>
           System.Web.Services.Protocols.SoapException:
           Server was unable to process request. ---&gt;
           System.ArgumentNullException: Value cannot be null.
         at whois.whois.GetWhoIS(String HostName)
         --- End of inner exception stack trace ---
      </faultstring>
      <detail />
    </soap:Fault>
  </soap:Body>
</soap:Envelope>

(manually formatted for easier reading)

Can anyone tell me what am I doing wrong?

Ideally both in terms of use of SOAPpy, and why the SOAP message is incorrect.

Thanks!


Solution

  • Your call seems all right to me, i think this could be a soappy problem or misconfigured server (although i have not checked this thoroughly).

    This document also suggests incompatibilities between soappy and webservicex.net: http://users.jyu.fi/~mweber/teaching/ITKS545/exercises/ex5.pdf

    How i would work around this in this specific case?

    import urllib
    
    url_handle = urllib.urlopen( "http://www.webservicex.net/whois.asmx/GetWhoIS?HostName=%s" \
                                 % ("www.google.com") )
    print url_handle.read()