2009-11-30 93 views
3

我在調用java web服務時收到此錯誤。我和我的團隊其他人一樣使用相同的源代碼,他們都能夠稱它爲沒有問題? 這是堆棧跟蹤:錯誤403:禁止。 HTTP請求被禁止,客戶端身份驗證方案'匿名'

30 Nov 2009 16:38:50,970 [4] ERROR - Error calling web service: System.ServiceModel.Security.MessageSecurityException: The HTTP request was forbidden with client authentication scheme 'Anonymous'. ---> System.Net.WebException: The remote server returned an error: (403) Forbidden. 
    at System.Net.HttpWebRequest.GetResponse() 
    at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) 
    --- End of inner exception stack trace --- 

Server stack trace: 
    at System.ServiceModel.Channels.HttpChannelUtilities.ValidateAuthentication(HttpWebRequest request, HttpWebResponse response, WebException responseException, HttpChannelFactory factory) 
    at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException) 
    at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) 
    at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) 
    at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout) 
    at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) 
    at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs) 
    at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) 
    at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) 

Exception rethrown at [0]: 
    at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) 
    at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) 
+2

它真的是一個Java Web服務嗎? System.Net.WebException是微軟的東西。完整的堆棧跟蹤看起來不像Java ... – 2009-11-30 17:09:13

+2

這是100%C#/ WCF。怎麼回事,伯納德? – Randolpho 2009-11-30 17:14:27

+0

這是來自我的調用代碼的堆棧跟蹤。 – Bernard 2009-12-03 15:45:05

回答

3

我認爲Web服務的服務器端的Java實現,但這不應該怎樣都無所謂。

也許有一個基於IP的授權層?

+0

在使用Wireshark從我的PC和從我們的.Net代碼調用java web服務的個人電腦上嗅探數據包之後,java開發人員發現我的子網上存在IP限制,而不是我的剩餘部分球隊的。 – Bernard 2009-12-03 15:46:48

0

獲取掛鉤到環路中的HTTP嗅探器,並查看他們發送的請求與您發送的內容相比。無論出於何種原因,您的請求都不會發送適當的身份驗證。

請注意,根據設置的方式,這可能不取決於您的源代碼樹,並可能依照您計算機上的IE Internet Settings。

0

我已經解決了它。

我看到服務主機中的WSHttpBinding實際上檢查傳入的客戶端請求證書是否存在於受信任的人員中。 所以遠程證書應該存在於服務器的可信任的人員中。

或者添加CustomValidator並覆蓋該行爲。好運

相關問題