Hello,
Hoping for some help from the list - I am new to suds and SOAP in general.
The support team for the .NET service i am trying to access has told me that since i can successfully access their service using soapui, then the error I am having trying to access it with suds is on me to figure out.
The message sent to the service that works from soapui looks like:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ser="http://www.somedomain.com/Remote/services%22%3E soap:Header ser:AuthenticationSoapHeader <!--Optional:--> ser:Usernamemyusername</ser:Username> <!--Optional:--> ser:Passwordmypassword</ser:Password> </ser:AuthenticationSoapHeader> </soap:Header> soap:Body ser:GetMyProfiles ser:clientGuidmy-unique-guid</ser:clientGuid> </ser:GetMyProfiles> </soap:Body> </soap:Envelope>
I am setting up authentication correctly, I think:
wsdl='https://www.somedomain.com/Remote/services.asmx?WSDL' user = 'myusername' pass = 'mypassword' guid = 'my-unique-guid' # unique client ID code
client = Client(wsdl,username=user,password=pass)
printing client shows the one method that is exposed, as expected:
Suds ( https://fedorahosted.org/suds/ ) version: 0.4 GA build: R699-20100913
Service ( ContentService ) tns="http://www.somedomain.com/Remote/services" Prefixes (2) ns0 = "http://microsoft.com/wsdl/types/" ns1 = "http://www.somedomain.com/Remote/services" Ports (2): (ContentServiceSoap) Methods (1): GetMyProfiles(ns0:guid clientGuid, ) Types (2): MyStuff ns0:guid (ContentServiceSoap12) Methods (1): GetMyProfiles(ns0:guid clientGuid, ) Types (2): MyStuff ns0:guid
When I try and access that method though:
result = client.service.GetMyProfiles(guid)
I get an error.
(MyProfileResult){ MyStuff = "" ErrorReturned = True ErrorMessage = "Error processing profile0: Object reference not set to an instance of an object.:System.NullReferenceException: Object reference not set to an instance of an object. at <path to coode>:line 71" }
When I turn on debugging, I see that the message does not have the Authentication credentials in the header like the request that does work in soapui:
DEBUG:suds.client:sending to (https://webservices.somedomain.com/Remote/ContentService.asmx) message: <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.somedomain.com/Remote/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/%22%3E SOAP-ENV:Header/ ns0:Body ns1:GetMyProfiles ns1:clientGuidmy-unique-guid</ns1:clientGuid> </ns1:GetMyProfiles> </ns0:Body> </SOAP-ENV:Envelope> DEBUG:suds.client:headers = {'SOAPAction': u'"http://www.somedomain.com/Remote/services/GetMyProfiles"', 'Content-Type': 'text/xml; charset=utf-8'} DEBUG:suds.transport.http:sending:
The guid is working - if I mistype it I get an guid error. I am thinking maybe the auth mechanisms do not match u in some way... Any advice greatly appreciated.