While i am getting response in through soap, i am getting this exception for some time. please help in finding the solution.
Pasting the whole soap response below.
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<soapenv:Fault>
<soapenv:Code>
<soapenv:Value>soapenv:Receiver</soapenv:Value>
</soapenv:Code>
<soapenv:Reason>
<soapenv:Text xml:lang="en-US">Invalid white space character (0x8) in text to output</soapenv:Text>
</soapenv:Reason>
<soapenv:Detail />
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
Related
I am interacting with exchange to extract emails having particular extended property. I am able to fetch email that I have sent with newly created extended properties, but when I reply to the emails, these properties are not preserved..Is this normal behavior? Is there anyway to work around it?
The code I am using to send and fetch email for now is as below
To send email with extended property
`<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<t:RequestServerVersion Version="Exchange2010" />
</soap:Header>
<soap:Body>
<m:CreateItem MessageDisposition="SendAndSaveCopy">
<m:SavedItemFolderId>
<t:DistinguishedFolderId Id="sentitems" />
</m:SavedItemFolderId>
<m:Items>
<t:Message>
<t:Subject>Greetings</t:Subject>
<t:Body BodyType="Text">Message with extended property attached</t:Body>
<t:ExtendedProperty>
<t:ExtendedFieldURI PropertySetId="c11ff724-aa03-4555-9952-8fa248a11c3e"
PropertyName="extended_property_name" PropertyType="String" />
<t:Value>NEWVALUE</t:Value>
</t:ExtendedProperty>
<t:ToRecipients>
<t:Mailbox>
<t:EmailAddress>test#cisco.com</t:EmailAddress>
</t:Mailbox>
</t:ToRecipients>
</t:Message>
</m:Items>
</m:CreateItem>
</soap:Body>
</soap:Envelope>`
Fetching email with extended property
`<?xml version="1.0" encoding="UTF-8" ?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:typ="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns:mes="http://schemas.microsoft.com/exchange/services/2006/messages">
<soapenv:Header>
<typ:RequestServerVersion Version="Exchange2007_SP1"/>
</soapenv:Header>
<soapenv:Body>
<mes:FindItem Traversal="Shallow">
<mes:ItemShape>
<typ:BaseShape>Default</typ:BaseShape>
<typ:IncludeMimeContent>false</typ:IncludeMimeContent>
<typ:BodyType>Best</typ:BodyType>
</mes:ItemShape>
<mes:IndexedPageItemView MaxEntriesReturned="10" Offset="0" BasePoint="Beginning"/>
<mes:GroupBy Order="Ascending">
<typ:FieldURI FieldURI="item:DateTimeReceived" />
<typ:AggregateOn Aggregate="Maximum">
<typ:FieldURI FieldURI="item:ItemId"/>
</typ:AggregateOn>
</mes:GroupBy>
<mes:Restriction>
<typ:IsEqualTo>
<typ:ExtendedFieldURI PropertySetId="c11ff724-aa03-4555-9952-8fa248a11c3e" PropertyName="extended_property_name" PropertyType="String" />
<typ:FieldURIOrConstant>
<typ:Constant Value="NEWVALUE" />
</typ:FieldURIOrConstant>
</typ:IsEqualTo>
</mes:Restriction>
<mes:ParentFolderIds>
<!--You have a CHOICE of the next 2 items at this level-->
<typ:FolderId Id="[Process.Variables.Completed Id]"
ChangeKey="[Process.Variables.Completed ChangeKey]"/>
</mes:ParentFolderIds>
</mes:FindItem>
</soapenv:Body>
</soapenv:Envelope>`
Any Help will be greatly appreciated!
Thanks
Yes that is normal the extended properties your setting are for the message your sending, the response is a brand new message and won't contain any custom properties you have set (this would actually be more of a problem if it did). If your trying to correlate response and reply then you should look at the InReplyto,Referances or ConversationId eg http://blog.mailgun.com/tracking-replies-in-mailgun-or-any-other-email/
cheers
Glen
I want some help friends,
I want to Post XML string in SOAP message in iOS sdk.
Is it possible to do this?
If yes, Please give me some sample code for that. otherwise advice me alternative way to do this.
Please help me to come out from this problem.
Thanks in advance.
Code:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<postCourseUsage xmlns="http://tempuri.org/">
<xml><?xml version="1.0"?><CU><ULID>admin</ULID><CID>myOwn</CID><CURS><CUR><CN>Home</CN><USG><CUSG>2</CUSG><SD>12-Jul-2011 12:41:42</SD></USG></CUR></CURS></CU></xml>
</postCourseUsage>
</soap:Body>
</soap:Envelope>
I got my answer.
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<postCourseUsage xmlns="http://tempuri.org/">
<xml><?xml version="1.0"?><CU><ULID>admin</ULID><CID>myOwn</CID><CURS><CUR><CN>Home</CN><USG><CUSG>2</CUSG><SD>12-Jul-2011 12:41:42</SD></USG></CUR></CURS></CU></xml>
</postCourseUsage>
</soap:Body>
</soap:Envelope>
Using this code i can pass xml string as argument in soap message and on the server side it will interprete it as XML.
Hi everyone and thanks in advance for your help.
This is the situation:
I'm consuming a webservice that returns me a soap message in the following way:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<getMessagesResponse xmlns="urn:DefaultNamespace">
<getMessagesReturn xmlns="">
<?xml version="1.0" encoding="ISO-8859-1" ?>
<contact>
A message with escaped values like & < >
</contact>
</getMessagesReturn>
</getMessagesResponse>
</soapenv:Body>
</soapenv:Envelope>
I use NSUTF8StringEncoding to read the getMessagesReturn child and it generates me the following:
<?xml version="1.0" encoding="ISO-8859-1">
<contact>
A message with escaped values like & < >
</contact>;
My problem is that it also unescape the & < > inside the contact tag, and of course the NSXMLParser throws an error because these are invalid characters inside a XML tag.
My Question is, How can I avoid this? Is there a way to escape back only the tags message contents before passing the info to the Parser?
Any help would be greatly appreciated.
Edit I use:
[NSString stringWithCString:(char*)elementText encoding:NSUTF8StringEncoding];
Do you control the web service? The correct way to pass getMessageReturn is with a CDATA. Otherwise, the correct encoding would be like this (note the message itself and the extra &'s)
<getMessagesReturn xmlns="">
<?xml version="1.0" encoding="ISO-8859-1" ?>
<contact>
A message with escaped values like & < >
</contact>
</getMessagesReturn>
But CDATA is much easier, and this is what it's for. If nothing else, you can use string substitution to insert the CDATA before parsing.
I am calling the web services. The web service returns data in xml format. Now the problem is the xml data is not being received in proper format. In place of "<", ">" it returns in html form.
So I assigned the xmldata to a NsMutableString and replaced the escape characters so that the format of xml data is proper. Then I reassigned the NSMutableString to NSData so that I can parse the tags. but the problem is the xmlparser stops right where the xml data is, where I replaced the tags. It doesn't go further. What is going on?
This is the xml response from web service that I called.
<?xml version="1.0" encoding="ISO-8859-1"?><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:GetCustomerInfoResponse xmlns:ns1="http://aa.somewebservice.com/phpwebservice">
<return xsi:type="xsd:string">
<?xml version="1.0" encoding="utf-8"?><customer><id>1</id><customername>Hitesh</customername><phonenumber>98989898</phonenumber></customer>
</return>
</ns1:GetCustomerInfoResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
And this is after I replaced the tags.
<?xml version="1.0" encoding="ISO-8859-1"?><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:GetCustomerInfoResponse xmlns:ns1="http://aa.somewebservice.com/phpwebservice">
<return xsi:type="xsd:string">
<?xml version="1.0" encoding="utf-8"?>
<customer><id>1</id><customername>Hitesh</customername><phonenumber>98989898</phonenumber></customer>
</return>
</ns1:GetCustomerInfoResponse>
</SOAP-ENV:Body></SOAP-ENV:Envelope>
Now the problem is while parsing the xml data, the parser only goes up to return tag. And then it is stuck there.
What parser do you use? On the iPhone you can use different parsers (eg: TouchXML or TinyXML), try to use they...
Also I think you would remove <?xml version="1.0" encoding="utf-8"?> from 'return' tag or replace it with another tag. Then when needed make the inverse transformation.
I'm using a web service where the WSDL describes a single string element in each request and response.
<s:element name="SERVICE">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="SERVICERequest" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
Embedded in that string are a number of plain XML elements that have escaped tags.
<?xml version="1.0" encoding="utf-8"?>
<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>
<SERVICE xmlns="https://services.transcard.com/">
<SERVICERequest>
<SERVICE_REQ>
<PARAM_1>
Value1
</PARAM_1>
<PARAM_2>
Value2
</PARAM_2>
<PARAM_3>
Value3
</PARAM_3>
</SERVICE_REQ>
</SERVICERequest>
</SERVICE>
</soap:Body>
</soap:Envelope>
This is the format of responses from the service, and is the format expected for incoming requests.
Is this common in SOAP interfaces? In practice, it causes the inner parameters to be inaccessible to the SOAP library I'm using. (soap4r) Any feedback from SOAP veterans is appreciated.
No. That's not common.
That completely disregards using an actual schema (which defines the data type being returend) and replaces it with a giant string that you're going to have to parse once you get the response.
...Terrible.