We are currently experiencing an issue with python Suds plugin, where the wsdl from a webservice is not being correctly interpreted to construct the XML request submission. The WSDL and expected XML are simple enough.
We are running python 2.7, suds 0.4 on Centos kernel 2.6.18-194.11.1.el5
The issue seems to be that we have a xsd:sequence which defines a xsd:choice of 2 elements then a single xsd:element. This sequence tag seems to create an additional parent element around its child elements, so the XML result is not valid according to the WSDL.
The XML output we get is:
ns0:ProcessOrdersRequest ns0:profileNote0 <!-- UNDEFINED IN WSDL --> ns0:MarkOrdersPacked ns0:carrierDetails ns0:orderId100</ns0:orderId> ns0:carrierCarrier1</ns0:carrier> ns0:conNote123456</ns0:conNote> </ns0:carrierDetails> </ns0:MarkOrdersPacked> ns0:profileNote0 ns0:noteNevada Ship Verification process</ns0:note> ns0:noteTypeInternal</ns0:noteType> </ns0:profileNote0> </ns0:profileNote0> <!-- UNDEFINED IN WSDL --> </ns0:ProcessOrdersRequest>
This is not consistent with the object output from the client factory:
(ProcessOrdersRequest){ MarkOrdersPacked = (MarkOrdersPacked){ carrierDetails[] = (CarrierDetails){ orderId = "100" carrier = "Carrier1" conNote = "123456" }, } profileNote0 = (ProfileNoteInputType0){ note = "Nevada Ship Verification process" noteType = "Internal" } }
The WSDL request element is defined as:
<xsd:element name="ProcessOrdersRequest"> xsd:complexType xsd:sequence xsd:choice <!-- Mark Orders Packed --> <xsd:element maxOccurs="1" minOccurs="1" name="MarkOrdersPacked" type="tns:MarkOrdersPacked"/> <!-- AnotherRequest --> <xsd:element maxOccurs="1" minOccurs="1" name="AnotherRequest" type="tns:AnotherRequest"/> </xsd:choice> <xsd:element maxOccurs="1" minOccurs="0" name="profileNote0" type="tns:ProfileNoteInputType0"/> </xsd:sequence> </xsd:complexType> </xsd:element>
Therefore we expect the XML to be:
ns0:ProcessOrdersRequest ns0:MarkOrdersPacked ns0:carrierDetails ns0:orderId100</ns0:orderId> ns0:carrierCarrier1</ns0:carrier> ns0:conNote123456</ns0:conNote> </ns0:carrierDetails> </ns0:MarkOrdersPacked> ns0:profileNote ns0:noteNevada Ship Verification process</ns0:note> ns0:noteTypeInternal</ns0:noteType> </ns0:profileNote> </ns0:ProcessOrdersRequest> </ns1:Body> </SOAP-ENV:Envelope>
We have tested the wsdl against SoapUI from eviware.com as well as created a java client using jaxb which both interpret the wsdl and create an XMLrequest exactly as expected so I dont expect that there is an issue with the wsdl definition at all.
Attached is the complete wsdl, XML output and python app.
Any help appreciated.
Cheers, David
Hallo David,
I am a suds newby who struggled with a similar problem and solved it with help from somebody on another mailing list.
On Thu, Nov 25, 2010 at 04:23:28AM +0200, David Hobley wrote:
cDSeq = [] cDSeq.append(createCarrierDetails(client, '100', '123456', '2010-10-22', 'Carrier1', 'N')) mop.carrierDetails = cDSeq
I would try:
mop.carrierDetails = {'orderId': 100, 'carrier': Carrier1, 'conNote: '123456'}
Regards Johann
On Thu, Nov 25, 2010 at 08:47:32AM +0200, Johann Spies wrote:
mop.carrierDetails = {'orderId': 100, 'carrier': Carrier1, 'conNote: '123456'}
Correction: mop.carrierDetails = {'orderId': 100, 'carrier': Carrier1, 'conNote' : '123456'}
Regards Johann
Johann,
thanks for the pointer; I changed the code as per the attached script. But still see the same problem in the XML:
ns0:ProcessOrdersRequest ns0:profileNote0 <!-- UNDEFINED IN WSDL --> ns0:MarkOrdersPacked ns0:carrierDetails ns0:orderId100</ns0:orderId> ns0:carrierCarrier1</ns0:carrier> ns0:conNote123456</ns0:conNote> </ns0:carrierDetails> </ns0:MarkOrdersPacked> ns0:profileNote0 ns0:noteNevada Ship Verification process</ns0:note> ns0:noteTypeInternal</ns0:noteType> </ns0:profileNote0> </ns0:profileNote0> <!-- UNDEFINED IN WSDL --> </ns0:ProcessOrdersRequest> </ns1:Body>
From: "Johann Spies" jspies@sun.ac.za To: suds@lists.fedoraproject.org Sent: Thursday, 25 November, 2010 5:06:09 PM Subject: Re: [Fedora-suds-list] Suds not interpreting WSDL correctly?
On Thu, Nov 25, 2010 at 08:47:32AM +0200, Johann Spies wrote:
mop.carrierDetails = {'orderId': 100, 'carrier': Carrier1, 'conNote: '123456'}
Correction: mop.carrierDetails = {'orderId': 100, 'carrier': Carrier1, 'conNote' : '123456'}
Regards Johann
Does anyone have any ideas what the problem could be here? We are totally stumped and any help would be gratefully received.
Cheers, David
From: "David Hobley" david.hobley@mionegroup.com To: suds@lists.fedoraproject.org Sent: Friday, 26 November, 2010 11:26:16 AM Subject: Re: [Fedora-suds-list] Suds not interpreting WSDL correctly?
Johann,
thanks for the pointer; I changed the code as per the attached script. But still see the same problem in the XML:
ns0:ProcessOrdersRequest ns0:profileNote0 <!-- UNDEFINED IN WSDL --> ns0:MarkOrdersPacked ns0:carrierDetails ns0:orderId100</ns0:orderId> ns0:carrierCarrier1</ns0:carrier> ns0:conNote123456</ns0:conNote> </ns0:carrierDetails> </ns0:MarkOrdersPacked> ns0:profileNote0 ns0:noteNevada Ship Verification process</ns0:note> ns0:noteTypeInternal</ns0:noteType> </ns0:profileNote0> </ns0:profileNote0> <!-- UNDEFINED IN WSDL --> </ns0:ProcessOrdersRequest> </ns1:Body>
From: "Johann Spies" jspies@sun.ac.za To: suds@lists.fedoraproject.org Sent: Thursday, 25 November, 2010 5:06:09 PM Subject: Re: [Fedora-suds-list] Suds not interpreting WSDL correctly?
On Thu, Nov 25, 2010 at 08:47:32AM +0200, Johann Spies wrote:
mop.carrierDetails = {'orderId': 100, 'carrier': Carrier1, 'conNote: '123456'}
Correction: mop.carrierDetails = {'orderId': 100, 'carrier': Carrier1, 'conNote' : '123456'}
Regards Johann
On Wed, Dec 01, 2010 at 01:08:38AM +0200, David Hobley wrote:
Does anyone have any ideas what the problem could be here? We are totally stumped and any help would be gratefully received.
Unfortunately my experience is very limited and my experience is that on this list the possibility to get expert help is near to zero.
You might try other lists like the soaplib-list where I received excellent help from somebody after having a similar problem. I did not get any help from the python mailing list too.
Regards Johann