我有一个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)生成一个客户端。有任何想法吗?
几年前,我结束了自己的身份验证服务,解决了这个问题。这一直没有答案,我没有想到答案。谢谢! –