简体   繁体   English

从.NET表单使用TIBCO BusinessWorks Web服务

[英]Consuming TIBCO BusinessWorks Web Service from .NET form

I have a BW process exposed as a web service, and wish to consume it using a C# .NET form. 我将BW流程公开为Web服务,并希望使用C#.NET表单使用它。 However, my application keeps showing the exception: No handler for body element, plus the following stack trace (way below). 但是,我的应用程序不断显示异常:没有用于body元素的处理程序,以及以下堆栈跟踪(如下)。 I've run the BW process in test mode to check the process status, and found that the request never reached BW. 我已经在测试模式下运行BW流程以检查流程状态,发现请求从未到达BW。 I've also tested the same process using soapUI, which triggered the web service request perfectly. 我还使用soapUI测试了相同的过程,该过程完美触发了Web服务请求。 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) 服务器堆栈跟踪:位于System.ServiceModel.Channels.ServiceChannel.Call(位于System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime操作,ProxyRpc&rpc)(字符串操作,布尔型单向,ProxyOperationRuntime操作,Object [] ins,Object [] outs) ,在System.ServiceModel.Channels.ServiceChannel.Call(字符串操作,布尔型单向,ProxyOperationRuntime操作,Object [] ins,Object [] outs)处,在System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall,ProxyOperationRuntime操作处) ),位于System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage消息)

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\\ys 异常重新抛出为[0]:在System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&msgData,Int32类型)在System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg)在MyWebServiceConsumer.ServiceReference1。 MyWebServiceConsumer.ServiceReference1.PortTypeClient.MyWebServiceConsumer.ServiceReference1.PortType.processOperation(processOperationRequest请求)上的PortType.processOperation(processOperationRequest请求),位于c:\\ users \\ ystan.2009 \\ documents \\ visual studio 2010 \\ Projects \\ MyWebServiceConsumer \\ MyWebServiceConsumer \\ Service MyWebServiceConsumer.ServiceReference1.PortTypeClient.processOperation(new_incident_report new_incident_report)中的ServiceReference1 \\ Reference.cs:第327行,位于c:\\ users \\ ystan.2009 \\ documents \\ visual studio 2010 \\ Projects \\ MyWebServiceConsumer \\ MyWebServiceConsumer \\ Service References \\ ServiceReference1 \\ Reference。 :c:\\ users \\ ys中MyWebServiceConsumer.Form1.button1_Click(Object sender,EventArgs e)的333行 tan.2009\\documents\\visual studio 2010\\Projects\\MyWebServiceConsumer\\MyWebServiceConsumer\\Form1.cs:line 44 tan.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. 对于仍在关注此问题的任何人,该解决方案似乎都涉及手动制作SOAP数据包,该数据包已正确分配给BW。 The .NET Web Reference utility and BW seem to be incompatible for some reason. 由于某些原因,.NET Web参考实用程序和BW似乎不兼容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM