在Drupal中发出SOAP请求?
问题描述:
我想实现一个SOAP调用使用Drupal 6格式如下:在Drupal中发出SOAP请求?
POST /0_5/ClassService.asmx HTTP/1.1
Host: api.mindbodyonline.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://clients.mindbodyonline.com/api/0_5/AddClientsToClasses"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<AddClientsToClasses xmlns="http://clients.mindbodyonline.com/api/0_5">
<Request>
<ClientIDs>
<string>string</string>
<string>string</string>
</ClientIDs>
<ClassIDs>
<int>int</int>
<int>int</int>
</ClassIDs>
<Test>boolean</Test>
<RequirePayment>boolean</RequirePayment>
</Request>
</AddClientsToClasses>
</soap:Body>
</soap:Envelope>
我是新来的SOAP和所有的web文档的Drupal不起作用。另外,我必须在SOAP中进行此调用(而不是HTTP GET或POST)。
如何在Drupal中进行SOAP调用?你能否使用上面的示例请求格式提供有效的代码示例?
答
Drupal没有任何特定的soap功能 - 您可以使用内置的PHP客户端。应该有一个WSDL文件可以用来生成你的soap客户端。事情是这样的:
<?php
$client = new SoapClient("http://localhost/code/soap.wsdl");
$something = $client->HelloWorld(array());
echo $something->HelloWorldResult;
die();
参考PHP的标准文档http://php.net/manual/en/book.soap.php
答
多德只使用模块服务3它包含了所有你需要的。你会做一个(REST,XMLRPC,JSON,JSON-RPC,SOAP,AMF)调用也为了在drupal中做到这一点,务必你也必须安装肥皂服务器到Drupal ...
按照此链接知道更多关于服务模块。
http://drupal.org/project/services
这一个的Drupal惊人模块