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

问题描述 投票:1回答:1

我使用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字符串一起使用。

感谢任何见解,戴恩

objective-c ios web-services soap glassfish
1个回答
0
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.