4

I have been trying to write a client to access a web service for work. I have successfully written clients using SUDS and ZSI with Python. I have used NetBeans 6.9 to assist in writing a few Java clients. The successful clients have all been accessing freely available web services I have found on the internet.

The client I need to connect to for work is not proving to be so friendly. It does require authentication:

http://www.cmicdataservices.com/datacenter/service.asmx

If I grab the WSDL descriptions of this web service I see there are six methods.

Methods (6):
    CheckIfAuthorized()
    DataProcessed()
    GetCurrentDataVer1()
    GetID()
    LogDSCStatus(xs:string _clientname, xs:string _status, xs:string _errormsg)
    ResetNewDataReferences()

There are 70 types returned as well. One of them being an Authentication type.

In my Python and Java clients I have been able to create these Authentication objects but have not been able to do anything further.

From the WSDL there is no indication to me that there is any way to create these authentication objects with what is available. The supplier of the web service does offer a client built using Adobe Air and I can test with that to ensure that I can authenticate to the webservice and consume it.

This is the first time I have had to interface with a web service and I am not sure if there is anything I am missing here. Can anyone tell me if there is something obvious that I am missing here as to how to authenticate with this service?

Here is the the Python client I wrote plus it's output. You can see a nice printout of the WSDL info if you uncomment the print client line.

#!/usr/bin/python

from suds.client import Client

url='http://www.cmicdataservices.com/datacenter/service.asmx?wsdl'
client = Client(url)


#print client
print client.service.CheckIfAuthorized()

The output:

Traceback (most recent call last):
  File "CMICTest.py", line 23, in <module>
    print client.service.CheckIfAuthorized()
  File "/usr/local/lib/python2.6/dist-packages/suds-0.4-py2.6.egg  /suds/client.py",      line 542, in __call__
 return client.invoke(args, kwargs)
  File "/usr/local/lib/python2.6/dist-packages/suds-0.4-py2.6.egg/suds/client.py",  line 602, in invoke
  result = self.send(soapenv)
  File "/usr/local/lib/python2.6/dist-packages/suds-0.4-py2.6.egg/suds/client.py",  line 649, in send
  result = self.failed(binding, e)
  File "/usr/local/lib/python2.6/dist-packages/suds-0.4-py2.6.egg/suds/client.py",  line 702, in failed
  r, p = binding.get_fault(reply)
 File "/usr/local/lib/python2.6/dist-packages/suds-0.4-py2.6.egg/suds/bindings /binding.py", line 265, in get_fault
raise WebFault(p, faultroot)
suds.WebFault: Server raised fault: 'Server was unable to process request. ---> Object reference not set to an instance of an object.'
bluish
  • 26,356
  • 27
  • 122
  • 180
grantk
  • 3,958
  • 4
  • 28
  • 37

2 Answers2

0

try to use wireshark (or just debugging) to capture the full request and response for the working Adobe Air Client. Then capture the request/response of the client that you generated. compare the two requests and determine which objects that you are not creating and adding to your client.

sankyo
  • 23
  • 3
  • The request I am sending is missing the actual authentication paramaters, etc. There is no method to generate these. I am trying to avoid writing the xml requests by hand and then sending them has a simple http request. – grantk Apr 04 '11 at 19:39
  • try to study this example. http://svn.fedorahosted.org/svn/suds/trunk/tests/rhq.py. Notice how the example creates objects and then puts them into the person object, then calls the service with that person. – sankyo Apr 05 '11 at 17:01
  • Thanks again, I see how the person objects are used. I can create the objects listed in my service as well. The problem is there is no actual method to create any of those objects on the server side, nor any methods that accept them as arguments. I ended up building the request by hand and sending it, now I am able to receive a response(I did use Java though) – grantk Apr 06 '11 at 14:56
0

The problem with your code is not generating of Authentication header for your CheckIfAuthorized call as it is required according to WSDL. Take a look at my answer to your other question that contains sample SOAP client created with suds that adds required header element to the request:

soap ui generated code

Community
  • 1
  • 1
Artem Zankovich
  • 2,319
  • 20
  • 36