0

I'm using Python 2.7 on Ubuntu 13.04. I need to hit a SOAP API and have run into a problem when trying to hit one of the services. Here is the wsdl url: http://www.educationconnection.com/ecsleadapi/version4_1/service.svc?wsdl

If I type the following into iPython everything is fine:

from suds.client import Client
client = Client('<wsdl_url>')
kwargs = {'UserName': '<my_username>', 'Password': '<my_password>', 'SchoolID': 29, 'CampusID': 156}
client.service.GetCampus(**kwargs)

Output is as expected.

If I have the exact same code in a script I get the following error:

  File "/home/ricomoss/.virtualenvs/scripts/local/lib/python2.7/site-packages/suds/client.py", line 542, in __call__
    return client.invoke(args, kwargs)
  File "/home/ricomoss/.virtualenvs/scripts/local/lib/python2.7/site-packages/suds/client.py", line 602, in invoke
    result = self.send(soapenv)
  File "/home/ricomoss/.virtualenvs/scripts/local/lib/python2.7/site-packages/suds/client.py", line 649, in send
    result = self.failed(binding, e)
  File "/home/ricomoss/.virtualenvs/scripts/local/lib/python2.7/site-packages/suds/client.py", line 702, in failed
    r, p = binding.get_fault(reply)
  File "/home/ricomoss/.virtualenvs/scripts/local/lib/python2.7/site-packages/suds/bindings/binding.py", line 265, in get_fault
    raise WebFault(p, faultroot)
suds.WebFault: Server raised fault: 'The server was unable to process the request due to an internal error.  For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.'

I have also used soapUI to verify the service call. Everything works except in my script. Any ideas?

To provide a bit more code...this is the wrapper I've written for the service calls.

def __init__(self, **kwargs):
    self.wsdl = kwargs.get('wsdl', self.DEFAULT_WSDL)
    self.username = kwargs.get('username', self.ED_USERNAME)
    self.password = kwargs.get('password', self.ED_PASSWORD)
    self.client = Client(self.wsdl)

def get_schools(self):
    return self.client.service.GetSchools(
        UserName=self.username, Password=self.password)

def get_campus(self, school_id, campus_id):
    return self.client.service.GetCampus(
        SchoolId=school_id, CampusID=campus_id,
        UserName=self.username, Password=self.password)

def get_program(self, school_id, campus_id, program_id):
    return self.client.service.GetProgram(
        UserName=self.username, Password=self.password,
        CampusID=campus_id, ProgramID=program_id, SchoolID=school_id)
Rico
  • 5,692
  • 8
  • 46
  • 63

1 Answers1

0

As Thomas Fenzl pointed out:

The script had a typo in the GetCampus keyword args. (ShoolId -> SchoolID)

Rico
  • 5,692
  • 8
  • 46
  • 63