Re: Sacar valor de xml

[email protected] (Carlos Medina)
Newsgroups php.general.es
Organization SimplyNetworks
Message-ID <[email protected]>
Am 18.11.2010 12:41, schrieb Pablo Braulio:
> Hola a todos.
>
> Estoy probando una conexión por SOAP, y lo que necesito es sacar el
> valor del xml de la respuesta. A ver si podéis ayudarme.
>
> Os pongo el código.
>
> $xml= '<soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ecom="URL">
> <soapenv:Header/>
> <soapenv:Body>
> <ecom:addUser>
> <user_email>XXXXXXXXXX</user_email>
> <user_password>XXXXXXXX</user_password>
> <user_nombre>XXXXXXXXX</user_nombre>
> <user_apellidos>xxxxxxx</user_apellidos>
> <user_empresa>xxxxx</user_empresa>
> <user_telefono>xxxxxxxxx</user_telefono>
> </ecom:addUser>
> </soapenv:Body>
> </soapenv:Envelope>';
>
> $con= new SoapClient('URL_WEBSERVICE', array(
> 'trace'=> 1,
> 'encoding'=> 'UTF-8'
> ));
>
>
> $xmlRespuesta= $con->addUser($xml);
>
> $xmlResp= $con->__getLastResponse();
>
> $xmlRespues= new SimpleXMLElement($xmlResp);
>
> echo $xmlResp;
>
> Esto me devuelve:
>
> <?xml version='1.0' encoding='UTF-8'?><S:Envelope
> xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:addUserResponse
> xmlns:ns2="URL"><return>1</return></ns2:addUserResponse></S:Body></S:Envelope>
>
>
> ¿Como podría sacar el valor de RETURN?.
>
> He probado con $xmlRespues->xpath('return'); y no funciona.
Hola,
Prueba con una lib PHP para SOAP (NuSOAP, SOAP, Etc)

Saludos

Carlos
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.