我想将Intersystems Cache Web服务与PHP连接。我不知道如何使用肥皂标头进行这项工作。仅使用SOAP会话,我可以在CSP中设置CSP会话。谁能帮助我为此过程设置肥皂标头?否则,请使用最简单的方式解释如何从缓存和PHP连接Web服务?
预先感谢!!
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
}
}
首先:使用向导生成新的myapp.myservice.cl。请注意向导中提供的方法名称。(您的示例有两个不同的名称(test,testName)。
第二:在PHP代码中使用此信息:
//$result = $client->__soapCall("$method",array($parameters));
$result = $client->TestName($parameters);
或
$result = $client->TestName(array('Name' => 'Subash'));