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 时我得到这个奇怪的字符串?我如何将其转换为数组或对象?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您正在浏览器中查看“隐藏”XML 标记的输出。使用页面上的“查看源代码”来查看实际内容。
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.
或者,“XML”不是 xml,但“XML”是这样的事实怎么样?
这意味着 simplexml_load_string() 将不会返回 XML。
Alternatively, how about the fact that "XML" is not xml, but "XML" is.
Which means that simplexml_load_string() will not return XML.