如何编辑<SOAP-ENV:Envelope />
标记的xmlns属性?
我遇到xmlns:xsi
和xmlns:xsd
缺失的情况。我想知道如何将它们添加回来?
示例:
<?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>
...
但我需要这样:
<?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>
...
答案 0 :(得分:0)
我知道这有点老了,但万一有人偶然发现它......
在摆弄SoapVar之后,这就是我的工作方式:
$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);