Php 使用CURL的soapapi

Php 使用CURL的soapapi,php,api,curl,Php,Api,Curl,我正在尝试使用Ezidebit的soap api获取列表中的所有客户。他们对我的记录非常混乱,似乎遗漏了一些东西。也可能是我没有足够的技能 文件如下: 我得到的当前响应是: a:ActionNotSupportedThe message with Action 'run' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be beca

我正在尝试使用Ezidebit的soap api获取列表中的所有客户。他们对我的记录非常混乱,似乎遗漏了一些东西。也可能是我没有足够的技能

文件如下:

我得到的当前响应是:

a:ActionNotSupportedThe message with Action 'run' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).
这是我的代码:(我删除了xml中的密钥并替换为000000000000000)


我可以看到错误是指“SOAPAction:\“run\”的标题,但是我不确定我应该用什么来代替它


希望有人能帮助我。

如果您不知道如何使用本机PHP SoapClient类(这是在PHP中使用SOAP的最佳方式),那么请使用WSDL-to-PHP生成器,它将所有内容封装在结构化类中,这样您就不会怀疑您是否在任何地方做错了。如果有错误,您将准确地识别它。除了项目,我不能提出任何其他建议

尝试将SOAPAction标题更改为

“行动: \“\”

在该服务的WSDL中,您可以找到

<wsdl:operation name="GetCustomerList"><wsdl:input wsaw:Action="https://px.ezidebit.com.au/INonPCIService/GetCustomerList"

为什么不使用PHP soap api呢?我从来都不了解它:(我试过几次,但从来没有认真考虑过。你可以更努力地尝试,我也建议你仔细阅读PHP错误消息。谢谢你,Kokin:)工作得很好。就像你说的那样错过了肥皂剧表演;)不客气。但我想再次介绍一下PHP soap api。至少它允许你做更少的手工工作:)
<wsdl:operation name="GetCustomerList"><wsdl:input wsaw:Action="https://px.ezidebit.com.au/INonPCIService/GetCustomerList"
$soap_request ='<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:px="https://px.ezidebit.com.au/">
               <soapenv:Header/>
               <soapenv:Body>
                  <px:GetCustomerList>
                  <px:DigitalKey>000000000000000</px:DigitalKey>
                     <px:CustomerStatus>ALL</px:CustomerStatus>
                     <px:OrderBy>EzidebitCustomerID</px:OrderBy>
                     <px:Order>ASC</px:Order>
                     <px:PageNumber>1</px:PageNumber> 
                  </px:GetCustomerList>
               </soapenv:Body>
            </soapenv:Envelope>';

    $header = array(
        "Content-type: text/xml;charset=\"utf-8\"",
        "Accept: text/xml",
        "Cache-Control: no-cache",
        "Pragma: no-cache",
        "SOAPAction: \"https://px.ezidebit.com.au/INonPCIService/GetCustomerList\"",
        "Content-length: ".strlen($soap_request),
    );

    $soap_do = curl_init();
    curl_setopt($soap_do, CURLOPT_URL, "https://api.ezidebit.com.au/v3-5/nonpci" );
    curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 10);
    curl_setopt($soap_do, CURLOPT_TIMEOUT,        10);
    curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true );
    curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false);

    curl_setopt($soap_do, CURLOPT_POST,           true );
    curl_setopt($soap_do, CURLOPT_POSTFIELDS,     $soap_request);
    curl_setopt($soap_do, CURLOPT_HTTPHEADER,     $header);
    $content  = curl_exec($soap_do);
    if(curl_exec($soap_do) === false) {
        $err = 'Curl error: ' . curl_error($soap_do);
        curl_close($soap_do);
        print $err;
    } else {
        curl_close($soap_do);
        print_r($content);
    }
$wsdl = 'https://api.demo.ezidebit.com.au/v3-5/nonpci?wsdl';
    $client = new SoapClient($wsdl, array('soap_version' => SOAP_1_1, 'trace' => 1, "exceptions" => 0));

    $params = [
        'DigitalKey' => '8591BFD4-E7C8-4284-84F7-E6C419114FA8',
        'CustomerStatus' => 'ALL',
        'OrderBy' => 'EzidebitCustomerID',
        'Order' => 'ASC',
        'PageNumber' => 1
    ];

    $result = $client->__soapCall('GetCustomerList', [$params]);


    print_r($client->__getLastRequest());
    echo PHP_EOL;
    print_r($result);