I have an endpoint that will receive a SOAP message in request. The structure of the Soap message is as below.
<soap-env:Envelope
xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Header
xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<wsse:Security
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soap:mustunderstand="1">
<wsse:UsernameToken>
<wsse:Username>username</wsse:Username>
<wsse:Password type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#passwordtext">secret</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soap-env:Header>
<soap-env:Body
xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<OTA_HotelResNotifRQ
xmlns="http://www.opentravel.org/OTA/2003/05" Version="1.0" EchoToken="4528545b-f875-5c77-9205-22631b68f15a" ResStatus="Commit" TimeStamp="2018-07-31T01:16:16Z">
...
</OTA_HotelResNotifRQ>
</soap-env:Body>
</soap-env:Envelope>
I am trying to find a way to convert this into a array or a json.
When i am using simplexml_load_string
and json_ecode it it returns an empty array.
I am able to access to XML by registering the name spaces but is there a way to convert the above soap message into array or Json that can be accessed easily?