信封外的XML Soap主体

时间:2019-04-02 13:36:04

标签: php xml dom

我已经看了几个小时了,真的需要另一双眼睛。我的信封是关闭的,小时候它的身体不是在根下而是在根下。这是相关的代码。

$XMLDoc = new DOMDocument('1.0', 'UTF-8');
$XMLDoc->preserveWhiteSpace = false;
$XMLDoc->formatOutput = true;

// SOAP ENVELOPE ELEMENT AND ATTRIBUTES
$soap = $XMLDoc->createElementNS('http://schemas.xmlsoap.org/soap/envelope/', 'soap12:Envelope');
$XMLDoc->appendChild($soap);

$soap->setAttributeNS('http://www.w3.org/2000/xmlns/' ,'xmlns:soap12', 'http://www.w3.org/2003/05/soap-envelope');
$soap->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
$soap->setAttributeNS('http://www.w3.org/2000/xmlns/' ,'xmlns:xsd', 'http://www.w3.org/2001/XMLSchema');


// SOAP BODY
$example_element = $XMLDoc->createElement('soap12:Body');
$rootNode = $soap->appendChild($example_element);

这是它正在生成的XML。

<?xml version="1.0" encoding="UTF-8"?>
<soap12:Envelope xmlns:soap12="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
<soap12:Body>

0 个答案:

没有答案