我通过右键单击并添加服务引用将 java Web 服务消耗到我的 asp.net 项目中。
public static salim.HakedisServiceClient ws = new salim.HakedisServiceClient("HakedisServiceImplPort");
ws.ClientCredentials.UserName.UserName = "****";
ws.ClientCredentials.UserName.Password = "****";
var lstCities = ws.getCities();
但它有一个例外:
System.ServiceModel.FaultException :{"Fault occurred while processing."} 服务器堆栈跟踪:在 System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.Call(String action,布尔单程,ProxyOperationRuntime 操作,Object[] 输入,Object[] 输出,TimeSpan 超时)在 System.ServiceModel.Channels.ServiceChannel.Call(字符串操作,布尔单程,ProxyOperationRuntime 操作,Object[] 输入,Object[] 输出)在System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
在 [0] 处重新抛出异常:在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) 处的 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) 处。 getCities(getCities 请求)在 c:\Windows\Microsoft.NET\Framework\Temporary ASP.NET Files\website1\bdbbd757\4abd3cb7\App_WebReferences.mggi9qhe 中的 salim.HakedisServiceClient.salim.HakedisService.getCities(getCities 请求) .0.cs:第 1392 行,位于 c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\website1\bdbbd757\4abd3cb7\App_WebReferences.mggi9qhe.0.cs 中的 salim.HakedisServiceClient.getCities() :c:\Users\htsapp\Documents\Visual Studio 2008\WebSites\WebSite1\Default.aspx.cs 中 _Default.Page_Load(Object sender, EventArgs e) 的第 1398 行:System.Web 的第 80 行。Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() 在 System.Web.UI.Page.ProcessRequestMain(布尔 includeStagesBeforeAsyncPoint,布尔 includeStagesAfterAsyncPoint)
和这样的网络服务:
<wsdl:definitions name="Hakedis" targetNamespace="http://hakedis.eventhandler.archibus.com/">
<wsdl:types></wsdl:types>
<wsdl:message name="getFloors"></wsdl:message>
<wsdl:message name="getRooms"></wsdl:message>
<wsdl:message name="getBuildingPropertiesResponse"></wsdl:message>
<wsdl:message name="getBuildingProperties"></wsdl:message>
<wsdl:message name="getBuildingTypes"></wsdl:message>
<wsdl:message name="getBuildingTypesResponse"></wsdl:message>
<wsdl:message name="getFloorsResponse"></wsdl:message>
<wsdl:message name="getRoomsResponse"></wsdl:message>
<wsdl:message name="getCities"></wsdl:message>
<wsdl:message name="getCitiesResponse"></wsdl:message>
<wsdl:message name="getBuildingsResponse"></wsdl:message>
<wsdl:message name="getBuildings"></wsdl:message>
<wsdl:portType name="HakedisService"></wsdl:portType>
<wsdl:binding name="HakedisSoapBinding" type="tns:HakedisService"></wsdl:binding> <wsdl:service name="Hakedis"></wsdl:service></wsdl:definitions>
有人有建议吗?