簡體   English   中英

在PHP中創建SOAP請求

[英]Create SOAP request IN PHP

我在發布與SOAP相關的問題 如何使用PHP創建任意SOAP請求?

我用下面的代碼。但沒有反應。

<?php
$client = new SoapClient('http://www.example.com/services/RecipeCouponAPI11.asmx?wsdl');
$header = new SoapHeader(
    'http://www.example.com/services/',
    'RCAuthenticator',
    array(
        'UserName' => 'username',
        'Password' => 'password'
    )
);

$client->__setSoapHeaders($header);

$response = $client->GetCouponAll(array('campaignCode' => ''));
print_r($response);
?>
POST /cool/update.asmx HTTP/1.1
Host: www.example.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://www.example.com/COOL/Update/ProductUpdate"

<?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>
    <ProductUpdate xmlns="http://www.example.com/COOL/Update">
      <CustomerNumber>12345</CustomerNumber>
      <UserName>12345</UserName>
      <Password>12345</Password>
      <Source>string</Source>
    </ProductUpdate>
  </soap:Body>
</soap:Envelope>

找到解決方案。我使用了錯誤的功能。 這將是

$response = $client->ProductUpdate(array('campaignCode' => ''));

代替

$response = $client->GetCouponAll(array('campaignCode' => ''));

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM