2

How can I edit the xmlns attributes of the <SOAP-ENV:Envelope /> tag?

I have a situation where xmlns:xsi and xmlns:xsd are missing. I'd like to know how to add them back in?

Example:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope 
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:ns1="http://fedex.com/ws/track/v12">
    <SOAP-ENV:Body>
        <ns1:TrackRequest>
            ...

But I need it be this:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope 
 xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
 xmlns:ns1="http://fedex.com/ws/track/v12" 
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <SOAP-ENV:Body>
        <ns1:TrackRequest>
          ...
Maxwell975
  • 21
  • 2

1 Answers1

0

I know this is kinda old, but in case someone stumbles upon it...

After fiddling around with SoapVar, this is how it worked for me:

$params[] = new SoapVar('',XSD_ANYXML, '', null, 'Envelope', 'http://www.w3.org/2001/XMLSchema');
$params[] = new SoapVar('',XSD_ANYXML, '', null, 'Envelope', 'http://www.w3.org/2001/XMLSchema-instance');
//you can add more vars here.
//E.g. in my case I also needed $params[] = new SoapVar('<notifications xmlns="http://soap.sforce.com/2005/09/outbound"><Ack>true</Ack></notifications>',XSD_ANYXML); as I was working with salesforces soap.
return new SoapVar($params, XSD_ANYXML);
Ser.Corum
  • 35
  • 1
  • 9