iOS:PHP使用SOAP的web服务在调用时返回null
创建了一个扩展名为.php的web服务,我正在通过soap传递参数。但它的回报超出了我的理解。我还使用正确的输入检查RestClient,然后返回实际输出。这在代码中是不正确的。可能出了什么问题 我的输入xml结构是iOS:PHP使用SOAP的web服务在调用时返回null,php,ios,xml,web-services,soap,Php,Ios,Xml,Web Services,Soap,创建了一个扩展名为.php的web服务,我正在通过soap传递参数。但它的回报超出了我的理解。我还使用正确的输入检查RestClient,然后返回实际输出。这在代码中是不正确的。可能出了什么问题 我的输入xml结构是 <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
</soap:Header>
<soap:Body>
<getUpdates>
<user_location></user_location>
<application_type>FC</application_type>
<last_updated_date>2014-11-25</last_updated_date>
<platform>Android</platform>
</getUpdates>
</soap:Body>
</soap:Envelope>
尝试添加
[request addRequestHeader:@"Accept" value:@"text/xml"];
到您的Web服务请求。您正在调用的REST服务默认为json。许多人通常会根据请求返回XML。您将得到JSON。这对于REST服务来说是相当正常的。听起来你的PHP服务没有返回XML.ohh,我明白了。让我查一查。
"SOAP-ENV:Envelope" = {
"SOAP-ENV:Body" = {
"ns1:getUpdatesResponse" = {
return = {
"SOAP-ENC:arrayType" = "xsd:anyType[0]";
"xsi:type" = "SOAP-ENC:Array";
};
"xmlns:ns1" = "http://schemas.xmlsoap.org/soap/envelope/";
};
};
"SOAP-ENV:encodingStyle" = "http://schemas.xmlsoap.org/soap/encoding/";
"xmlns:SOAP-ENC" = "http://schemas.xmlsoap.org/soap/encoding/";
"xmlns:SOAP-ENV" = "http://schemas.xmlsoap.org/soap/envelope/";
"xmlns:xsd" = "http://www.w3.org/2001/XMLSchema";
"xmlns:xsi" = "http://www.w3.org/2001/XMLSchema-instance";
};
[request addRequestHeader:@"Accept" value:@"text/xml"];