2016-07-29 2 views
0

지난 16 시간 동안이 요청에서 XML SOAP 응답을 구문 분석 할 수없는 이유를 알아 내려고 노력했습니다. 나는 해결책을 찾기 위해 노력하는 stackoverflow 너머로 여행을했고 옳은 대답을 찾을 수없는 것처럼 보였다.PHP CURL SOAP XML 구문 분석 네임 스페이스 경고

나는 핵심 포인트가 누락 된 것으로 알고 있지만, 찾지 못하는 것 같습니다. 내가

// converting 
$response1 = str_replace('<RegisterMarketResult xmlns:a="http://schemas.datacontract.org/2004/07/Synectic.TheMarket.Domain.Services" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">',"",$r); 
$response2 = str_replace("</RegisterMarketResult>","",$response1); 

내가 얻을

// converting 
$response1 = str_replace("<s:Body>","",$r); 
$response2 = str_replace("</s:Body>","",$response1); 

에 변경하는 경우에는 나에게

SimpleXMLElement Object ([RegisterMarketResponse] => SimpleXMLElement Object ([RegisterMarketResult] => SimpleXMLElement Object ())) 

의 응답을 제공

//Response From Server 
    $r = '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><RegisterMarketResponse xmlns="http://tempuri.org/"><RegisterMarketResult xmlns:a="http://schemas.datacontract.org/2004/07/Synectic.TheMarket.Domain.Services" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><a:Cabinets xmlns:b="http://schemas.datacontract.org/2004/07/Synectic.TheMarket.Domain"><b:Cabinet><b:AssetId>1</b:AssetId><b:AssetNumber>001</b:AssetNumber><b:Model>*****</b:Model><b:ModelCategory>Snack</b:ModelCategory><b:Products>2</b:Products></b:Cabinet></a:Cabinets><a:CompanyId>{*****}</a:CompanyId><a:CompanyName>****</a:CompanyName><a:DateCreated>2016-07-16T07:55:15.84</a:DateCreated><a:Id>1</a:Id><a:MarketNumber>****</a:MarketNumber></RegisterMarketResult></RegisterMarketResponse></s:Body></s:Envelope>'; 

// converting 
$response1 = str_replace("<s:Body>","",$r); 
$response2 = str_replace("</s:Body>","",$response1); 

// convertingc to XML 
$parser = simplexml_load_string($response2); 
print_r($parser); 

Warning: simplexml_load_string(): namespace error : Namespace prefix a on Cabinets is not defined in /Applications/XAMPP/xamppfiles/htdocs/untitled/index.php on line 66 

Warning: simplexml_load_string(): nets xmlns:b="http://schemas.datacontract.org/2004/07/Synectic.TheMarket.Domain" in /Applications/XAMPP/xamppfiles/htdocs/untitled/index.php on line 66 

Warning: simplexml_load_string():^in /Applications/XAMPP/xamppfiles/htdocs/untitled/index.php on line 66 

Warning: simplexml_load_string(): namespace error : Namespace prefix a on CompanyId is not defined in /Applications/XAMPP/xamppfiles/htdocs/untitled/index.php on line 66 

Warning: simplexml_load_string(): /b:ModelCategory><b:Products>2</b:Products></b:Cabinet></a:Cabinets><a:CompanyId in /Applications/XAMPP/xamppfiles/htdocs/untitled/index.php on line 66 

Warning: simplexml_load_string():^in /Applications/XAMPP/xamppfiles/htdocs/untitled/index.php on line 66 

Warning: simplexml_load_string(): namespace error : Namespace prefix a on CompanyName is not defined in /Applications/XAMPP/xamppfiles/htdocs/untitled/index.php on line 66 

Warning: simplexml_load_string(): ><a:CompanyId>{*****}</a:CompanyId><a:CompanyName in /Applications/XAMPP/xamppfiles/htdocs/untitled/index.php on line 66 

Warning: simplexml_load_string():^in /Applications/XAMPP/xamppfiles/htdocs/untitled/index.php on line 66 

Warning: simplexml_load_string(): namespace error : Namespace prefix a on DateCreated is not defined in /Applications/XAMPP/xamppfiles/htdocs/untitled/index.php on line 66 

Warning: simplexml_load_string(): ****}</a:CompanyId><a:CompanyName>**</a:CompanyName><a:DateCreated in /Applications/XAMPP/xamppfiles/htdocs/untitled/index.php on line 66 

Warning: simplexml_load_string():^in /Applications/XAMPP/xamppfiles/htdocs/untitled/index.php on line 66 

Warning: simplexml_load_string(): namespace error : Namespace prefix a on Id is not defined in /Applications/XAMPP/xamppfiles/htdocs/untitled/index.php on line 66 

Warning: simplexml_load_string(): e>**</a:CompanyName><a:DateCreated>2016-07-16T07:55:15.84</a:DateCreated><a:Id in /Applications/XAMPP/xamppfiles/htdocs/untitled/index.php on line 66 

Warning: simplexml_load_string():^in /Applications/XAMPP/xamppfiles/htdocs/untitled/index.php on line 66 

Warning: simplexml_load_string(): namespace error : Namespace prefix a on MarketNumber is not defined in /Applications/XAMPP/xamppfiles/htdocs/untitled/index.php on line 66 

Warning: simplexml_load_string(): :DateCreated>2016-07-16T07:55:15.84</a:DateCreated><a:Id>1</a:Id><a:MarketNumber in /Applications/XAMPP/xamppfiles/htdocs/untitled/index.php on line 66 

Warning: simplexml_load_string():^in /Applications/XAMPP/xamppfiles/htdocs/untitled/index.php on line 66 
object(SimpleXMLElement)#1 (0) { } 

올바른 방향으로 보이지만 여전히 부러진 것 같습니다.

누구나 구문 분석에 도움을 줄 수 있습니까?

답변