Php 正在处理Firstdata全局网关API的SOAP响应
我已经阅读了这里的问题和答案 因此,我有几乎相同的东西,但一些项目的情况是不同的 我得到了错误 警告:main()[function.main]:result.php中不再存在节点 在第XX行,错误的行是response= 这是我的代码(result.php)Php 正在处理Firstdata全局网关API的SOAP响应,php,soap,Php,Soap,我已经阅读了这里的问题和答案 因此,我有几乎相同的东西,但一些项目的情况是不同的 我得到了错误 警告:main()[function.main]:result.php中不再存在节点 在第XX行,错误的行是response= 这是我的代码(result.php) 您能否获得实际的SOAP请求,以便验证内容和格式是否正确?可能die()或var_dump()会有助于实现这一点。结果是我得到的实际SOAP请求。我为你做了一件事。但我不确定你想要的是什么,因为请求似乎正在被发送和处理;您得到了一个似乎有
您能否获得实际的SOAP请求,以便验证内容和格式是否正确?可能die()或var_dump()会有助于实现这一点。结果是我得到的实际SOAP请求。我为你做了一件事。但我不确定你想要的是什么,因为请求似乎正在被发送和处理;您得到了一个似乎有效的回复。顺便说一句,我想result.php在解析响应方面存在问题。您提供的错误消息缺少该行或代码的其余部分,但我猜这与$obj2解析响应的行有关。
<?php
$result = "<soap-env:envelope xmlns:soap-env='http://schemas.xmlsoap.org/soap/envelope/'><soap-env:header><soap-env:body><fdggwsapi:fdggwsapiorderresponse xmlns:fdggwsapi='http://secure.linkpt.net/fdggwsapi/schemas_us/fdggwsapi'><fdggwsapi:commercialserviceprovider><fdggwsapi:transactiontime>Fri Apr 19 16:35:45 2013</fdggwsapi:transactiontime><fdggwsapi:transactionid><fdggwsapi:processorreferencenumber><fdggwsapi:processorresponsemessage><fdggwsapi:errormessage>SGS-005003: The order already exists in the database.</fdggwsapi:errormessage><fdggwsapi:orderid>25</fdggwsapi:orderid><fdggwsapi:approvalcode><fdggwsapi:avsresponse><fdggwsapi:tdate><fdggwsapi:transactionresult>DUPLICATE</fdggwsapi:transactionresult><fdggwsapi:processorresponsecode><fdggwsapi:processorapprovalcode><fdggwsapi:calculatedtax><fdggwsapi:calculatedshipping><fdggwsapi:transactionscore><fdggwsapi:fraudaction><fdggwsapi:authenticationresponsecode></fdggwsapi:authenticationresponsecode></fdggwsapi:fraudaction></fdggwsapi:transactionscore></fdggwsapi:calculatedshipping></fdggwsapi:calculatedtax></fdggwsapi:processorapprovalcode></fdggwsapi:processorresponsecode></fdggwsapi:tdate></fdggwsapi:avsresponse></fdggwsapi:approvalcode></fdggwsapi:processorresponsemessage></fdggwsapi:processorreferencenumber></fdggwsapi:transactionid></fdggwsapi:commercialserviceprovider></fdggwsapi:fdggwsapiorderresponse></soap-env:body></soap-env:header></soap-env:envelope>"
print "<br /><hr /><br />";
$response = "";
$obj2 = "";
$obj2 = simplexml_load_string($result);
$obj2->registerXPathNamespace('soap-env', 'http://schemas.xmlsoap.org/soap/envelope/');
$obj2->registerXPathNamespace('fdggwsapi','http://secure.linkpt.net/fdggwsapi/schemas_us/fdggwsapi');
$response = $obj2->children('http://schemas.xmlsoap.org/soap/envelope/')->body->children('http://secure.linkpt.net/fdggwsapi/schemas_us/fdggwsapi')->fdggwsapiorderresponse;
echo $response->transactiontime . "\n";
echo $response->errormessage;
string(1427) "<soap-env:envelope xmlns:soap-env='http://schemas.xmlsoap.org/soap/envelope/'><soap-env:header><soap-env:body><fdggwsapi:fdggwsapiorderresponse xmlns:fdggwsapi='http://secure.linkpt.net/fdggwsapi/schemas_us/fdggwsapi'><fdggwsapi:commercialserviceprovider><fdggwsapi:transactiontime>Fri Apr 19 16:35:45 2013</fdggwsapi:transactiontime><fdggwsapi:transactionid><fdggwsapi:processorreferencenumber><fdggwsapi:processorresponsemessage><fdggwsapi:errormessage>SGS-005003: The order already exists in the database.</fdggwsapi:errormessage><fdggwsapi:orderid>25</fdggwsapi:orderid><fdggwsapi:approvalcode><fdggwsapi:avsresponse><fdggwsapi:tdate><fdggwsapi:transactionresult>DUPLICATE</fdggwsapi:transactionresult><fdggwsapi:processorresponsecode><fdggwsapi:processorapprovalcode><fdggwsapi:calculatedtax><fdggwsapi:calculatedshipping><fdggwsapi:transactionscore><fdggwsapi:fraudaction><fdggwsapi:authenticationresponsecode></fdggwsapi:authenticationresponsecode></fdggwsapi:fraudaction></fdggwsapi:transactionscore></fdggwsapi:calculatedshipping></fdggwsapi:calculatedtax></fdggwsapi:processorapprovalcode></fdggwsapi:processorresponsecode></fdggwsapi:tdate></fdggwsapi:avsresponse></fdggwsapi:approvalcode></fdggwsapi:processorresponsemessage></fdggwsapi:processorreferencenumber></fdggwsapi:transactionid></fdggwsapi:commercialserviceprovider></fdggwsapi:fdggwsapiorderresponse></soap-env:body></soap-env:header></soap-env:envelope>"
<soap-env:envelope xmlns:soap-env='http://schemas.xmlsoap.org/soap/envelope/'>
<soap-env:header><soap-env:body>
<fdggwsapi:fdggwsapiorderresponse xmlns:fdggwsapi='http://secure.linkpt.net/fdggwsapi/schemas_us/fdggwsapi'>
<fdggwsapi:commercialserviceprovider>
<fdggwsapi:transactiontime>Fri Apr 19 16:35:45 2013</fdggwsapi:transactiontime>
<fdggwsapi:transactionid>
<fdggwsapi:processorreferencenumber>
<fdggwsapi:processorresponsemessage>
<fdggwsapi:errormessage>SGS-005003: The order already exists in the database.</fdggwsapi:errormessage>
<fdggwsapi:orderid>25</fdggwsapi:orderid>
<fdggwsapi:approvalcode>
<fdggwsapi:avsresponse>
<fdggwsapi:tdate>
<fdggwsapi:transactionresult>DUPLICATE</fdggwsapi:transactionresult>
<fdggwsapi:processorresponsecode>
<fdggwsapi:processorapprovalcode>
<fdggwsapi:calculatedtax>
<fdggwsapi:calculatedshipping>
<fdggwsapi:transactionscore>
<fdggwsapi:fraudaction>
<fdggwsapi:authenticationresponsecode>
</fdggwsapi:authenticationresponsecode>
</fdggwsapi:fraudaction>
</fdggwsapi:transactionscore>
</fdggwsapi:calculatedshipping>
</fdggwsapi:calculatedtax>
</fdggwsapi:processorapprovalcode>
</fdggwsapi:processorresponsecode>
</fdggwsapi:tdate>
</fdggwsapi:avsresponse>
</fdggwsapi:approvalcode>
</fdggwsapi:processorresponsemessage>
</fdggwsapi:processorreferencenumber>
</fdggwsapi:transactionid>
</fdggwsapi:commercialserviceprovider>
</fdggwsapi:fdggwsapiorderresponse>
</soap-env:body>
</soap-env:header>
</soap-env:envelope>"