繁体   English   中英

似乎无法从我的SoapClient得到响应

[英]Can't seem to get a response from my SoapClient

我才刚刚开始通过php进行肥皂交流。

我可以访问一个返回true或false的Web服务,具体取决于三个属性“用户名”,“密码”和“域”

这是我的匿名请求代码:

//VARS
$username = 'example';
$password = 'example';
$domain = 'example';

$client = new SoapClient("https://www.example.com/example.wsdl");

try {
    $client->authenticate(array($email, $password, $domain));
    echo $client->__getLastResponse();
} catch (SoapFault $e) {
    echo $e->getMessage();
}

die();

现在,正如我提到的那样,我是新手,所以不确定我所写的内容是否正确,请帮忙!

以下是wsdl的相关部分(再次匿名):

//MESSAGE
<message name="AuthenticateRequest">
    <part type="xsd:string" name="username"/>
    <part type="xsd:string" name="password"/>
    <part type="xsd:string" name="domain"/>
</message>
<message name="AuthenticateResponse">
    <part type="xsd:boolean" name="authenticationResponse"/>
</message>

//OPERATION
<portType name="LDAPPortType">
    <operation name="authenticate">
        <documentation>
             Connects to the LDAP server with the parameters provided. If successful, this function then attempts to bind to the LDAP directory with the user's credentials. The function returns TRUE on success or FALSE on failure.
        </documentation>
        <input message="tns:AuthenticateRequest"/>
        <output message="tns:AuthenticateResponse"/>
    </operation>
</portType>

我错过任何重要的事情吗?
多谢您的协助,不胜感激!

我认为您将在此行中需要$username而不是$email

$client->authenticate(array($email, $password, $domain));
                             ^

还尝试将数组中的参数名称指定为:

$client->authenticate(array("username"=>$username, 
                "password"=>$password, "domain"=>$domain));

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM