将NSString参数传递给SOAP WS会产生“非法处理指令目标(”xml“)”

时间:2012-04-04 19:27:08

标签: objective-c ios web-services soap glassfish

我使用SudzC生成的代码调用WS:

[service createPendingSalesOrders:self action:@selector(handler:) arg0: 
 @"<?xml version='1.0'"
 " encoding='utf-8'?>"
 "<root>test</root>"];

肥皂请求是:

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope   
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:com="http://com/">
      <soapenv:Body>
           <com:createPendingSalesOrders>
                <arg0>"<?xml version='1.0' encoding='utf-8'?><root>test</root>"
                </arg0>          
           </com:createPendingSalesOrders>
      </soapenv:Body>
 </soapenv:Envelope>

我收到了:

[com.ctc.wstx.exc.WstxParsingException: Illegal processing instruction target ("xml"); xml (case insensitive) is reserved by the specs.

来自我在玻璃鱼上运行的WS。

WS与其他似乎包含相同PI的XML字符串一起使用。

感谢您的任何见解, 戴恩

1 个答案:

答案 0 :(得分:0)

如果您坚持将xml包装到xml中,请将内容放入CDATA部分,以便解析器将其作为字符串处理。