2

I tried the solutions of How to parse this SOAP XML response with PHP simplexml_load_string?, but it doesn't work.

Maybe someone have an idea to how to parse this Soap XML result, you find the soap.xml and result and the test

Soap.xml

<?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" ...> <wsdl:documentation>soapExemple</wsdl:documentation> <wsdl:types> <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://.../xsd"> ... 

Output:

<?php ini_set("soap.wsdl_cache_enabled", "0"); const USER = "userHere"; const PASSWORD = "passHere"; $credentials = array('login' => USER, 'password' => PASSWORD); $options = array("trace" => 1, "exception" => 0, 'encoding' => 'UTF-8'); $url = "pass/to/wsdl.xml"; $soap = new SoapClient($url, $credentials); var_dump($soap); try { $result = $soap->__soapCall("reclis_XML", array("parameters"=>array("args0"=>array("METHODHERE" => "01")))); var_dump($result); } catch (SoapFault $exception) { \Zend_Debug::dump( 'Exception Thrown: '.$exception->faultstring); } ?> 

Result:

object(stdClass)#6591 (1) { ["return"] => string(39171) "<?xml version="1.0" encoding="UTF-8"?> <RECLIS> <RESULT>KO</RESULT> <REAL>0</REAL> <RUS> <REAL>0</REAL> <CUSTOMER> <CLEMAJ></CLEMAJ> <NAME></NAME> <LASTNALE>0</LASTNALE> <PHONE>0</PHONE> <AD></AD> <ADDRESS1></ADDRESS1> <ADDRESS2></ADDRESS2> <CITY></CITY> <CODE></CODE> <PRICE>0</PRICE> </CUSTOMER> <CUSTOMER> <CLEMAJ></CLEMAJ> <NAME></NAME> <LASTNALE>0</LASTNALE> <PHONE>0</PHONE> <AD></AD> <ADDRESS1></ADDRESS1> <ADDRESS2></ADDRESS2> <CITY></CITY> <CODE></CODE> <PRICE>0</PRICE> </CUSTOMER> <CUSTOMER> <CLEMAJ></CLEMAJ> <NAME></NAME> <LASTNALE>0</LASTNALE> <PHONE>0</PHONE> <AD></AD> <ADDRESS1></ADDRESS1> <ADDRESS2></ADDRESS2> <CITY></CITY> <CODE></CODE> <PRICE>0</PRICE> </CUSTOMER> ... </RUS> </RECLIS> " } 

I tried this but it doesn't work:

$xml=simplexml_load_string($myXMLData) or die("Error: Cannot create object"); print_r($xml); 

Have you an idea or another solution to get my xml result as an array

2
  • 1
    Try simplexml_load_string($myXMLData->return) Commented Nov 5, 2018 at 10:54
  • Yes, it's better now Commented Nov 5, 2018 at 11:10

1 Answer 1

1

You have to get the string by accessing the return property

Try using:

$xml=simplexml_load_string($myXMLData->return) or die("Error: Cannot create object"); print_r($xml); 
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, I have my object now !

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.