[ create a new paste ] login | about

Link: http://codepad.org/1F6K1g0r    [ raw code | output | fork ]

PHP, pasted on Jun 26:
<?php

$myRequest = <<<XML
<SOAPENV:Envelope xmlns:SOAPENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:NS="http://xyz.gov/headerschema" >
   <SOAPENV:Header>
      <NS:myHeader>
         <NS:SourceID>223423</NS:SourceID>
      </NS:myHeader>
   </SOAPENV:Header>
</SOAPENV:Envelope>
XML;

$soapNsUri = 'http://schemas.xmlsoap.org/soap/envelope/';
$myNsUri = 'http://xyz.gov/headerschema';
    
$doc = new DOMDocument;
$doc->loadXML($myRequest);
    
$header = $doc->getElementsByTagNameNS($soapNsUri, 'Header')->item(0);
$myHeader = $header->getElementsByTagNameNS($myNsUri, 'myHeader')->item(0);
$sourceID = $myHeader->getElementsByTagNameNS($myNsUri, 'SourceID')->item(0);
    
echo $sourceID->firstChild->data;


Output:
1
223423


Create a new paste based on this one


Comments: