3
我不知道如何把这个,但我本来是要发送带有以下格式的SOAP请求:是否在SOAP请求NS1和TEM的不匹配影响的要求?
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tem="http://tempuri.org/">
<soapenv:Header/>
<soapenv:Body>
<tem:RequestTopup>
<tem:sClientUserName>?</tem:sClientUserName>
<tem:sClientPassword>?</tem:sClientPassword>
<tem:sClientTxID>?</tem:sClientTxID>
<tem:sProductID>?</tem:sProductID>
<tem:dProductPrice>?</tem:dProductPrice>
<tem:sCustomerAccountNumber>?</tem:sCustomerAccountNumber>
<tem:sCustomerMobileNumber>?</tem:sCustomerMobileNumber>
<tem:sEncKey>?</tem:sEncKey>
</tem:RequestTopup>
</soapenv:Body>
</soapenv:Envelope>
我的PHP代码是象下面这样:
$opts = array(
'ssl' => array('ciphers' => 'RC4-SHA', 'verify_peer' => false, 'verify_peer_name' => false)
);
$params = array(
'encoding' => 'UTF-8',
'verifypeer' => false,
'verifyhost' => false,
'trace' => 1, 'exceptions' => 1,
"connection_timeout" => 180,
'stream_context' => stream_context_create($opts)
);
$client = new SoapClient("http://xmpl/connect.asmx?WSDL", $params);
$txn_id = "2017021234567";
$result = $client->RequestTopup(
array(
'sClientUserName' => '6',
'sClientPassword' => '123456789',
'sProductID' => '1',
'dProductPrice' => '10',
'sClientTxID' => $txn_id,
'sCustomerAccountNumber' => '60166527234',
'sCustomerMobileNumber' => '60166527234',
'sEncKey' => 'sample_enc',
)
);
echo $client->__getLastRequest();
现在的问题这是否会生成正确格式的xml,但会将“tem”替换为“ns1”。我很抱歉地说,但我甚至不知道这两者之间的区别和谷歌搜索没有多大帮助。
这会不会使任何区别,如果我要求与“NS1”的XML?或者我应该改变它为“tem”,因为客户端期望它?请帮忙。
非常感谢..你让一切变得清晰..然而,有没有什么办法,用tem替换那些ns1? –
你将不得不重新创建XML节点。我在FluentDOM中实现了一个可用于执行此操作的优化器:https://github.com/FluentDOM/FluentDOM/blob/master/examples/Transformer/Namespaces/optimize.php – ThW