如何从 SOAP XML API 请求答案? [英] How to request an answer from a SOAP XML API?

查看:27
本文介绍了如何从 SOAP XML API 请求答案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以前从未使用过 SOAP XML api.

I never worked with SOAP XML api before.

我在 SO 上阅读了几个类似的问题,但我无法让它发挥作用.

I read a couple of similar questions on SO but I can't get it to work.

这是一个简单的请求:

<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/
soap-envelope">
<soap12:Body>
<CheckDomainAvailability xmlns="https://live.domainbox.net/">
<AuthenticationParameters>
<Reseller>myreseller</Reseller>
<Username>myuser</Username>
<Password>mypassword</Password>
</AuthenticationParameters>
<CommandParameters>
<DomainName>checkadomain.co</DomainName>
<LaunchPhase>GA</LaunchPhase>
</CommandParameters>
</CheckDomainAvailability>
</soap12:Body>
</soap12:Envelope>

我已经联系过他们,但他们不提供 PHP API.

I've contacted them but they do not offer a PHP API.

我想使用 PHP 内置的 SoapClient 类.

I would like to use the SoapClient class built in PHP.

问题是:如何发送请求并打印答案?

The question is: How do I send the request and print the answer?

推荐答案

看起来您的 WSDL 位于 https://live.domainbox.net/?WSDL.

Looks like your WSDL is located at https://live.domainbox.net/?WSDL.

这是一个使用原生 PHP SoapClient 的示例.

Here's an example using the native PHP SoapClient.

$client = new SoapClient('https://live.domainbox.net/?WSDL');

// populate the inputs....
$params = array(
    'AuthenticationParameters' => array(
        'Reseller' => '',
        'Username' => '',
        'Password' => ''
    ),
    'CommandParameters' => array(
        'DomainName' => '',
        'LaunchPhase' => ''
    )
);

$result = $client->CheckDomainAvailability($params);

print_r($result);

这篇关于如何从 SOAP XML API 请求答案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆