ウェブページを外部APIに接続するコードを記述しようとしています。私はその後、(少しこれに変えSOAP request in PHP with CURL:ここに役立つStackOverflowのユーザーが作成したいくつかのサンプルコードを使用してSOAPとphpを使用してAPIに接続する "バージョンの不一致"エラー
<soap:Envelope xmlns:soap="https://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="https://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetNote>
<Request>
<Security>
<Username>username</Username>
<Password>password</Password>
</Security>
<NoteID>noteID</NoteID>
</Request>
</GetNote>
</soap:Body>
</soap:Envelope>
:APIのドキュメントは、要求は次のようになりますSOAPエンベロープ、で行われるべきであることを私に伝えます編集済み)PHP:
<?php
$soapUrl = 'https://www.blah.com/DoodadService.cfc?wsdl';
$xml_post_string = '<soap:Envelope xmlns:soap="https://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="https://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetNote>
<Request>
<Security>
<Username>'.$soapUser.'</Username>
<Password>'.$soapPassword.'</Password>
</Security>
<NoteID>'.$soapNoteID.'</NoteID>
</Request>
</GetNote>
</soap:Body>
</soap:Envelope>';
$headers = array(
"Content-type: text/xml;charset=\"utf-8\"",
"Accept: text/xml",
"Cache-Control: no-cache",
"Pragma: no-cache",
"SOAPAction: https://www.blah.com/DoodadService.cfc?wsdl",
"Content-length: ".strlen($xml_post_string),
);
$url = $soapUrl;
$ch = curl_init();
echo('set curl<br>');
$f = fopen('request.txt','w');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, $soapUser.":".$soapPassword);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_VERBOSE,true);
curl_setopt($ch, CURLOPT_STDERR, $f);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_post_string); // the SOAP request
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
echo('about to execute<br>');
// converting
$response = curl_exec($ch);
fclose($f);
echo('Got '.strlen($response).' characters in response<br>');
curl_close($ch);
echo('Saved error strings to request.txt<br> ');
?>
結果は、バージョンの不一致エラーだった、すなわち:
<soapenv:Fault>
<faultcode>
soapenv:VersionMismatch</faultcode>
<faultstring>
Version Mismatch</faultstring>
<detail>
<ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">
ip-10-4-4-149</ns1:hostname>
</detail>
</soapenv:Fault>
誰が何このエラーメートル教えてもらえますeans、何が「ミスマッチ」なのか、そしてどうすればそれを解決できるのでしょうか?
ありがとうございます!
ウェブサービスからのエラーです。ヘッダーには、定義されていないパラメータ、またはwromg形式のパラメータが必要です。その措置のサービスマニュアルにアクセスできますか? –
いいえ、「これは石鹸の封筒のようです」と「これはサービスのURLです」は現時点で利用可能な情報の合計です。私はAPIプロバイダにクエリを送信しましたが、私は少なくとも2,3日(そしてクリスマスには、誰が知っていますか)の応答を期待していませんので、明らかな欠陥がないか_一般的に石鹸について知っている人 –