从 .NET 表单使用 TIBCO BusinessWorks Web 服务
我有一个作为 Web 服务公开的 BW 进程,并希望使用 C# .NET 表单来使用它。但是,我的应用程序不断显示异常:没有 body 元素的处理程序,加上以下堆栈跟踪(如下)。我在测试模式下运行BW进程来检查进程状态,发现请求从未到达BW。我还使用soapUI 测试了相同的过程,它完美地触发了Web 服务请求。有什么建议吗?
我的代码如下:
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_comments();
report.operator_comments.operator_name = "Bob";
report.operator_comments.operator_summary = "Something";
MessageBox.Show(client.processOperation(report));
服务器堆栈跟踪: 在System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime操作,ProxyRpc&rpc) 在 System.ServiceModel.Channels.ServiceChannel.Call(字符串操作、布尔单向、ProxyOperationRuntime 操作、Object[] ins、Object[] outs、TimeSpan 超时) 在 System.ServiceModel.Channels.ServiceChannel.Call(字符串操作,布尔单向,ProxyOperationRuntime 操作,Object[] ins,Object[] outs) 在System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage方法调用,ProxyOperationRuntime操作) 在 System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
在 [0] 重新抛出异常: 在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg) 在System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&msgData,Int32类型) 在 MyWebServiceConsumer.ServiceReference1.PortType.processOperation(processOperationRequest 请求) 在MyWebServiceConsumer.ServiceReference1.PortTypeClient.MyWebServiceConsumer.ServiceReference1.PortType.processOperation(processOperationRequest请求)在c:\ users \ ystan.2009 \ Documents \ Visual Studio 2010 \ Projects \ MyWebServiceConsumer \ MyWebServiceConsumer \ Service References \ ServiceReference1 \ Reference.cs:行第327章 在 c:\users\ystan.2009\documents\visual studio 2010\Projects\MyWebServiceConsumer\MyWebServiceConsumer\Service References\ServiceReference1\Reference.cs 中的 MyWebServiceConsumer.ServiceReference1.PortTypeClient.processOperation(new_incident_report new_incident_report):第 333 行 在 c:\users\ystan.2009\documents\visual studio 2010\Projects\MyWebServiceConsumer\MyWebServiceConsumer\Form1.cs 中的 MyWebServiceConsumer.Form1.button1_Click(Object sender, EventArgs e):第 44 行
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_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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于仍在关注此问题的任何人来说,解决方案似乎涉及手动制作 SOAP 数据包,该数据包会正确分派到 BW。由于某种原因,.NET Web Reference 实用程序和 BW 似乎不兼容。
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.