PHP Classes

Extract the Token generated in the soap response: I need to parse the token and store in a variable

Recommend this page to a friend!
  All requests RSS feed  >  Extract the Token generated in the so...  >  Request new recommendation  >  A request is featured when there is no good recommended package on the site when it is posted. Featured requests  >  No recommendations No recommendations  

Extract the Token generated in the soap response

Edit

Picture of Mwape Muluwe by Mwape Muluwe - 5 months ago (2021-06-22)

I need to parse the token and store in a variable

This request is clear and relevant.
This request is not clear or is not relevant.

+1

Hi I need to parse a token only and store it in a variable to request more data.

Below is the XML:

<?xml version="1.0" encoding="UTF-8"?>

-<soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://www.w3.org/2003/05/soap-envelope">

-<soap:Header>

<WSCorIDSOAPHeader CorID="936DD7DB0AE52292006A45747E269823,1:1,0,1,SES555A100039|IIS_SISTEMASMS|WarrantyV3|WebServices|Server|http_//wws.mapfreassistance.com|login,1,AgAAAjtIQgAAAAFGAAAAAQAAABFqYXZhLnV0aWwuSGFzaE1hcAAAAAhIQgAAAAJGAAAAAgAAABBqYXZhLmxhbmcuU3RyaW5nABBBcHBNYXBDYWxsZXJIb3N0SEIAAAADRQAAAAIADVNFUzU1NUExMDAwMzlIQgAAAARFAAAAAgAQQXBwTWFwQ2FsbGVyVHlwZUhCAAAABUUAAAACAAdTZXJ2bGV0SEIAAAAGRQAAAAIAClR4blRyYWNlSWRIQgAAAAdFAAAAAgAhOTM2REQ3MzEwQUU1MjI5MjAwNkE0NTc0MTdFN0Y5QUMwSEIAAAAIRQAAAAIAEUFwcE1hcENhbGxlckFnZW50SEIAAAAJRQAAAAIACldhcnJhbnR5VjNIQgAAAApFAAAAAgAOQXBwTWFwQXBwTmFtZXNIQgAAAAtGAAAAAwAAABNqYXZhLnV0aWwuQXJyYXlMaXN0AAAAAkhCAAAADEUAAAACAAtyb290Q29udGV4dEhAAAAADEhCAAAADUUAAAACABZBcHBNYXBDYWxsZXJNZXRob2ROYW1lSEIAAAAORQAAAAIAIVN5bmNTZXNzaW9uSGFuZGxlcnxQcm9jZXNzUmVxdWVzdEhCAAAAD0UAAAACABNBcHBNYXBDYWxsZXJQcm9jZXNzSEIAAAAQRQAAAAIADklJU19TSVNURU1BU01TSEIAAAARRQAAAAIAD0NhbGxlclRpbWVzdGFtcEhCAAAAEkUAAAACAA0xNjEzMDg2MTg1NDM1" xmlns="http://www.wilytech.com/"/>

</soap:Header>

-<soap:Body>

-<loginResponse xmlns="http://wws.mapfreassistance.com/">

-<loginResult>

-<xs:schema xmlns="" id="NewDataSet" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:xs="http://www.w3.org/2001/XMLSchema">

-<xs:element msdata:UseCurrentLocale="true" msdata:MainDataTable="replay" msdata:IsDataSet="true" name="NewDataSet">

-<xs:complexType>

-<xs:choice maxOccurs="unbounded" minOccurs="0">

-<xs:element name="replay">

-<xs:complexType>

-<xs:sequence>

<xs:element name="code" minOccurs="0" type="xs:string"/>

<xs:element name="description" minOccurs="0" type="xs:string"/>

</xs:sequence>

</xs:complexType>

</xs:element>

</xs:choice>

</xs:complexType>

</xs:element>

</xs:schema>

-<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">

-<DocumentElement xmlns="">

-<replay diffgr:id="replay1" diffgr:hasChanges="inserted" msdata:rowOrder="0">

<code>OK</code>

<description><?xml version="1.0" encoding="UTF-8"?><root><token>fa2c13af-9880-46fb-a6be-eac9cf5fa41e</token><nmDealer>MADZ001 MADISON LIFE INSURANCE CO. LTD. ZAMBIA</nmDealer><idRegDealer>1108</idRegDealer><idRegGrupo>-1</idRegGrupo><idRegPuntoVenta>-1</idRegPuntoVenta><idRegUsuario>35466983</idRegUsuario><idRegVendedor>-1</idRegVendedor><idRegZona>-1</idRegZona><dsTpUsuario>CLIENTES</dsTpUsuario><dsPais>AFRICA</dsPais><idioma>EN</idioma><idRegIdioma>9</idRegIdioma><isImputar>False</isImputar><moneda>.</moneda><tpUsuario>1</tpUsuario><idRegComisionVariableDealer>-1</idRegComisionVariableDealer><permitirComisionVariableDealer>1</permitirComisionVariableDealer><firstAccess>1</firstAccess><acceptedConditions>False</acceptedConditions><idRegInsured>-1</idRegInsured><idRegAuditor>-1</idRegAuditor><paymentGetways>0</paymentGetways><esLDAP>True</esLDAP><DELAY_DEADLOCK>3</DELAY_DEADLOCK><valorCambiarioVisible>0</valorCambiarioVisible><pressetled>False</pressetled><tpAplicacionesExternas></tpAplicacionesExternas></root></description>

</replay>

</DocumentElement>

</diffgr:diffgram>

</loginResult>

</loginResponse>

</soap:Body>

</soap:Envelope>

Ask clarification

1 Recommendation

Generic XML parser class: Arbitrary XML parser.

This recommendation solves the problem.
This recommendation does not solve the problem.

0

Picture of Manuel Lemos by Manuel Lemos package author package author Reputation 21880 - 5 months ago (2021-06-29) Comment

There are some SOAP client specific classes that can parse SOAP responses. You may want to try those classes.

Anyway, if you have a specific case of a SOAP response that is not handled well by those classes, you may want to try this generic SOAP class, as it can parse any XML document with minimal amount of code.

You may also want to check this tutorial article:

https://www.phpclasses.org/blog/package/4/post/1-Processing-XML-with-a-single-PHP-call.html

If you have any difficulties with this XML parser class in handling your case, you may also ask for support in its support page:

https://www.phpclasses.org/discuss/package/4/


Recommend package
: 
: 
For more information send a message to info at phpclasses dot org.