简体   繁体   English

php SOAP请求发送空白元素

[英]php SOAP request sending blank elements

I'm relatively inexperienced with SOAP requests and the SoapClient class. 我对SOAP请求和SoapClient类相对缺乏经验。 I'm trying to call a function of a web service but when I look at the request being sent, it's showing blank elements where I have supplied an array of arguments. 我正在尝试调用Web服务的函数,但是当我查看正在发送的请求时,它显示了我提供了一组参数的空白元素。 So I'm not sure if I'm improperly reading the wsdl or what the issue is here. 所以我不确定我是不是正确阅读了wsdl或者问题是什么。

This is my php: 这是我的PHP:

$ns = 'http://www.WSAPI.AMS360.com/v3.0';
$response = $client->__soapCall('Login',array($loginData)); 
$clientLoginToken = $client->__getLastResponse();

//token coming back as header in soap response; strip out xml and only use the Ticket element
$clientLoginToken = strip_tags($clientLoginToken);

//need to send auth header back on subsequent requests
$soapHeader = new SoapHeader($ns,'WSAPISession',array('Ticket'=>$clientLoginToken));

//test to simply retrieve a customer record..
$customerData = array('CustomerGetByNumberRequest'=>
                     array('CustomerNumber'=>'00006195')
                );

//call CustomerGetByNumber function
$customer = $client->__soapCall('CustomerGetByNumber',
                                array($customerData),
                                null,
                                array($soapHeader),
                                $output_headers);

This is the outgoing XML when I call $client->__getLastRequest() . 当我调用$client->__getLastRequest()时,这是传出的XML。 As you can see the CustomerGetByNumber element is empty even though I'm supplying the arguments to the __soapCall() above. 正如您所看到的, CustomerGetByNumber元素为空,即使我正在向上面的__soapCall()提供参数。

<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.WSAPI.AMS360.com/v3.0">
  <SOAP-ENV:Header>
    <ns1:WSAPISession>
      <ns1:Ticket>
           tcyOHI65U2H1yKsuvpahvoWzViAQy+tsWRElraBgKJewSQQJFi8cgS/9bjge5TlXlzH2XkxszR5u/i42dGjUnd+0JHOlQ1bJYbY5/cLgctvn4iTqoD9NPL67S0MvG5Uq
      </ns1:Ticket>
    </ns1:WSAPISession>
  </SOAP-ENV:Header>
  <SOAP-ENV:Body>
    <ns1:CustomerGetByNumber />
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

I figured out the issue. 我想出了这个问题。 The CustomerGetByNumberRequest key was supposed to just be Request CustomerGetByNumberRequest密钥应该只是Request

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM