Soap server return string

1.2k Views Asked by At

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?

2

There are 2 best solutions below

0
On

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

Which means that simplexml_load_string() will not return XML.

0
On

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.