0

当我从soap服务器返回时通过__doRequest(xml)方法发送请求时,我得到字符串

string(490) "
0Message0000
"

当我通过 __soapCall 传递数组时,我得到了我想要的,xml 对象

object(stdClass)#2 (2) {
  ["Headers"]=>
  object(stdClass)#3 (2) {
    ["Code"]=>
    int(0)
    ["Message"]=>
    string(7) "Message"
  }
  ["Item"]=>
  object(stdClass)#4 (9) {
    ["LocalID"]=>
    int(991)
    ["ItemID"]=>
    int(0)
    ["SItemID"]=>
    int(0)
    ["UOM"]=>
    string(3) "UOM"
    ["ItemName"]=>
    string(8) "ItemName"
    ["ItemDescription"]=>
    string(15) "ItemDescription"
    ["Local"]=>
    string(5) "Local"
    ["Synonyms"]=>
    object(stdClass)#5 (1) {
      ["Synonym"]=>
      object(stdClass)#6 (2) {
        ["SynonymValue"]=>
        string(12) "SynonymValue"
        ["Contractor"]=>
        int(0)
      }
    }
    ["Properites"]=>
    object(stdClass)#7 (1) {
      ["Property"]=>
      object(stdClass)#8 (2) {
        ["PropertyKey"]=>
        string(11) "PropertyKey"
        ["PropertyValue"]=>
        string(13) "PropertyValue"
      }
    }
  }
}

我对此请求的服务器方法:

public function GetItemData($parametersIn) {
    srand((double) microtime() * 1234567);
    $xml = 'XML'; // my response in xml
    $parametersOut = simplexml_load_string($xml);
    return $parametersOut;
}

为什么当我使用 __doRequest 我得到这个奇怪的字符串?我如何将其转换为数组或对象?

4

2 回答 2

1

You are looking at the output in a browser which "hides" the XML tags. Use "view source" on the page to see what's really there.

于 2011-04-12T12:32:45.857 回答
-1

或者,“XML”不是 xml,但“XML”是。

这意味着 simplexml_load_string() 不会返回 XML。

于 2011-10-06T21:23:59.853 回答