I am working on an asp .net net project which calls a workflow service. I want to call the service without adding it as a service to the solution. I am using the following code
XNamespace ns = "http://schemas.microsoft.com/2003/10/Serialization/";
var factory = new ChannelFactory<IGenericService>(new BasicHttpBinding(), new EndpointAddress("http://localhost:2757/BPMNSimple.xamlx"));
var proxy = factory.CreateChannel();
var request = Message.CreateMessage(MessageVersion.Soap11, "http://tempuri.org/IService/TestSimple", new XElement(ns + "string", "45"));
var response = proxy.GetData(request);
var xml = (XElement)XElement.ReadFrom(response.GetReaderAtBodyContents());
var message = xml.Value;
lblMessage.Text = message.ToString();
In the xamlx file the receive activity takes one argument which is a string and the sendreplytoreceive activity gives 2 parameters as an output. I get the following error when i run this code:
System.ServiceModel.CommunicationException: The server did not provide a meaningful reply;
this might be caused by a contract mismatch, a premature session shutdown or an internal server error. Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
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)
at _Default.IGenericService.GetData(Message request)
at _Default.Page_Load(Object sender, EventArgs e) in c:\Users\marios\Documents\Visual Studio 2010\WebSites\WebSite2\Default.aspx.cs:line 63
In the first instance, turn IncludeExceptionDetailsInFaults on on the service side. You will be able to get more information from http://msdn.microsoft.com/en-us/library/system.servicemodel.description.servicedebugbehavior.includeexceptiondetailinfaults.aspx.
You'll need to add something like the following to your services web.config:
<serviceDebug includeExceptionDetailInFaults="true" />
Eidt: So the next thing to try is using the built in error handling to see if you can see what is happeneing serveside. Have a read of this MSDN article. You need to add someting like:
<configuration>
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="traceListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "c:\log\Traces.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
This will create a WCF log file where you can (hopefully) see an error relating to your request.