私はこれを配置する方法を知りませんが、私は次の書式で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"に変更する必要がありますか?助けてください。
ありがとうございました。あなたはすべてをクリアにしました。しかし、ns1をtemに置き換える方法はありますか? –
XMLノードを再作成する必要があります。 FluentDOMにオプティマイザを実装しました。これを使用して、これを行うことができます:https://github.com/FluentDOM/FluentDOM/blob/master/examples/Transformer/Namespaces/optimize.php – ThW