你好WSO2 ESB社區,如何調用外部PHP Web服務WSO2與ESB
我在PHP中的服務。我已經通過WSDL代理調用WSO2ESB,並沒有問題。但是,當我嘗試從SOAP客戶端或WSO2ESB中內置的「嘗試此服務」調用該服務時,該服務無法調用並顯示錯誤:
org.apache.axis2.AxisFault:讀取超時
你能幫我解決什麼問題..?作爲一個說明,這是PHP服務是順利的話,當電話直接從SOAP客戶端,而不是通過WSO2ESB ..
這是我的PHP服務代碼..
**
<?php
//call library
require_once ('../nusoap/lib/nusoap.php');
// Create the server instance
$server = new soap_server();
// Initialize WSDL support
$server->configureWSDL('hellowsdl', 'urn:hellowsdl');
// Register the method to expose
$server->register('hello', // method name
array('name' => 'xsd:string'), // input parameters
array('return' => 'xsd:string'), // output parameters
'urn:hellowsdl', // namespace
'urn:hellowsdl#hello', // soapaction
'rpc', // style
'encoded', // use
'Says hello to the caller' // documentation
);
// Define the method as a PHP function
function hello($name) {
return 'Hellooo, ' . $name;
}
// Use the request to (try to) invoke the service
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
?>
**
和客戶端看起來像這樣的..
<?php
require_once ('../nusoap/lib/nusoap.php');
// Create the client instance
$wsdl="http://localhost:8280/services/HelloNuSOAP?wsdl";
$client =new nusoap_client($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('hello', array('name' => 'Scott'));
// 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>';
}
}
?>
客戶端鱈魚的部分e,
$wsdl="http://localhost:8280/services/HelloNuSOAP?wsdl";
是來自WSO2ESB的WSDL地址。 我們稱之爲「請求超時」的結果爲。
如果我們改變與在服務代碼放置取服務的服務器直接WSDL地址,讓我們說
$wsdl="http://localhost/ws/hello_serper_nusoap.php"
結果服務器將成功地調用,我們會擁有一個結果。
因此,我們可以得出WSO2ESB無法調用該PHP Web服務的結論。有沒有辦法在WSO2ESB上調用php web服務?
我們能看到你的代碼,請 – Satya
好..我已經加了我的代碼..謝謝.. –