robotframework-sudslibrary icon indicating copy to clipboard operation
robotframework-sudslibrary copied to clipboard

How to convert XML to WSDL object during SOAP Update a message?

Open GavinCui9 opened this issue 7 years ago • 1 comments

I need to update an object attributes by reading it and update the response message and convert it to Update message, then call Soap Update method.

The problem is that when I convert a XML string/file to WSDL object, all < and > tags will be turned to < and > Is there a way to avoid this?

For example:

Starting test: Test-Update.case1 20170313 10:03:07.655 : INFO : Using WSDL at http://.../subscribermodel-ws/device?wsdl Suds ( https://fedorahosted.org/suds/ ) version: 0.4.1 (beta) build: R705-20101207

Service ( DeviceWebServiceService ) tns="http://." Prefixes (2) ns0 = "http://" ns3 = "http://" Ports (1): (DeviceWebServicePort) Methods (10): create(device device, ) delete(xs:string deviceId, ) echo(xs:string arg0, ) read(xs:string deviceId, ) update(device device, ) Types (28): device deviceArray deviceIdentity deviceIdentityArray deviceIdentityType deviceType user

20170313 10:03:07.659 : INFO : Sending:

<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns0="http://." xmlns:ns1="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> SOAP-ENV:Header/ ns2:Body ns0:read <deviceId>device-id-test1</deviceId> </ns0:read> </ns2:Body> </SOAP-ENV:Envelope>

20170313 10:03:07.665 : INFO : Received:

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"> env:Header/ env:Body <ns0:readResponse xmlns:ns0="http://."> 1 <lifeCycleName>DefaultDeviceLifeCycle</lifeCycleName> 1 false false cc34d7f6-267f-490a-94c8-2e854391301c true Active <categoryList>DefaultCategory</categoryList> <creationTime>1489413781965</creationTime> <customData/> <deviceType>NORMAL</deviceType> device-id-test1 <identityType>E164</identityType> 6137849921 <pwdEncrypted>false</pwdEncrypted> <subscriptionIndex>0</subscriptionIndex> <syOCSEnabled>false</syOCSEnabled> </ns0:readResponse> </env:Body> </env:Envelope>

20170313 10:03:07.671 : INFO : ${device} = <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>env:Header</env:Header>env:Body<ns0:readResponse xmlns:ns0='http://'><return xmlns:ns2="http... 20170313 10:03:07.672 : INFO : <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>env:Header</env:Header>env:Body<ns0:readResponse xmlns:ns0='http://.*'>1<lifeCycleName>DefaultDeviceLifeCycle</lifeCycleName>1falsefalsecc34d7f6-267f-490a-94c8-2e854391301ctrueActive<categoryList>DefaultCategory</categoryList><creationTime>1489413781965</creationTime><customData/><deviceType>NORMAL</deviceType>device-id-test1<identityType>E164</identityType>6137849921<pwdEncrypted>false</pwdEncrypted><subscriptionIndex>0</subscriptionIndex><syOCSEnabled>false</syOCSEnabled></ns0:readResponse></env:Body></env:Envelope> 20170313 10:03:07.673 : INFO : ${devicexml} = 1<lifeCycleName>DefaultDeviceLifeCycle</lifeCycleName>1false</barrin... 20170313 10:03:07.674 : INFO : 1<lifeCycleName>DefaultDeviceLifeCycle</lifeCycleName>1falsefalsecc34d7f6-267f-490a-94c8-2e854391301ctrueActive<categoryList>DefaultCategory</categoryList><creationTime>1489413781965</creationTime><customData/><deviceType>NORMAL</deviceType>device-id-test1<identityType>E164</identityType>6137849921<pwdEncrypted>false</pwdEncrypted><subscriptionIndex>0</subscriptionIndex><syOCSEnabled>false</syOCSEnabled> 20170313 10:03:07.675 : INFO : ${device1} = <Element return at 0x1ef3af0> 20170313 10:03:07.677 : INFO : <Element return at 0x1ef3af0> 20170313 10:03:07.678 : INFO : ${device2} = 1<lifeCycleName>DefaultDeviceLifeCycle</lifeCycleName>1false</barrin... 20170313 10:03:07.679 : INFO : 1<lifeCycleName>DefaultDeviceLifeCycle</lifeCycleName>1falsefalsecc34d7f6-267f-490a-94c8-2e854391301ctrueActive<categoryList>DefaultCategory</categoryList><creationTime>1489413781965</creationTime><customData/><deviceType>NORMAL</deviceType>device-id-test1<identityType>E164</identityType>22222222<pwdEncrypted>false</pwdEncrypted><subscriptionIndex>0</subscriptionIndex><syOCSEnabled>false</syOCSEnabled><subscriptionIds>subscription-id-test2</subscriptionIds> 20170313 10:03:07.680 : INFO : ${device3} = 1<lifeCycleName>DefaultDeviceLifeCycle</lifeCycleName>1falsefalsecc34d7f6-267f-490a-94c8-2e854391301ctr... 20170313 10:03:07.681 : INFO : 1<lifeCycleName>DefaultDeviceLifeCycle</lifeCycleName>1falsefalsecc34d7f6-267f-490a-94c8-2e854391301ctrueActive<categoryList>DefaultCategory</categoryList><creationTime>1489413781965</creationTime><customData/><deviceType>NORMAL</deviceType>device-id-test1<identityType>E164</identityType>22222222<pwdEncrypted>false</pwdEncrypted><subscriptionIndex>0</subscriptionIndex><syOCSEnabled>false</syOCSEnabled><subscriptionIds>subscription-id-test2</subscriptionIds> 20170313 10:03:07.682 : INFO : ${device4} = None 20170313 10:03:07.683 : INFO : None 20170313 10:03:07.685 : INFO : Sending:

<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns0="http://." xmlns:ns1="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> SOAP-ENV:Header/ ns2:Body ns0:update <version>1</version><lifeCycleName>DefaultDeviceLifeCycle</lifeCycleName><state><version>1</version><barring>false</barring><final>false</final><id>cc34d7f6-267f-490a-94c8-2e854391301c</id><initial>true</initial><name>Active</name></state><categoryList>DefaultCategory</categoryList><creationTime>1489413781965</creationTime><customData/><deviceType>NORMAL</deviceType><groups/><id>device-id-test1</id><identities><identityType>E164</identityType><value>22222222</value></identities><pwdEncrypted>false</pwdEncrypted><subscriptionIndex>0</subscriptionIndex><syOCSEnabled>false</syOCSEnabled><subscriptionIds>subscription-id-test2</subscriptionIds> </ns0:update> </ns2:Body> </SOAP-ENV:Envelope>

20170313 10:03:07.692 : ERROR :

<SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns0="http://." xmlns:ns1="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> SOAP-ENV:Header/ ns2:Body ns0:update <version>1</version><lifeCycleName>DefaultDeviceLifeCycle</lifeCycleName><state><version>1</version><barring>false</barring><final>false</final><id>cc34d7f6-267f-490a-94c8-2e854391301c</id><initial>true</initial><name>Active</name></state><categoryList>DefaultCategory</categoryList><creationTime>1489413781965</creationTime><customData/><deviceType>NORMAL</deviceType><groups/><id>device-id-test1</id><identities><identityType>E164</identityType><value>22222222</value></identities><pwdEncrypted>false</pwdEncrypted><subscriptionIndex>0</subscriptionIndex><syOCSEnabled>false</syOCSEnabled><subscriptionIds>subscription-id-test2</subscriptionIds> </ns0:update> </ns2:Body> </SOAP-ENV:Envelope> 20170313 10:03:07.693 : FAIL : WebFault: Server raised fault: 'Entity Id is null.' Ending test: Test-Update.case1

GavinCui9 avatar Mar 13 '17 14:03 GavinCui9

Sorry for the late reply. The message log is quite helpful, but I would also need to see the code you are executing to understand what is going on.

ombre42 avatar May 13 '17 15:05 ombre42