I have a BW process exposed as a web service, and wish to consume it using a C# .NET form. However, my application keeps showing the exception: No handler for body element, plus the following stack trace (way below). I've run the BW process in test mode to check the process status, and found that the request never reached BW. I've also tested the same process using soapUI, which triggered the web service request perfectly. Any suggestions?
My code is as follows:
ServiceReference1.PortTypeClient client = new ServiceReference1.PortTypeClient();
ServiceReference1.new_incident_report report = new ServiceReference1.new_incident_report();
report.contact_details = new ServiceReference1.contact_details();
report.contact_details.name = "John Doe";
report.contact_details.contactno = "1234567890";
report.incident_details = new ServiceReference1.incident_details();
report.incident_details.date = new DateTime();
report.incident_details.time = new DateTime();
report.incident_details.location = "80 Dutch Road";
report.operator_comments = new ServiceReference1.operator_开发者_C百科comments();
report.operator_comments.operator_name = "Bob";
report.operator_comments.operator_summary = "Something";
MessageBox.Show(client.processOperation(report));
Server stack trace: at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs) 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 MyWebServiceConsumer.ServiceReference1.PortType.processOperation(processOperationRequest request) at MyWebServiceConsumer.ServiceReference1.PortTypeClient.MyWebServiceConsumer.ServiceReference1.PortType.processOperation(processOperationRequest request) in c:\users\ystan.2009\documents\visual studio 2010\Projects\MyWebServiceConsumer\MyWebServiceConsumer\Service References\ServiceReference1\Reference.cs:line 327 at MyWebServiceConsumer.ServiceReference1.PortTypeClient.processOperation(new_incident_report new_incident_report) in c:\users\ystan.2009\documents\visual studio 2010\Projects\MyWebServiceConsumer\MyWebServiceConsumer\Service References\ServiceReference1\Reference.cs:line 333 at MyWebServiceConsumer.Form1.button1_Click(Object sender, EventArgs e) in c:\users\ystan.2009\documents\visual studio 2010\Projects\MyWebServiceConsumer\MyWebServiceConsumer\Form1.cs:line 44
For anyone still looking at this, the solution appears to involve manually crafting the SOAP packet, which gets dispatched to BW correctly. The .NET Web Reference utility and BW seem to be incompatible for some reason.
精彩评论