无法使用多个标头进行soap调用

时间:2017-03-11 15:45:42

标签: php web-services soap wsdl

由于某些原因,我不确定为什么我在两个elemented SOAP调用函数上出错:

以下是XML示例:

    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Header>
    <AuthenticationHeader xmlns="http://omscom/">
      <Username>devuser</Username>
      <Password>devpass</Password>
    </AuthenticationHeader>
    <DebugHeader xmlns="http://omscom/">
      <Debug>false</Debug>
    </DebugHeader>
  </soap:Header>
  <soap:Body>
    <GetShippingCharge xmlns="http://omscom/">
      <StartDate>2016-01-24T00:00:00</StartDate>
      <EndDate>2016-05-24T09:10:06</EndDate>
    </GetShippingCharge>
  </soap:Body>
</soap:Envelope>

当我创建我的PHP时,我收到此错误:

致命错误:未捕获的SoapFault异常:[soap:Server] System.Web.Services.Protocols.SoapException:服务器无法处理请求。 ---&GT; ProMail.WebServices.PMInvalidLoginException:抛出了类型'ProMail.WebServices.PMInvalidLoginException'的异常。 ProMail.WebServices.Authentication.AuthenticateWSUser(String username,String password,String webServiceName,PMSystemType systemType,String serverHttpHostName)at ProMail.WebServices.OMS.Order.authenticate(String webServiceName)at ProMail.WebServices.OMS.Order.GetShippingCharge(DateTime) StartMate,DateTime EndDate)在ProMail.WebServices.OMS.OMS.GetShippingCharge(DateTime StartDate,DateTime EndDate)---内部异常堆栈跟踪结束---在/home/ferdie22/public_html/soap/soaptest.php:48堆栈跟踪:#0 /home/ferdie22/public_html/soap/soaptest.php(48):SoapClient-&gt; __ call('GetShippingChar ...',Array)#1 /home/ferdie22/public_html/soap/soaptest.php( 48):SoapClient-&gt; GetShippingCharge(Array)#main {main}抛入/ home /

这是我的代码“

$wsdl = 'http://xxxxx.veracore.com/pmomsws/oms.asmx?wsdl';
$auth = array(
    'Username'=>'xxxxxx',
    'Password'=>'xxxxxx'
    );
$StartDate ='2017-03-01T00:00:00';
$EndDate   ='2017-03-07T00:00:00';

$xml_array['StartDate'] = $StartDate;
$xml_array['EndDate'] = $EndDate;

$debug = array('Debug'=>'false');
$headerparams = array(
    'AuthenticationHeader' => $auth,
    'DebugHeader' =>$debug
);

$service = new SoapClient($wsdl);
$headers = array();
$headers[] = new SoapHeader('http://omscom/', 'AuthenticationHeader',   $auth);

$headers[] = new SoapHeader('http://omscom/', 'DebugHeader', $debug);
$service->__setSoapHeaders($headers);   

$service->GetShippingCharge($xml_array); 

print '<pre>';
var_dump($service);
print '</pre>';

TIA

0 个答案:

没有答案