当我在升级服务器上调用SOAP端点时,NUSOAP客户端响应是空的
我正在使用硬编码XML请求的Nusoap客户端与服务器进行通信,以阅读WebSphere服务器的响应。我使用nusoap_client->发送请求。
$ result = nusoap_client->发送。 然后从$结果获得肥皂响应。完美的。 现在,我正在尝试从升级的服务器获得服务器响应(可能不使用WebSphere。不确定)。肥皂名称空间也已更改,并且响应具有一些前缀。
我不再从$ result获得肥皂响应(当我运行strlen()时,我的尺寸为零)。但是我可以将nusoap_client->响应以下响应。因此,我尝试在php5.x上使用sumplexml_load_string解析,但似乎没有解析和错误消息=>语法错误,意外的t_encapsed_and_whitespace,期望t_string或t_variable或t_num_string。我可以在哪里出错?
$stringer = <<<XML
<?xml version='1.0' encoding='ISO-8859-1'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ser:getCarResourceResponse xmlns:ser="http://sos.joburg.com/webservice/ecare/services">
<ser:GetCarResourceReply>
<ser:resCode>10652981251</ser:resCode>
<ser:departName>Ingolstadt</ser:departName>
<ser:resStatus>4</ser:resStatus>
<ser:statusDate>2022-05-09 09:24:50</ser:statusDate>
<ser:isScheduled>0</ser:isScheduled>
<ser:departStatus>0</ser:departStatus>
</ser:GetCarResourceReply>
<ser:ResultOfOperationReply>
<ser:resultCode>0</ser:resultCode>
<ser:resultMessage>Successful</ser:resultMessage>
</ser:ResultOfOperationReply>
</ser:getCarResourceResponse>
</soapenv:Body>
</soapenv:Envelope>
XML;
$log->logInfo(print_r(simplexml_load_string($stringer), 1));
I am using NUSOAP client with a hard coded XML request to communicate with a Server to read a response from a Websphere server. I use nusoap_client->send to send the request.
$result = nusoap_client->send.
Then SOAP response is obtained from $result. Perfect.
Now I am trying to get a server response from an upgraded server (probably not using Websphere. Not sure). SOAP namespace is also changed and the response has some prefix.
I no longer get the SOAP response from $result (when I run strlen() I get zero size) . But I can call nusoap_client->responseData to get a response below. So I try to parse with simplexml_load_string on PHP5.x but it doesnt seem to parse and error message => syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING. Where could I be going wrong?
$stringer = <<<XML
<?xml version='1.0' encoding='ISO-8859-1'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ser:getCarResourceResponse xmlns:ser="http://sos.joburg.com/webservice/ecare/services">
<ser:GetCarResourceReply>
<ser:resCode>10652981251</ser:resCode>
<ser:departName>Ingolstadt</ser:departName>
<ser:resStatus>4</ser:resStatus>
<ser:statusDate>2022-05-09 09:24:50</ser:statusDate>
<ser:isScheduled>0</ser:isScheduled>
<ser:departStatus>0</ser:departStatus>
</ser:GetCarResourceReply>
<ser:ResultOfOperationReply>
<ser:resultCode>0</ser:resultCode>
<ser:resultMessage>Successful</ser:resultMessage>
</ser:ResultOfOperationReply>
</ser:getCarResourceResponse>
</soapenv:Body>
</soapenv:Envelope>
XML;
$log->logInfo(print_r(simplexml_load_string($stringer), 1));
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了更新,我找到了解决方案。有效地,虽然我想进行非结构化的XML输出并使其结构化,但它并不像我想象的那样起作用。
我有必要采用XML的单行并将其格式化,如您在代码标记中所看到的。在我从文本文件中提起的文本文件中,我提起了一行XML,该行未构成在堆栈溢出中看到的多行。
谢谢您的评论。
As an update to this, I found the solution. Effectively, while I want to take an unstructured XML output and make it structured, it doesn't work like I thought.
It was necessary for me to take the single line of XML and format it as you see in the code markup. In the text file I lifted this from, I lifted a single line of XML which was not structured into multiple lines you see in stack overflow.
Thank you for your comments.