开发者

Soap server return string

When i sending request by __doRequest (xml) method on return from soap server i get string

string(490) "
0Message0000
"

when i pass array by __soapCall i get exactly that i want, xml object

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"
      }
    }
  }
}

My server method for this request:

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

Why when i using __doRequest i get this strange string ? how i can convert it to array or object?


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.


Alternatively, how about the fact that "XML" is not xml, but "XML" is.

Which means that simplexml_load_string() will not return XML.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜