Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8569021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:14:19+00:00 2026-06-11T18:14:19+00:00

I have xml string. It’s wrong string. But after using NSLog and coping it

  • 0

I have xml string. It’s wrong string. But after using NSLog and coping it from console, it became good string (I got good response from server). I build wrong string by this way:

NSString *soapMessage = [NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"UTF-8\"?><env:Envelope xmlns: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:enc=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:ns0=\"http://com.test/types/AstoriaObjectProperties\" xmlns:ns1=\"http://com.test/wsdl/AstoriaObjectProperties\" xmlns:ns2=\"http://java.sun.com/jax-rpc-ri/internal\"><env:Body><ns1:setObjectProperties env:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"><HashMap_1 xsi:type=\"ns2:hashMap\" enc:arrayType=\"ns2:mapEntry[2]\"><item xsi:type=\"ns2:mapEntry\"><key xsi:type=\"xsd:string\">id</key><value xsi:type=\"xsd:string\">%@</value></item><item xsi:type=\"ns2:mapEntry\"><key xsi:type=\"xsd:string\">annotations</key><value href=\"#ID1\"/></item></HashMap_1><HashMap_2 xsi:type=\"ns2:hashMap\" enc:arrayType=\"ns2:mapEntry[2]\"><item xsi:type=\"ns2:mapEntry\"><key xsi:type=\"xsd:string\">id</key><value xsi:type=\"xsd:string\">%@</value></item><item xsi:type=\"ns2:mapEntry\"><key xsi:type=\"xsd:string\">annotations</key><value href=\"#ID2\"/></item></HashMap_2></ns1:setObjectProperties>%@%@</env:Body></env:Envelope>", fileID, fileID, arrayNewXML, arrayOldXML];

When I sent this message to the server, I got an error in response.

But then I use NSLog to see soapMessage, I copy it, and use soap message from buffer. It looks like this.

<?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns: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:enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns0="http://com.test/types/AstoriaObjectProperties" xmlns:ns1="http://com.test/wsdl/AstoriaObjectProperties" xmlns:ns2="http://java.sun.com/jax-rpc-ri/internal"><env:Body><ns1:setObjectProperties env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><HashMap_1 xsi:type="ns2:hashMap" enc:arrayType="ns2:mapEntry[2]"><item xsi:type="ns2:mapEntry"><key xsi:type="xsd:string">id</key><value xsi:type="xsd:string">0000001aWGA2070GYZ</value></item><item xsi:type="ns2:mapEntry"><key xsi:type="xsd:string">annotations</key><value href="#ID1"/></item></HashMap_1><HashMap_2 xsi:type="ns2:hashMap" enc:arrayType="ns2:mapEntry[2]"><item xsi:type="ns2:mapEntry"><key xsi:type="xsd:string">id</key><value xsi:type="xsd:string">0000001aWGA2070GYZ</value></item><item xsi:type="ns2:mapEntry"><key xsi:type="xsd:string">annotations</key><value href="#ID2"/></item></HashMap_2></ns1:setObjectProperties><ns0:ArrayOfhashMap id="ID1" env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="enc:Array" enc:arrayType="ns2:hashMap[1]"><item xsi:type="ns2:hashMap" enc:arrayType="ns2:mapEntry[7]"><item xsi:type="ns2:mapEntry"><key xsi:type="xsd:string">$$$XD_AnnotationUser$$$</key><value xsi:type="xsd:string">AstoriaAdmin</value></item><item xsi:type="ns2:mapEntry"><key xsi:type="xsd:string">Annotation Status</key><value xsi:type="xsd:string">waiting for decision</value></item><item xsi:type="ns2:mapEntry"><key xsi:type="xsd:string">$$$XD_AnnotationID$$$</key><value xsi:type="xsd:string">00000043X951EE3073607F44F7D00000000000000951FF3076D000000590000003C647C7668696D696B2D6163733A433A5C50726F6772616D2046696C65735C4173746F72696120536F6674776172655C434D535C64617461626173655C63616231303030302E64627C31347C367C3263307C31303030303E00704B585000000000YZ</value></item><item xsi:type="ns2:mapEntry"><key xsi:type="xsd:string">Annotation Comment</key><value xsi:type="xsd:string">comment</value></item><item xsi:type="ns2:mapEntry"><key xsi:type="xsd:string">$$$XD_AnnotationDate$$$</key><value xsi:type="enc:dateTime">2012-09-18T10:22:40.000Z</value></item><item xsi:type="ns2:mapEntry"><key xsi:type="xsd:string">Annotation Status Comment</key><value xsi:type="xsd:string">status comment</value></item><item xsi:type="ns2:mapEntry"><key xsi:type="xsd:string">$$$XD_AnnotationName$$$</key><value xsi:type="xsd:string">Legal Review</value></item></item></ns0:ArrayOfhashMap><ns0:ArrayOfhashMap id="ID2" env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="enc:Array" enc:arrayType="ns2:hashMap[1]"><item xsi:type="ns2:hashMap" enc:arrayType="ns2:mapEntry[7]"><item xsi:type="ns2:mapEntry"><key xsi:type="xsd:string">$$$XD_AnnotationUser$$$</key><value xsi:type="xsd:string">AstoriaAdmin</value></item><item xsi:type="ns2:mapEntry"><key xsi:type="xsd:string">Annotation Status</key><value xsi:type="xsd:string">waiting for decision</value></item><item xsi:type="ns2:mapEntry"><key xsi:type="xsd:string">$$$XD_AnnotationID$$$</key><value xsi:type="xsd:string">00000043X951EE3073607F44F7D00000000000000951FF3076D000000590000003C647C7668696D696B2D6163733A433A5C50726F6772616D2046696C65735C4173746F72696120536F6674776172655C434D535C64617461626173655C63616231303030302E64627C31347C367C3263307C31303030303E00704B585000000000YZ</value></item><item xsi:type="ns2:mapEntry"><key xsi:type="xsd:string">Annotation Comment</key><value xsi:type="xsd:string">comment</value></item><item xsi:type="ns2:mapEntry"><key xsi:type="xsd:string">$$$XD_AnnotationDate$$$</key><value xsi:type="enc:dateTime">2012-09-18T10:22:40.000Z</value></item><item xsi:type="ns2:mapEntry"><key xsi:type="xsd:string">Annotation Status Comment</key><value xsi:type="xsd:string">status comment</value></item><item xsi:type="ns2:mapEntry"><key xsi:type="xsd:string">$$$XD_AnnotationName$$$</key><value xsi:type="xsd:string">Legal Review</value></item></item></ns0:ArrayOfhashMap></env:Body></env:Envelope>

And after that I have response with no errors.

I seems, that NSLog fixed some problems with encoding. But how to solve this issues in my soapMessage?
I tried:

soapMessage = [soapMessage stringByReplacingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
soapMessage = [soapMessage stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
soapMessage = [soapMessage stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

That didn’t help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T18:14:20+00:00Added an answer on June 11, 2026 at 6:14 pm

    I just guest the encoding, and manually deleted some bad symbols:

     NSMutableData *soapdata = [[[NSMutableData alloc] initWithData:[soapMessage dataUsingEncoding:NSNonLossyASCIIStringEncoding]] autorelease]; 
       soapMessage = [[[NSString alloc] initWithData:soapdata encoding:NSUTF8StringEncoding] autorelease];
       soapMessage = [soapMessage stringByReplacingOccurrencesOfString:@"\\ufffc" withString:@""];
       soapdata = [[[NSMutableData alloc] initWithData:[soapMessage dataUsingEncoding:NSUTF8StringEncoding]] autorelease];
    

    And now it works!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an xml string below that I've turned into an object using $content
I have a string containing XML document using LinqtoXML What is the best way
I have a XML String retrieved from a XML file. I can't access the
I have a XML string comming from a Rest WS that I created on
I have an xml string that I wish to traverse using LINQ to XML
I am using C# 3.5. I have an XML string that I pass to
I have a xml string that return from Post method: private static void GetResponseCallback(IAsyncResult
I have an XML string which is output from a Visual Fox Pro based
I have a xml string from other system, I need select xml as a
I have defined an XML string using $str = <a><b></b></a> Now I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.