将 NSString 参数传递给 SOAP WS 会产生"Illegal processing instruction target (" xml ")"



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

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

soap请求是:

<?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字符串一起工作。

感谢您的真知灼见,丹麦

如果您坚持将xml包装成xml,请将内容放入CDATA部分,这样解析器就会将其作为字符串处理。

最新更新