tags:

views:

58

answers:

1

I'm having trouble getting suds to consume complex (.net) webservice.

a. The generated suds soap message looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0="http://schemas.cordys.com/Ucf/Organization/GlobalDomain/1.0" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns2="http://schemas.cordys.com/Ucf/Organization/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt;
   <SOAP-ENV:Header/>
   <ns1:Body>
      .....
   </ns1:Body>
</SOAP-ENV:Envelope>

which for some reason the end server does not like with 400 bad request error. If i change Body prefix to SOAP-ENV, the request is accepted. How do I change suds behavior here to use single prefix for http://schemas.xmlsoap.org/soap/envelope/ namespace?

b. for one of my complex element (AddOrganizationDoc printed below), corresponding xml soap elements are correctly generated, however the root tag has the wrong prefix. child tags are correctly generated. my question is there a way to manipulate element prefix for final soap message?

Suds ( https://fedorahosted.org/suds/ )  version: 0.3.9 GA  build: R659-20100219  

Service ( Method Set Organization - Global DomainService ) tns="http://schemas.cordys.com/Ucf/Organization/GlobalDomain/1.0"  
   Prefixes (3)  
      ns0 = "http://schemas.cordys.com/General/1.0/"  
      ns1 = "http://schemas.cordys.com/Ucf/Organization/1.0"  
      ns2 = "http://schemas.cordys.com/Ucf/Organization/GlobalDomain/1.0"  
   Ports (1):  
      (Method Set Organization - Global Domain)  
         Methods (1):  
            AddOrganization(AddOrganization AddOrganization, )  
         Types (169):  
            ns1:AddOrganizationDocModel  
            ...  

(AddOrganization){  
   AddOrganization =   
      (AddOrganization){  
         AddOrganizationDoc =   
            (AddOrganizationDocModel){  
               NewOrganizationDoc =   
                  (NewOrganizationDoc_OrganizationService.Doc){  
                  ....  

message:

<SOAP-ENV:Envelope xmlns:ns0="http://schemas.cordys.com/Ucf/Organization/GlobalDomain/1.0" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns2="http://schemas.cordys.com/Ucf/Organization/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt;  
   <SOAP-ENV:Header/>  
   <ns1:Body>  
      <ns0:AddOrganization>  
         <ns0:AddOrganization>  
            <ns0:AddOrganization>  
               <ns0:AddOrganizationDoc>  
                  <ns2:NewOrganizationDoc>  
                     <ns2:OrganizationName>django</ns2:OrganizationName>  
                     <ns2:OrganizationFullName>django cordys</ns2:OrganizationFullName>  

<ns0:AddOrganizationDoc> should have ns2 prefix instead!

Tried using client.add_prefix('nsx', 'http://namespace') but that did not make any difference. Any ideas will be appreciated.

A: 

I posted an example of calling an Cordys (SDF) API from Python on https://wiki.cordys.com/x/DgGwCg.

(It's free to register at the Cordys Wiki)

Good luck!

Marco van de Veen - Cordys