本文介绍了WebService响应为null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个客户端Web服务,当我在VS 2008中使用它时,我收到的结果对象为null.但是,当我在SOAP UI中使用相同的服务时(SOAP UI是用于测试Web服务的工具),它将发送xml结果.下面是我正在使用的代码.我什至与Web服务提供商进行了讨论,他们确认在Web服务服务器的日志中,他们能够看到从其末端发送的请求和响应.

Hi All,

I have a client webservice, when I consume it in VS 2008 I receive the result object as null. But when I use the same service in the SOAP UI(SOAP UI is a tool to test the webservices) it sends the xml result. Below is the code that I am using. I even discussed with the webservice provider and they confirmed that in the logs of the webservice server they are able to see the request and response send from their end.

GetRenewalPriceReqType[] pricereqtype = new GetRenewalPriceReqType[1];
                ProgressPriceAPI.SSIGetRenewalPriceListSrvService PricingRequestObj = new SSIGetRenewalPriceListSrvService();
                ProgressPriceAPI.GetRenewalPriceResType[] PricingResponseObj ;
                ProgressPriceAPI.GetRenewalTaxType[] txprice;
                pricereqtype[0] = new GetRenewalPriceReqType();
                pricereqtype[0].Domain = "USA";
                pricereqtype[0].ContractNumber = "153452";
                pricereqtype[0].ContractLine = 5;
                pricereqtype[0].AdjustPriceRenewal = "A";
                pricereqtype[0].ServiceLevel = "STDNEW";
                pricereqtype[0].TaxBasisAmount = 0;
                pricereqtype[0].ContractLineSpecified = true;
                pricereqtype[0].EffectiveDateSpecified = true;
                pricereqtype[0].TaxBasisAmountSpecified = true;
                string strDate = "2011-11-30";
                DateTimeFormatInfo dtfi = new DateTimeFormatInfo();
                dtfi.ShortDatePattern = "YYYY-MM-DD";
                dtfi.DateSeparator = "-";
                DateTime objDate = Convert.ToDateTime(strDate, dtfi);
                pricereqtype[0].EffectiveDate = objDate;
                ObjectToXml(pricereqtype[0], "c:\\pricereqtype.xml");
                //PricingResponseObj = new GetRenewalPriceResType[2];
                PricingResponseObj = PricingRequestObj.SSIGetRenewalPriceListSrv(pricereqtype);


签名如下


The signature is as below

GetRenewalPriceResType[] SSIGetRenewalPriceListSrvService.SSIGetRenewalPriceListSrv(GetRenewalPriceReqType[] SSIGetRenewalPriceListSrvReq)


如果我在这里缺少任何物品,请告诉我.

谢谢,
Sudhir.


Please let me know if I am missing anything here.

Thanks,
Sudhir.

推荐答案


ObjectToXml(pricereqtype[0], "c:\\pricereqtype.xml");


上面的代码用于我的内部测试,但是下面的代码将请求提交到Web服务


The above code is for my internal testing purpose but the below code is submitting the request to webservice

PricingRequestObj.SSIGetRenewalPriceListSrv(pricereqtype);

,并将结果对象分配给"PricingResponseObj"接收空值.

由于相同的输入正在作为Web服务测试工具的SOAP UI接收到输出,因此我怀疑这是否是反序列化中的任何问题/任何导致此问题的问题.

and the result object is assigned to "PricingResponseObj" which is receiving the null value.

As the same input is receiving an output in the SOAP UI which is a webservice test tool, I was suspecting if ther is any issue in deserialization/any which is causing this issue.



这篇关于WebService响应为null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 18:02
查看更多