调用Web服务时出现WSDL类型限制问题 [英] WSDL type restriction issue while calling web service

查看:113
本文介绍了调用Web服务时出现WSDL类型限制问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在尝试在第三方Web服务上发布SOAP请求.

我已经在我的Visual Studio项目中添加了Web服务作为参考.

生成的WSDL具有CheckIn/CheckOut属性,其类型为Date.

Web服务仅接受以下形式的请求-

Hi,

I am trying to post a SOAP request on third-party web service.

I have added web service as a reference in my Visual Studio project.

Generated WSDL has attributes CheckIn/CheckOut, which of type Date.

Web Services accept only following form of request -

<ns:HotelProduct City="WAS" CheckInDate="2012-11-25" CheckOutDate="2012-11-30"> 



但是由于CheckIn/CheckOut属性在WSDL中定义为Date,因此该请求成为



But since CheckIn/CheckOut attribute are defined as Date in WSDL, the request becomes

<ns:HotelProduct City="WAS" CheckInDate="2012-11-25 12:00:00 AM" CheckOutDate="2012-11-30 12:00:00AM">




在构建SOAP消息时,将附加时间戳.


我对Web服务没有任何控制权,因为它来自第三方.

我尝试使用不同的DateTime格式,对生成的WSDL进行了更改,但是没有运气.

如何应付这个问题.
任何替代方法都将非常有帮助.




TimeStamp is appended while building SOAP message.


I don''t have any control over web service since it''s from third party.

I have tried using different DateTime formats, making change in generated WSDL,, but no luck.

How to cope with this issue.
Any alternative would be much helpful.

推荐答案

尝试格式化日期,如
Try formating the date like
DateTime.Now.ToString("yyyy-MM-dd");



请参考 C#DateTime格式 [ ^ ]

希望对您有帮助



Refer C# DateTime Format[^]

Hope this helps


这篇关于调用Web服务时出现WSDL类型限制问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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