2011-03-24 28 views
0

我有一個WCF服務,我們的客戶之一正在嘗試使用Java連接。他們正在使用以下XML進行HTTP Post。針對.NET WCF的Java HTTP發佈 - 「EndpointDispatcher中的ContractFilter不匹配」

我收到下面列出的錯誤

<?xml version="1.0" encoding="UTF-8"?> 
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <env:Header></env:Header> 
    <env:Body> 
     <req:GetLeads xmlns:req="http://tempuri.org"> 
      <userName>blah</userName> 
      <password>blow</password> 
      <startDateTime>2010-09-24T12.01.37</startDateTime> 
      <endDateTime>2011-03-25T09.07.41</endDateTime> 
     </req:GetLeads> 
    </env:Body> 
    </env:Envelope> 

錯誤消息

The message with Action 'https://carinsuranceapp.uat.infochoice.com.au/LeadReports.svc/basic' 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). 

堆棧跟蹤

at System.ServiceModel.Dispatcher.ErrorBehavior.ThrowAndCatch(Exception e, Message message) 
      at System.ServiceModel.Dispatcher.ChannelHandler.ReplyFailure(RequestContext request, Message fault, String action, String reason, FaultCode code) 
      at System.ServiceModel.Dispatcher.ChannelHandler.ReplyContractFilterDidNotMatch(RequestContext request) 
      at System.ServiceModel.Dispatcher.ChannelHandler.EnsureChannelAndEndpoint(RequestContext request) 
      at System.ServiceModel.Dispatcher.ChannelHandler.TryRetrievingInstanceContext(RequestContext request) 
      at System.ServiceModel.Dispatcher.ChannelHandler.HandleRequest(RequestContext request, OperationContext currentOperationContext) 
      at System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(IAsyncResult result) 
      at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.WorkItem.Invoke2() 
      at System.Security.SecurityContext.Run(SecurityContext securityContext, ContextCallback callback, Object state) 
      at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.WorkItem.Invoke() 
      at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.ProcessCallbacks() 
      at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.CompletionCallback(Object state) 
      at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped) 
      at System.ServiceModel.Diagnostics.Utility.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped) 
      at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP) 
+0

WCF服務的配置是什麼?你使用什麼綁定?看起來您正在發送Soap 1.1(因此操作位於HTTP標頭),但服務已針對Soap 1.2進行配置。 – Aliostad 2011-03-24 23:50:03

+0

另外ServiceContract接口將是有用的(或至少裝飾) – Aliostad 2011-03-24 23:51:05

回答

1

它會更容易找出問題,如果您共享您的WSDL。

有幾件事你可以做,以弄清楚發生了什麼。

  • 使用WCFTestClient.exe連接到您的服務並調用該方法。它允許您查看發送到服務器的XML有效負載。您可以將其與您的客戶正在發送的內容進行比較。
  • 在您的服務中配置跟蹤 - http://msdn.microsoft.com/en-us/library/ms733025.aspx。使用WCFConfigEditor.exe執行此操作更容易。當您查看跟蹤文件時,您會看到更多關於導致失敗的細節。

順便說一句,你的客戶端似乎正在發送SOAP 1.1。如果在你的場景中可以接受,你可以嘗試改變你的服務綁定到basicHttpBinding而不是wsHttpBinding。

相關問題