how to parse soap response data
<?xml version="1.0" encoding="utf-8" ?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:sqltypes=
"http://schemas.microsoft.com/SQLServer/2001/12/SOAP/types"
xmlns:sqlmessage=
"http://schemas.microsoft.com/SQLServer/2001/12/SOAP/
types/SqlMessage"
xmlns:sqlresultstream=
"http://schemas.microsoft.com/SQLServer/2001/12/SOAP/types
/SqlResultStream"
xmlns:tns="http://server/nwind2/soap"
<SOAP-ENV:Body>
<tns:MethodNameResponse>
<tns:OutputParam>Error Code 1152</tns:OutputParam>
</tns:MethodNameResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
I expected the response data will be simple xml format, but the response is in soap-env.
how to parse the soap envelop xml data?
Is in soap-envelop format xml parsing is same has simple xml data parse?
example:Simple XML
<?xml version="1.0" encoding="utf-8" ?>
<error >Error Code 1152 </error>
#all Any one advice me how to parse this kind on xml
Thanks in advance.
This is wsdl web services. You can use http://sudzc.com/ which will generate Objective C stubs for you.
Related
I have created an API using the WSO2 Dataservice which return a JSON Object, My client Application waiting for a SOAP response not a JSON response, so I tried to use datamapper to change the response format from JSON to SOAP but it return only and XML format without the SOAP Body and the SOAP envelope. How to hundle this problem?
This is the SOAP response format I would like to get:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetFacturesClientResponse xmlns="http://tempuri.org/">
<GetFacturesClientResult>
<code>0</code>
<codeClient>P-2008-043681</codeClient>
<nom>na</nom>
<prenom>ouss</prenom>
</GetFacturesClientResult>
</GetFacturesClientResponse>
</soap:Body>
</soap:Envelope>
But I got this response:
<GetFacturesClientResponse xmlns="http://tempuri.org/">
<GetFacturesClientResult>
<code>0</code>
<codeClient>P-2008-043681</codeClient>
<nom>na</nom>
<prenom>ouss</prenom>
</GetFacturesClientResult>
</GetFacturesClientResponse>
And this is my code:
<datamapper config="gov:datamapper/oussama.dmc" inputSchema="gov:datamapper/oussama_inputSchema.json" inputType="JSON" outputSchema="gov:datamapper/oussama_outputSchema.json" outputType="JSON" xsltStyleSheet="gov:datamapper/oussama_xsltStyleSheet.xml"/>
Before the Respond Mediator set the following property.
<property name="messageType" value="application/soap+xml" scope="axis2"/>
Also in your Datamapper section the outputType="XML" not JSON.
Update
As ophychius mentioned. The above content type will create a SOAP 1.2 message and if you need a SOAP 1.1 message set the content type to text/xml. Typically, clients supports both versions.
I am trying to get the metadata/fields of the custom forms in Netsuite. But the documentation of netsuite does not provide any direct way of doing this. Some pages mentioned using the SOAP Api's, So i tried using the SOAP api. Here is my api request in SOAP.
<?xml version="1.0"?>
<soapenv:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soapenv:Header>
<ns1:searchPreferences
xmlns:ns1="urn:messages_2022_1.platform.webservices.netsuite.com" soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0">
<ns1:pageSize>30</ns1:pageSize>
</ns1:searchPreferences>
<ns2:tokenPassport soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0"
xmlns:ns2="urn:messages_2022_1.platform.webservices.netsuite.com">
<ns3:account
xmlns:ns3="urn:core_2022_1.platform.webservices.netsuite.com">{{ACCOUNT}}
</ns3:account>
<ns4:consumerKey
xmlns:ns4="urn:core_2022_1.platform.webservices.netsuite.com">{{CONSUMER_KEY}}
</ns4:consumerKey>
<ns5:token
xmlns:ns5="urn:core_2022_1.platform.webservices.netsuite.com">{{TOKEN_ID}}
</ns5:token>
<ns6:nonce
xmlns:ns6="urn:core_2022_1.platform.webservices.netsuite.com">{{nonce}}
</ns6:nonce>
<ns7:timestamp
xmlns:ns7="urn:core_2022_1.platform.webservices.netsuite.com">{{timestamp}}
</ns7:timestamp>
<ns8:signature
xmlns:ns8="urn:core_2022_1.platform.webservices.netsuite.com" algorithm="HMAC-SHA256">{{signature}}
</ns8:signature>
</ns2:tokenPassport>
</soapenv:Header>
<soapenv:Body>
<getSelectValue>
<fieldDescription
xmlns:platformCore="urn:core_2022_1.platform.webservices.netsuite.com">
<platformCore:recordType>salesOrder</platformCore:recordType>
<platformCore:sublist
xmlns="urn:core_2022_1.platform.webservices.netsuite.com">customForm
</platformCore:sublist>
<platformCore:field>salesOrder</platformCore:field>
<platformCore:filterByValueList>
<platformCore:filterBy>
<platformCore:field>entity</platformCore:field>
<platformCore:internalId>164</platformCore:internalId>
</platformCore:filterBy>
</platformCore:filterByValueList>
</fieldDescription>
<pageIndex>1</pageIndex>
</getSelectValue>
</soapenv:Body>
</soapenv:Envelope>
The authorization and the signature generation are working correctly and it return actual response from netsuite. The response contains the list of all custom forms, but not the metadata/fields of the form i put in the filter part.
If there is any other way to do this let me know.
So i'm trying to fetch all the calendar event from office360.com . I am using ews to get the data. I sent a request of
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<soap:Body>
<FindItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
Traversal="Shallow">
<ItemShape>
<t:BaseShape>AllProperties</t:BaseShape>
<t:BodyType>HTML</t:BodyType>
</ItemShape>
<ParentFolderIds>
<t:DistinguishedFolderId Id="calendar"/>
</ParentFolderIds>
</FindItem>
</soap:Body>
</soap:Envelope>
This soap request xml is not returning me the calendar message body but i get the subject and other data . What am i doing wrong here ? any help is appreciated.
The body needs to be retrieved in a separate call.
http://weblogs.asp.net/psperanza/archive/2008/03/18/getting-calendar-items-using-exchange-web-services.aspx
Or you can load the property first.
http://blogs.msdn.com/b/exchangedev/archive/2010/03/16/loading-properties-for-multiple-items-with-one-call-to-exchange-web-services.aspx
The second is easier but you need to define all properties you want back and if it is a lot, it can be a pain.
I have a soap request returning a response like below:
<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:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:authkeyResponse xmlns:ns1="urn:authkey">
<return xsi:type="xsd:string">ALREADY REGISTERED</return>
</ns1:authkeyResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
I am invoking the soap using vb script by following the example from http://kapie.com/2007/consuming-soap-web-services-from-vbscript. I get this whole xml in the strSoapReq object but not sure how to parse it so that I can popup only the result which is "ALREADY REGISTERED".
From the example from the link you gave, make sure you call GetResult explicitly.
If you followed the example and based on your SOAP result, it should be:
GetResult(strResult, "result")
Can anyone help me see why NSXMLParser is not causing these methods
parser:didStartElement:namespaceURI:qualifiedName:attributes:
parser:didEndElement:namespaceURI:qualifiedName:attributes:
to fire for the part of the following data:
<?xml version="1.0" encoding="ISO-8859-1"?><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/"><SOAP-ENV:Body><ns1:NDFDgenResponse xmlns:ns1=""><dwmlOut xsi:type="xsd:string"><?xml version="1.0"?>
<dwml version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.nws.noaa.gov/forecasts/xml/DWMLgen/schema/DWML.xsd">
(body excluded)
</dwml>
</dwmlOut></ns1:NDFDgenResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
I'm not an XML expert, but to me, the <dwml></dwml> part looks like just a regular element, to be parsed just like the parts before it.
I do get two parser:parseErrorOccurred: errors, #200 and #201, but they occur during the parsing of the <SOAP-ENV:Body> element, not the <dwml> element, so I'm not sure if they are relevant. Thanks for any help you can give me.
Update: A friend of mine has told me offline of several errors in the data above. I can't understand why NOAA would be sending out malformed XML though -- is there some secret to parsing it?
This is a SOAP web service, you might want to try this: http://code.google.com/p/wsdl2objc/