0

すべて外部 Web サービスに依存する 3 つのクライアント サイトがあります。Web サービスは以前は ColdFusion サーバー上にありましたが、最近 .NET サーバーに変更されました。クライアント コードが機能しなくなり、修正できません。クライアント サイトは php 上にあり、nusoap を使用して Web サービスを呼び出します。

以前と同じように wsdl を使用して、このテストをセットアップしました。

<?php
// Call the nuSOAP library 
require_once('/home/realtywest/www/lib/nusoap.php');

// Create the client instance
$client = new soapclientnusoap('http://webservices.reiwa.com/RMHPServices/ListingsService.svc?wsdl', true);

// Check for an error
$err = $client->getError();
if ($err) {
    // Display the error
    echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
    // At this point, you know the call that follows will fail
}

// Call the SOAP method
$result = $client->call('getListingDetail', array('ListingNumber' => 3000975));

// Check for a fault
if ($client->fault) {
    echo '<h2>Fault</h2><pre>';
    print_r($result);
    echo '</pre>';
} else {
    // Check for errors
    $err = $client->getError();
    if ($err) {
        // Display the error
        echo '<h2>Error</h2><pre>' . $err . '</pre>';
    } else {
        // Display the result
        echo '<h2>Result</h2><pre>';
        print_r($result);
    echo '</pre>';
    }
}
// Display the request and response
echo '<h2>Request</h2>';
echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2>';
echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
// Display the debug messages
echo '<h2>Debug</h2>';
echo '<pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';
?>

そのスクリプトの結果はここで見ることができます: http://www.realtywest.com.au/listings/test_wsdl.php

それは内部サービス障害を返します..

私は自分の問題をグーグルで検索し、この非常に古いフォーラムの投稿を見つけました: http://www.sitepoint.com/forums/showthread.php?t=97632 そこで、.NET Web サービスの設定が異なる場合があり、それを渡さないように提案されました。 wsdlとしてのnusoap、変数の配列だけでなく、実際にリクエストを渡すために呼び出すときも..

だから私はこの方法を試しました:

<?php
// Call the nuSOAP library 
require_once('/home/realtywest/www/lib/nusoap.php');

// Create the client instance
$client = new soapclientnusoap('http://webservices.reiwa.com/RMHPServices/ListingsService.svc', false);

// Check for an error
$err = $client->getError();
if ($err) {
    // Display the error
    echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
    // At this point, you know the call that follows will fail
}

// Call the SOAP method
$result = $client->call('getListingDetail', '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
   <soapenv:Header/>
   <soapenv:Body>
      <tem:getListingDetail>
         <!--Optional:-->
         <tem:strListingNumber>3000975</tem:strListingNumber>
      </tem:getListingDetail>
   </soapenv:Body>
</soapenv:Envelope>');

// Check for a fault
if ($client->fault) {
    echo '<h2>Fault</h2><pre>';
    print_r($result);
    echo '</pre>';
} else {
    // Check for errors
    $err = $client->getError();
    if ($err) {
        // Display the error
        echo '<h2>Error</h2><pre>' . $err . '</pre>';
    } else {
        // Display the result
        echo '<h2>Result</h2><pre>';
        print_r($result);
    echo '</pre>';
    }
}
// Display the request and response
echo '<h2>Request</h2>';
echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2>';
echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
// Display the debug messages
echo '<h2>Debug</h2>';
echo '<pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';
?>

ここを参照してください: http://www.realtywest.com.au/listings/test.php 今回は Action Not supported エラーが発生します。2 番目のメッセージで送信されたリクエストは、実際に結果を取得できる SOAP UI からコピーされました。 、だから私はWebサービスが実際に機能することを知っています..

誰かがデバッグメッセージを見て、問題が何であるかを知ることができると確信しています..これについて何か助けていただければ幸いです..

4

1 に答える 1

0

エンコーディングを utf-8 に設定してみてください。nusoap のデフォルトは ISO-8859-1 です。私は php 開発者ではありませんが、しばらく前に wcf.net から php への変換を行ったことがあります。

$wsdl="http://webservices.reiwa.com/RMHPServices/ListingsService.svc?wsdl";
$client=new soapclient($wsdl, 'wsdl');
$client->soap_defencoding = 'utf-8';//default is 
$client->response_timeout = 60;//seconds

//paramaters to the webservice
$param=array('ListingNumber' => 3000975);

//the function within the service to call
$result = $client->call('getListingDetail', $param);
于 2010-12-24T05:16:06.283 に答える