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

发布于 2024-12-25 18:09:54 字数 1491 浏览 1 评论 0原文

我刚刚开始通过 php 进行肥皂通信。

我可以访问一个 Web 服务,该服务根据“用户名”、“密码”和“域”三个属性返回 true 或 false

这是我的匿名请求代码:

//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>

我错过了什么重要的事情吗?
感谢您的帮助,非常感谢!

I'm just getting started with soap communication through php.

I have access to a webservice that returns a true or false dependant on three attributes 'username', 'password' and 'domain'

Here's my anonymised request code:

//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();

Now, as I mentioned, I'm new to this so I'm not sure that what I've written is even correct, please help!

Here are the relevant parts of the wsdl (again, anonymised):

//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>

Have I missed anything crucial?
Thanks for your help, it's greatly appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

淡忘如思 2025-01-01 18:09:57

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

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

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

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

I think you are going to need $username instead of $email in this line

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

Also try to specify parameter names in array as:

$client->authenticate(array("username"=>$username, 
                "password"=>$password, "domain"=>$domain));
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文