2011-08-26 111 views
3

我有一個ASP.NET應用程序託管幾個WCF服務,使用ASP.NET成員的安全性。我已經暴露通過SVC文件(AuthenticationService.svc)的System.Web.ApplicationServices.AuthenticationService如下圖所示:WCF驗證服務 - 如何使用Apache Axis生成客戶端?

<%@ ServiceHost Language="C#" Debug="true" Service="System.Web.ApplicationServices.AuthenticationService" %> 

這項服務我WCF配置如下:

<service name="System.Web.ApplicationServices.AuthenticationService" behaviorConfiguration="AuthenticationServiceBehaviors"> 
    <endpoint contract="System.Web.ApplicationServices.AuthenticationService" binding="basicHttpBinding"/> 
</service> 

... 

<behavior name="AuthenticationServiceBehaviors"> 
    <serviceMetadata httpGetEnabled="true"/> 
    <serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true"/> 
</behavior> 

... 

<bindings> 
    <basicHttpBinding> 
    <binding allowCookies="true"></binding> 
    </basicHttpBinding> 
</bindings> 

我「已經啓用了身份驗證服務在我的web.config如下圖所示:

<system.web.extensions> 
    <scripting> 
    <webServices> 
     <authenticationService enabled="true" requireSSL="false"/> 
    </webServices> 
    </scripting> 
</system.web.extensions> 

我創建了一個.NET控制檯應用程序來測試服務。 Visual Studio生成了一個客戶端,並且該服務按預期工作。我的問題是,我需要從Java應用程序使用此服務,但是當我嘗試生成使用Apache Axis的,我得到以下錯誤在Eclipse客戶端:

IWAB0399E Error in generating Java from WSDL: java.io.IOException: Emitter failure. 
There is an undefined portType (AuthenticationService) in the WSDL document 
http://localhost:17637/Services/AuthenticationService.svc?wsdl=wsdl0. 
Hint: make sure <binding type=".."> is fully qualified. 

我跟蹤它到阿帕奇Axis在ServiceContract和ServiceBehavior中需要不同的名稱空間和名稱,感謝this post。我已經改變了其他的WCF服務,就像那篇文章顯示的那樣,他們工作得很好。問題是,System.Web.ApplicationServices.AuthenticationService看起來像這樣(從http://msdn.microsoft.com/en-us/library/system.web.applicationservices.authenticationservice.aspx):

[ServiceBehaviorAttribute(Namespace = "http://asp.net/ApplicationServices/v200", InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple)] 
[AspNetCompatibilityRequirementsAttribute(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)] 
[ServiceContractAttribute(Namespace = "http://asp.net/ApplicationServices/v200")] 
public class AuthenticationService 

通知的ServiceBehaviorAttribute命名空間是一樣的ServiceContractAttribute的命名空間?我需要它們不同,所以我可以讓Eclipse(Apache Axis)生成一個客戶端。有任何想法嗎?

回答

1

我不認爲是可以更改內置服務的名稱。您應該允許將內置服務包裝在其他服務中,或者用於編寫自定義服務句柄驗證。

+0

幾年前,我結束了自己的身份驗證服務,解決了這個問題。這一直沒有答案,我沒有想到答案。謝謝! –

相關問題