2012-02-13 51 views
3

我想實現一個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調用?你能否使用上面的示例請求格式提供有效的代碼示例?

回答

5

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

1

多德只使用模塊服務3它包含了所有你需要的。你會做一個(REST,XMLRPC,JSON,JSON-RPC,SOAP,AMF)調用也爲了在drupal中做到這一點,務必你也必須安裝肥皂服務器到Drupal ...

按照此鏈接知道更多關於服務模塊。

http://drupal.org/project/services

這一個的Drupal驚人模塊