I'm attempting to communicate from a Java client to a .NET WCF service hosted in a Windows service on a remote machine. I'm able to access the wsdl file no problem, but when actually communicating, the remote function never gets called. Instead, I get the following error:
Jul 28, 2010 2:32:51 PM org.apache.catalina.core.ApplicationContext log
SEVERE: Exception while dispatching incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract agt.fathom.ifathom.shared.authentication.User agt.fathom.ifathom.client.IFathomService.loginUser(java.lang.String,java.lang.String)' threw an unexpected exception: javax.xml.ws.soap.SOAPFaultException: Object reference not set to an instance of an object.
at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:378)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:581)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:188)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:224)
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:879)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Unknown Source)
Caused by: javax.xml.ws.soap.SOAPFaultException: Object reference not set to an instance of an object.
at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(Unknown Source)
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(Unknown Source)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(Unknown Source)
at $Proxy38.loginUser(Unknown Source)
at agt.fathom.ifathom.server.IFathomServiceImpl.loginUser(IFathomServiceImpl.java:69)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:562)
... 19 more
The RPC and gwt references are because I'm making a RPC call from a remote GWT client to the Java server, and inside the server function I'm attempting to communicate with the WCF service (local to the java server). The pertinent part of the log info is the Caused by javax.xml.ws.soap.SOAPFaultException bit.
As a note, the java classes for the WCF service were created using the wsdl2java from apache-cxf.
My wsdl file is pretty basic while I'm trying to troubleshoot:
<wsdl:definitions name="FathomWebService" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex">
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="http://172.23.14.12:8099/FathomService?xsd=xsd0" namespace="http://tempuri.org/"/>
<xsd:import schemaLocation="http://172.23.14.12:8099/FathomService?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
<xsd:import schemaLocation="http://172.23.14.12:8099/FathomService?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/AGT.Fathom.iFathom.Service.DataStructures"/>
<xsd:import schemaLocation="http://172.23.14.12:8099/FathomService?xsd=xsd3" namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/></xsd:schema></wsdl:types>
<wsdl:message name="IWebService_LoginUser_InputMessage">
<wsdl:part name="parameters" element="tns:LoginUser"/>
</wsdl:message>
<wsdl:message name="IWebService_LoginUser_OutputMessage">
<wsdl:part name="parameters" element="tns:LoginUserResponse"/>
</wsdl:message>
<wsdl:portType name="IWebService">
<wsdl:operation name="LoginUser">
<wsdl:input wsaw:Action="http://tempuri.org/IWebService/LoginUser" message="tns:IWebService_LoginUser_InputMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/IWebService/LoginUserResponse" message="tns:IWebService_LoginUser_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="BasicHttpBinding_IWebService" type="tns:IWebService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="LoginUser"><soap:operation soapAction="http://tempuri.org/IWebService/LoginUser" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="FathomWebService">
<wsdl:port name="BasicHttpBinding_IWebService" binding="tns:BasicHttpBinding_IWebService">
<soap:address location="http://172.23.14.12:8099/FathomService/iFathomServices"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
And here's the code where I actually create the WCF service:
Uri url = new Uri("http://172.23.14.12:8099/FathomService");
host = new ServiceHost(typeof(FathomWebService), url);
try
{
host.AddServiceEndpoint(typeof(IWebService), new BasicHttpBinding(), "iFathomServices");
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
host.Description.Behaviors.Add(smb);
ServiceBehaviorAttribute sba = host.Description.Behaviors.Find<ServiceBehaviorAttribute>();
if (sba == null)
{
sba = new ServiceBehaviorAttribute();
host.Description.Behaviors.Add(sba);
}
sba.IncludeExceptionDetailInFaults = true;
host.Open();
}
Any insight into what's causing the exception would be extremely helpful. I've no experience with WCF, so I've been flying blind trying to get this fixed, and I've been unable to find anything useful from searching.