在制作php curl soap请求时收到错误

时间:2014-06-09 21:53:00

标签: php xml web-services curl soap

收到错误:

a:为给定的Message找到了匹配MessageFilter的InternalServiceFaultNo。找不到匹配的MessageFilter给定的Message。在System.ServiceModel.Routing.MessageRpc.RouteToSingleEndpoint [TContract](RoutingConfiguration routingConfig)  在System.ServiceModel.Routing.ProcessRequestAsyncResult`1..ctor(RoutingService服务,消息消息,AsyncCallback回调,对象状态)  在System.ServiceModel.Routing.RoutingService.BeginProcessRequest [TContract](消息消息,AsyncCallback回调,对象状态)  在System.ServiceModel.Routing.RoutingService.System.ServiceModel.Routing.IRequestReplyRouter.BeginProcessRequest(消息消息,AsyncCallback回调,对象状态)  at AsyncInvokeBeginBeginProcessRequest(Object,Object [],AsyncCallback,Object)  at System.ServiceModel.Dispatcher.AsyncMethodInvoker.InvokeBegin(Object instance,Object [] inputs,AsyncCallback callback,Object state)  在System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)  在System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)  在System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)  at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)System.InvalidOperationException

尝试制作soap / xml curl请求的代码:

$url = "https://domain.com/catalog";

    $soap_do = curl_init();
    curl_setopt($soap_do, CURLOPT_URL,            $url );
    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,     $xmlRequest); 
    curl_setopt($soap_do, CURLOPT_VERBOSE, TRUE); 
    curl_setopt($soap_do, CURLOPT_HTTPHEADER, array("Content-Type: text/xml", "SOAPAction: \"/soap/action/query\"", "Content-length: ".strlen($xmlRequest))); 

    $result = curl_exec($soap_do);

    print_r($result);

这是我第一次尝试使用肥皂,我不确定我做错了什么。 $ xmlRequest变量中的xml直接来自我提供的三个部分所提供的文档,如下所示:

$xmlRequest = '<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="https://domain.com/Gateway.svc/Catalog/2012/12" xmlns:ns1="https://domain.com/Gateway.svc/Catalog/2012/12">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:GetItemsBySourceCode>
         <ns:catalogSourceCodeItemsRequest>
            <ns1:Header>
               <ns1:AccountAuth>
                  <!--Provide Service Credentials -->
                  <ns1:AccountId>accountid</ns1:AccountId>
                  <ns1:Password>password</ns1:Password>
               </ns1:AccountAuth>
               <ns1:Application>
                  <ns1:ApplicationIdentifier/>
                  <ns1:ClientIdentifier/>
                  <ns1:ProgramIdentifier/>
               </ns1:Application>
               <ns1:Parms>
                  <ns1:Parm>
                     <ns1:Name/>
                     <ns1:Value/>
                  </ns1:Parm>
               </ns1:Parms>
               <!--Not Required -->
               <ns1:TransactionId/>
            </ns1:Header>
            <!--Optional End Date for Catalog Data Pull-->
            <ns1:endDate/>
            <ns1:sourceCode>SourceCodeHere</ns1:sourceCode>
            <!--Optional Starting Date for Catalog Data Pull -->
            <ns1:startDate/>
         </ns:catalogSourceCodeItemsRequest>
      </ns:GetItemsBySourceCode>
   </soapenv:Body>
</soapenv:Envelope>';

0 个答案:

没有答案