WCF-WebHttp UriTemplate和问号 [英] WCF-WebHttp UriTemplate and Question Mark

查看:132
本文介绍了WCF-WebHttp UriTemplate和问号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我面临众所周知的问题(微笑): 

I am faced with the well known issue (smile) : 

UriTemplate 'EntityName /?$ filter = externalCode eq'{qs}'无效;当值不能是复合段时,查询字符串的每个部分必须是'name = value'形式。有关更多详细信息,请参阅UriTemplate的文档。 (System.ServiceModel)

我注意到通过删除问号它可以正常工作。但是,我的OData Rest提供程序需要此问号,如果我使用%3F转义问号,则OData Rest提供程序将返回异常。

I noticed that by removing the question mark it works normally. However, my OData Rest provider expects this question mark, and if I escape the question mark with %3F, the OData Rest provider returns an exception.

上述URL  'EntityName /?$ filter = externalCode eq'{qs}'
没有参数,即  'EntityName /?$ filter = externalCode eq'555'
的作品通常

The above URL 'EntityName/?$filter=externalCode eq '{qs}' with no parameters i.e. 'EntityName/?$filter=externalCode eq '555' works normally

对这个家伙有什么帮助吗? (我想避免使用动态发送端口,因为对于一个简单的问号它太复杂了不是吗?(​​微笑)

Any help on this Guys? (I want to avoid using dynamic send ports, because it is too complicated for a simple question mark isn't it? (smile)

谢谢

BizTalk的报告解决方案 |
在Twitter上关注我们

推荐答案

你好,



你无法逃避"?"。原因是网址中的"?"表示URL参数将跟随,并且URL参数的格式始终为"name = value"。



如您所述,具有硬编码值的URL有效而不是发送端口中的变量映射选项,它肯定是一个限制。



如帖子所示:    WCF-WebHttp
REST配置
 
您必须使用动态发送端口实现此功能。
Hello,

You cannot escape the "?". The reason for this is that the "?" in an URL signifies URL parameters will follow, and URL parameters are always of the form "name=value".

As you noted by you, the URL with the hardcoded value works and not with the Variable Mapping options in the Send Port, it certainly turns out to a be limitation.

As suggested in the post:  WCF-WebHttp REST configuration you have to implement this using Dynamic Send Port.


这篇关于WCF-WebHttp UriTemplate和问号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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