如何消费SAP Web服务在C# [英] How to Consume SAP Web Service in C#

查看:569
本文介绍了如何消费SAP Web服务在C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想消费SAP Web服务到我的C#应用​​程序。对于我写code的一个街区如下。

I want to consume SAP web service into my c# application. For that i wrote one block of code given below.

NetworkCredential ntobj = new NetworkCredential();
            ZWEBSERVICE_INTERNAL_ORDER2 zClassobj = new ZWEBSERVICE_INTERNAL_ORDER2();
            ZbapiFiCreateInternalOrder zMethodObj = new ZbapiFiCreateInternalOrder();
            ZbapiFiCreateInternalOrderResponse zMethodResobj = new ZbapiFiCreateInternalOrderResponse();

            ntobj.UserName = "alpldev";
            ntobj.Password = "alpl123";

            zClassobj.PreAuthenticate = true;
            zClassobj.Credentials = ntobj;

            zMethodObj.IDriverNo = "KD00000014";
            zMethodObj.IPlant = "1001";
            zMethodObj.ITripNo = "1001201406140027";
            zMethodObj.IVhclNo = "AP29Q8639";

            zMethodResobj = zClassobj.ZbapiFiCreateInternalOrder(zMethodObj);

但最后一行我得到了建立被关闭底层连接。意想不到的格式是发送错误。

but at last line i got "underlying connection established was closed. unexpected format was send" error.

请帮我...

推荐答案

我实际使用的SAP WebService的SOAP服务,我看可能是你必须做出第一个包括QaaWsHeader请求的问题,在ReportBlock配置,然后创建请求,最后用与ServicesSoapClient帮助安排发送您的结果的方法。

I'm actually using a soap service for a SAP WebService, I see that may be the problem that you have to make a first a Request including the QaaWsHeader and the ReportBlock configuration, then create the Request and finally with help with the ServicesSoapClient make the method to send your result.

使用此作为一个例子,我希望这会有所帮助,祝你好运。

Use this as an example, I hope this will help, good luck

                Sellers.QaaWSHeader qaawsHeaderDatos = new Sellers.QaaWSHeader();
                Sellers.GetReportBlock_WBS_Sellers getReportBlock = new Sellers.GetReportBlock_WBS_Sellers();
                getReportBlock.login = userWS;
                getReportBlock.password = passWS;
                getReportBlock.refresh = true;
                getReportBlock.startRow = 0;
                getReportBlock.startRowSpecified = true;
                getReportBlock.endRow = 1000;
                getReportBlock.endRowSpecified = true;
                Sellers.GetReportBlock_WBS_Sellers_Request WSRequest = new Sellers.GetReportBlock_WBS_Sellers_Request(qaawsHeaderDatos, getReportBlock);

                Sellers.BIServicesSoap BiService = new Sellers.BIServicesSoapClient();
                Sellers.GetReportBlock_WBS_Sellers_Response FinalResponse = BiService.GetReportBlock_WBS_Sellers(WSRequest);
                object[][] yourTable = FinalResponse.table;

这篇关于如何消费SAP Web服务在C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆