api - 在 Drupal 中发出 SOAP 请求?

标签 api drupal soap drupal-6 nusoap

我正在尝试使用 Drupal 6 实现以下格式的 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

关于api - 在 Drupal 中发出 SOAP 请求?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9255274/

相关文章:

javascript - 使用React Router从url获取参数值

php - 在 php 中发送 SOAP 身份验证 header 的问题

web-services - Web 服务中序列化的成本

Drupal 7 次浏览 : Combine exposed filter with contextual filter?

drupal - 在 Bluemix 中的环境之间迁移 API Connect Developer Portal

java - RPC/文档编码真实示例

php - 如何在 PHP 中使用 Mojang API

API key 约定

windows - 如何创建具有独特 GUI(如 Valve 的 Steam)的应用程序?

drupal - 在 Drupal 6 中为用户保存额外数据的最佳方法