0
我想用php連接Intersystems緩存web服務。我不知道如何使用肥皂標題進行這項工作。僅使用soap會話,我可以在CSP中設置csp會話。任何人都可以幫助我設置此過程的肥皂標題?或者解釋如何使用最簡單的方式從緩存和php連接Web服務?如何連接Intersystems緩存Web服務和PHP?
在此先感謝!
PHP代碼:
SoapManager.php:
<?php
class SoapManager {
function execute($webService, $method, $parameters)
{
$URL = 'http://localhost:57772/csp/user/'.$webService.'.cls?wsdl=1';
echo $URL;
//CREATE THE CLIENT INSTANCE
$client = new SoapClient($URL);
//$client = new SoapClient("http://192.168.101.202:57772/enterprise/drm$soapAddress/GHIS.$serviceName.cls?WSDL");
$result = $client->__soapCall("$method",array($parameters));
return $result;
}
}
?>
Client.php:
<?php
require_once "SoapManager.php";
$params = '';
$params = array(
'Name' => 'Subash'
);
//$getAuthDetail = nusoap("MyApp.MyService","TestName",$params);
$SoapManager = new SoapManager();
$addCommentResult = $SoapManager->execute("MyApp.MyService","TestName",$params);
$params = '';
$params = array(
);
//$getAuthDetail = nusoap("MyApp.MyService1","Test",$params);
$addCommentResult = $SoapManager->execute("MyApp.MyService1","Test",$params);
?>
MyApp.MyService.cls:
Class MyApp.MyService Extends %SOAP.WebService [ ProcedureBlock ]
{
/// Name of the WebService.
Parameter SERVICENAME = "MyService";
/// TODO: change this to actual SOAP namespace.
/// SOAP Namespace for the WebService
Parameter NAMESPACE = "http://tempuri.org";
/// Namespaces of referenced classes will be used in the WSDL.
Parameter USECLASSNAMESPACES = 1;
Parameter SOAPSESSION = 1;
//Parameter XMLIGNOREINVALIDATTRIBUTE=1;
//Parameter XMLIGNOREINVALIDTAG=1;
/// TODO: add arguments and implementation.
/// Test
Method TestName(Name As %String) As %String [ WebMethod ]
{
s ^testg=%session.SessionId
;h 10
Quit Name
}
}
請對您的問題給予更多的細節你想PHP向緩存Web服務發出請求(即PHP是客戶端,緩存是服務器)?或者相反,因爲你的問題是跨越多種語言,也許最好說出你需要哪個SOAP頭文件設置,我們可以幫助你設置這些。 –
@BrandonHorst PHP是Cli ent並且Cache是服務器。我在Cache上創建Webservices並設置參數SOAPSESSION = 1。然後只有它會返回csp會話。現在,使用PHP客戶端,我想使用SoapHeader設置Request和Get Response。等一下,我會在這裏更新一些代碼供您參考。 – ragu