Hello,
in my App I have to consume a RPC Webservice. For tht I have to send a XML as the HTTPBody of the NSMutableURLRequest.
It works fine as long as i don´t use Special Characters inside the XML.
NSString* pStr = [[NSString alloc] initWithFormat:@"<?xml version=\"1.0\" encoding=\"UTF-8\"?><methodCall><methodName>samurai.SessionInitiate</methodName><params><param><value><struct><member><name>LocalUri</name><value><string></string></value></member><member><name>RemoteUri</name><value><string>sip:%@@sipgate.net</string></value></member><member><name>TOS</name><value><string>text</string></value></member><member><name>Content</name><value><string>%@</string></value></member><member><name>Schedule</name><value><string></string></value></member></struct></value></param></params></methodCall>", modded, smsTextView.text];
Inside this XML I use %@ two times, to insert Strings at both positions, modded and textView.Text. And that´s my Problem, when textView.Text is something like "%=&=-Test", the Webservice responds with an error saying the XML is not OK. I think the Character "&" for example has to be something like "&" but who can I do that? Is there something in the Cocoa Framework that can help me? I can´t be the first and the last one with a problem like this? or am I doing something completely wrong?! Do I really have to implement my own Method which parses the String and changes all Characters, not allowed in XML, to something like "&" ?
Can someone give me a Tip on how to solf this problem?
Thank you
dragi