1

Fedex Web サービスを利用するクラスを作成しています。wsdl ファイルを渡して、nusoap php クラスの nosoapclient() 関数を介して通信しようとしています。Fedex では、リクエストのドキュメント ルートに名前空間属性が必要なようです。

nusoap の call() 関数を使用して、適切に機能する PARAMETER 引数として XML 文字列を渡すことができます。むしろ配列を PARAMETER 引数として渡したいのですが、ここで問題が発生しています。

nusoap の call() 関数を介して配列を渡し、ルートに名前空間属性を含めることは可能ですか?

FEDEX RateRequest PHP exerpt
以下は、実際のコードではなく、私がやろうとしていることを理解するためのものです

$client = new nusoapclient('RateRequest_v9.wsdl',true);
//Thought this would work but to no avail.
//$request_array is a multi-associative array with keys as required XML tag names and values as the tags inner value, did not include as it is irrelevant to this problem
//$root_attr = array('xmlns'=>'http://fedex.com/ws/rate/v9');
//$parameters = array('RateRequest'=>new soapval('RateRequest',false,$request_array,false,false,$root_attr));

$parameters = array('RateRequest'=>$request_array);

//Have tried with and without the third argument - which is the for the namespace
$response = $client->call('getRates',$parameters,'http://fedex.com/ws/rate/v9');

FEDEX RateRequest XML の抜粋
以下は完全な XML ではありません (末尾の RateRequest タグを見て違いを確認してください)。

フォーマットが正しくありません

<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns="http://fedex.com/ws/rate/v9"><SOAP-ENV:Body><RateRequest>...</RateRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>

正しいフォーマット

<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns="http://fedex.com/ws/rate/v9"><SOAP-ENV:Body><RateRequest xmlns="http://fedex.com/ws/rate/v9">...</RateRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>

他の場所でこの会話を逃した場合は事前にお詫びしますが、ネットを精査し、それを機能させるために考えられるすべてのことを試してきました。よろしくお願いいたします。

4

0 に答える 0