0

in my project i want to use JASON parsing my sample soap request and response is here below please guide me how can i do that

// soap request //

<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns9093="urn:outmarket"><SOAP-ENV:Body><ns9093:doStartup xmlns:ns9093="urn:outmarket"><username xsi:type="xsd:string">guest</username><password xsi:type="xsd:string">guest</password></ns9093:doStartup></SOAP-ENV:Body></SOAP-ENV:Envelope>


// soap response //

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:doStartupResponse xmlns:ns1="urn:outmarket"><return xsi:type="xsd:xml"><isvaliduser>1</isvaliduser><userid>19</userid><cansubmitphoto>0</cansubmitphoto><cansubmitcomment>0</cansubmitcomment><cansubmitrating>0</cansubmitrating><cansubmitmarket>0</cansubmitmarket><cansubmitstallholder>0</cansubmitstallholder><databaseid>1</databaseid><markets><markettype>1</markettype><marketid>3</marketid><marketname><![CDATA[Bairnsdale Farmers Market]]></marketname><ratingname><![CDATA[Market in general]]></ratingname><good>0</good><neutral>0</neutral><bad>0</bad></markets><markets><markettype>0</markettype><marketid>3</marketid><marketname><![CDATA[Bairnsdale Farmers Market]]></marketname><ratingname><![CDATA[Market in general]]></ratingname><good>25</good><neutral>0</neutral><bad>18</bad></markets><markets><markettype>0</markettype><marketid>5</marketid><marketname><![CDATA[Bendigo Farmers' Market]]></marketname><ratingname>`
Brad Larson
  • 170,088
  • 45
  • 397
  • 571
hardik
  • 254
  • 4
  • 15

2 Answers2

2

The soap response is not in JSON format, so you can not use JSON for parsing the data. Instead you need to either change the response to JSON format or use a full-fledged xml-parser.

Claus Broch
  • 9,212
  • 2
  • 29
  • 38
  • I dislike answers like this, as there's absolutely no reason a SOAP response couldn't be parsed into JSON. For instance, if building a generic handler of web services, it might be helpful to have a JSON parser. – Peder Rice Apr 22 '11 at 18:56
  • It doesn't really make it more JSON whether you like the answer or not. Run the response above through jsonlint.org and see if that SOAP syntax is valid JSON? – Claus Broch Apr 25 '11 at 21:36
  • I didn't say that it was--not at all. I use JSON on a daily basis, and I love JSON.NET, which is able to convert an object into a JSON representation of that object. In cases like a generic SOAP handler, you might use duck-typing with JSON to plug in values without – Peder Rice Apr 27 '11 at 14:59
0

Start here:

json-framework.

Then here:

TouchXML

and here:

204465.

Community
  • 1
  • 1
Paul Lynch
  • 19,769
  • 4
  • 37
  • 41
  • Note the links to TouchXML and to a question on SOAP processing on iPhone. Perhaps the answer was to subtle? – Paul Lynch May 05 '10 at 12:39