저는 PHP에서 .NET으로 작성된 WebService 읽기 통합 작업을하고 있습니다.PHP SOAP WebService 지원
PHP Parse SOAP XML response from SOAP Client
나는 당신의 지원에 매우 감사하게 될 것입니다 : 나는 솔루션은 여기에 설명하지만 나를 위해 일하지 않았습니다 발견했다.
편집 :이 코드는 이미 내가 당신의 처리에 넣어 아래 내가 작업 한 https://stackoverflow.com/users/1987598/mathias-m%C3%BCller 마티아스 뮐러
코드 덕분에 수정했습니다
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$wsdl = 'http://www.wsplaces.com/Xofigo/wsAppXofigo.asmx?WSDL';
$trace = true;
$exceptions = false;
$data = array(
'IdEdo' => '9'
);
$client = new SoapClient($wsdl, array('trace' => $trace, 'exceptions' => $exceptions));
$response = $client->__soapCall("Get_PlacesByEdo", array($data));
echo"<pre>";
print_r($client);
echo"</pre>";
echo"<pre>";
print_r($client->__last_response);
echo"</pre>";
$lastResponse='<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><Get_PlacesByEdoResponse xmlns="http://www.tempuri.org/"><Get_PlacesByEdoResult><IdEdo/></Get_PlacesByEdoResult></Get_PlacesByEdoResponse></soap:Body></soap:Envelope>';
$xml = new SimpleXMLElement($lastResponse);
$xml->registerXPathNamespace('xsi', 'http://www.w3.org/2001/XMLSchema-instance');
$xml->registerXPathNamespace('xsd', 'http://www.w3.org/2001/XMLSchema');
$xml->registerXPathNamespace('soap', 'http://schemas.xmlsoap.org/soap/envelope/');
$xml->registerXPathNamespace('xml', 'http://www.w3.org/XML/1998/namespace');
$xml->registerXPathNamespace('a', 'http://www.tempuri.org/');
$xpath ='/soap:Envelope/soap:Body/a:Get_PlacesByEdoResponse/a:Get_PlacesByEdoResult/a:IdEdo/text()';
$result = $xml->xpath($xpath);
if ($result != FALSE && count($result) > 0) {
echo '{"reference": "' . $result[0] . '", "success":"true"}';
} else {
echo '{"error": "si", "success":"false"}';
}
?>
작성한 내용에 어떤 문제가 있습니까? 어떤 오류가 발생하고 있습니까? 위의 코드로 인해 예기치 않은 동작이 발생했습니다> –