Hi i'm trying to get the element name from these soap message so as to determine what action to be taken however i get Body in this case accountInformationRequest is what I'm after .I am getting multiple requests on a single URL thus need to get the element name.These is what i have tried
$xml=simplexml_load_string($content);
$xml->registerXPathNamespace('env', 'http://ift.tt/sVJIaE');
$xml->registerXPathNamespace('ns', 'http://ift.tt/21JxpRO');
$xml->registerXPathNamespace('ns1', 'http://ift.tt/1oUyrJ3');
$xml->registerXPathNamespace('ns2', 'http://ift.tt/21JxpRQ');
$xml->registerXPathNamespace('ns3', 'http://ift.tt/1oUyrZi');
$bodies = $xml->xpath('env:Body');
foreach($bodies as $body){
echo $body->getName();
$reply = $body->children('ns', TRUE)->accountInformationRequest;
}
//Soap message
<soapenv:Envelope
xmlns:soapenv="http://ift.tt/sVJIaE"
xmlns:ns="http://ift.tt/21JxpRO"
xmlns:ns1="http://ift.tt/1oUyrJ3"
xmlns:ns2="http://ift.tt/21JxpRQ"
xmlns:ns3="http://ift.tt/1oUyrZi">
<soapenv:Header/>
<soapenv:Body>
<ns:accountInformationRequest>
<ns:security>
<ns1:login>sam</ns1:login>
<ns1:password>lin</ns1:password>
</ns:security>
<ns:hsTransactionId>001</ns:hsTransactionId>
<ns:destinationUri>003</ns:destinationUri>
<!--Optional:-->
<ns:routingTag>B2B</ns:routingTag>
<!--Optional:-->
<ns2:vendorSpecificFields>
<!--Zero or more repetitions:-->
<ns3:vsf>
<ns3:vendorId>10</ns3:vendorId>
<ns3:fieldId>22</ns3:fieldId>
<ns3:value>2</ns3:value>
</ns3:vsf>
</ns2:vendorSpecificFields>
</ns:accountInformationRequest>
</soapenv:Body>
</soapenv:Envelope>
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1TuY00u
via IFTTT
Aucun commentaire:
Enregistrer un commentaire