soap - python response does not match with soapUI -


when access web service using soapui correctly formatted text. when use python code, dictionary rows in single allbustype key.

from pysimplesoap.client import soapclient url = 'http://180.92.171.93:8080/upsrtcservices/upsrtcservice?wsdl' namespace = 'http://service.upsrtc.trimax.com/' client = soapclient(wsdl=url, namespace=namespace, trace=true) print client.getbustypes() 

the above code returns following:

{'return': {'allbustype': [{'busname': u'ac sleeper'}, {'bustype': u'acs'}, {'ischildconcession': u'n'}, {'isseatlayout': u'n'}, {'isseatnumber': u'n'}, {'busname': u'ac-janrath'}, {'bustype': u'jnr'}, {'ischildconcession': u'n'}, {'isseatlayout': u'y'}, {'isseatnumber': u'y'},.... 

as per following screen, soapui returning bus stops separate tag. (and not stops in single tag above)

<s:envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">    <s:body>       <ns3:getbustypesresponse xmlns:ns2="com.trimax.upsrtc.xml.jaxb.model" xmlns:ns3="http://service.upsrtc.trimax.com/">          <return>             <allbustype>                <busname>ac sleeper</busname>                <bustype>acs</bustype>                <ischildconcession>n</ischildconcession>                <isseatlayout>n</isseatlayout>                <isseatnumber>n</isseatnumber>             </allbustype>             <allbustype>                <busname>ac-janrath</busname>                <bustype>jnr</bustype>                <ischildconcession>n</ischildconcession>                <isseatlayout>y</isseatlayout>                <isseatnumber>y</isseatnumber>             </allbustype> 

i know if python issue or server issue.

for each entry there opening , closing tag called "allbustype" in soapui response missing in python response. python output returning single row entries.

soapclient returns simplexmlelement stated in first line of soapclient docs:

a simple, minimal , functional http soap webservice consumer, using httplib2 connection ad simplexmlelement xml request/response manipulation.

therefore view xml need call as_xml method on returned simplexmlelement:

as_xml(pretty=false): return xml representation of document

the following should work:

from pysimplesoap.client import soapclient url = 'http://180.92.171.93:8080/upsrtcservices/upsrtcservice?wsdl' namespace = 'http://service.upsrtc.trimax.com/' client = soapclient(wsdl=url, namespace=namespace, trace=true) results = client.getbustypes() print results.as_xml() 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -