2013-08-02 1 views
0

나는 이것에 대한 견고한 작동 대답을 찾지 못했습니다.PHP에서 간단한 SOAP XML 응답 읽기

저는 SOAP에서도 처음이지만, PHP에 익숙합니다.

나는 CURL 내 SOAP 요청을 보내고 내 대답은 다음과 같이 다시 온다 :

<?xml version="1.0" encoding="utf-8"?> 
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
<soap:Body> 
<GetFeatureResponse xmlns="http://www.supportsite.com/webservices/"> 
    <GetFeatureResult>**string**</GetFeatureResult> 
</GetFeatureResponse> 
</soap:Body> 
</soap:Envelope> 

내가 저장해야합니다 -는 XML없이 MySQL 데이터베이스에> GetFeatureResult '문자열을'. 내가 시도한 모든 것은 공백으로 돌아 간다. 여기에 제가 지금 사용하고있는 것이 있습니다 :

$result = curl_exec($curl); 
curl_close ($curl); 

$resultXML = simplexml_load_string($result); 


$item = $resultXML->GetFeatureResponse->GetFeatureResult; 
+0

가능한 중복의 : http://stackoverflow.com/questions/12485162/simplexml-load-string-will-not- read-soap-in-the-tags with – vee

+0

중복되지 않음 - 특정 문제에 대한 해결책을 찾고있었습니다 ... 해당 질문은 모호하고 목표를 제시하지 않습니다. 그러므로 내가받은 대답은 내 문제에서 훨씬 더 도움이되었다. – Clandestine8

답변

1

PHP는 soap client을 내장하고 있습니다. 훨씬 쉽습니다. 적절한 WSDL 파일을 가리키면 사용 가능한 PHP 객체를 반환합니다.

편집 : 파고까지 내가 주위했다 예를 들어 ...

$sc = new SoapClient($wsdl, array(
    'location' => "https://$host:$port/path/", 
    'login' => $user, 
    'password' => $pass 
)); 

    //$sc will now contain methods (maybe properties too) defined by the WSDL file 
    //Getting the info you need could be as easy as 
    $info = $sc->getInfo(array('parameter'=>'value')); 
+0

그런 다음 $ Info = $ info-> GetInfoResult; 변수를 설정합니다. – Clandestine8

+0

감사합니다 !! 나는 그것을 작동 시켰어. – Clandestine8