Php SOAP请求中ns1和tem的不匹配是否会影响请求?

Php SOAP请求中ns1和tem的不匹配是否会影响请求?,php,xml,soap,soap-client,Php,Xml,Soap,Soap Client,我不知道该怎么说,但我应该用以下格式发送SOAP请求: ? ? ? ? ? ? ? ? 我的php代码如下所示: $opts = array( 'ssl' => array('ciphers' => 'RC4-SHA', 'verify_peer' => false, 'verify_peer_name' => false) ); $params = array( 'encoding' => 'UTF-8', 'verifypeer'

我不知道该怎么说,但我应该用以下格式发送SOAP请求:


?
?
?
?
?
?
?
?
我的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' => '60123456789',
        '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”吗?请帮忙。

不应该。命名空间前缀仅引用实际命名空间(
xmlns:
命名空间定义节点中的值)。前缀对于元素节点是可选的,可以在每个元素节点上更改。因此
tem:requesttoup
实际上应理解为
{http://tempuri.org/}RequestTopup
。下面是3个示例,它们都解析为命名空间
http://tempuri.org/
使用本地名称
RequestTopup


然而,我看到了比我希望的更多的错误实现。它们通常依赖于特定的名称空间前缀,而忽略实际的名称空间。

非常感谢。。你把一切都说清楚了。。但是,有没有办法用tem替换这些ns1?您必须重新创建XML节点。我在FluentDOM中实现了一个优化器,可用于执行以下操作: