简体   繁体   English

调用休息服务时,肥皂服务中的请求格式确定失败

[英]Request format determination failed in soap service while calling rest service

I am trying to call rest service which is creating with WebChannelFactory in soap service. 我试图调用在SOAP服务中使用WebChannelFactory创建的REST服务。 I am using .net framework 4.0. 我正在使用.net Framework 4.0。

I have issue with request format. 我的请求格式有问题。

Unit test and sample aspx page working as expected. 单元测试和样本aspx页面按预期工作。 But when calling rest service in soap method, request format setted as xml instead of json. 但是,当以soap方法调用rest服务时,请求格式设置为xml而不是json。

It is look like soap content-type request header used for new rest header. 它看起来像用于新的rest标头的soap内容类型请求标头。

We neeed new OperationContextScope for rest environment before request like below. 在出现如下要求之前,我们为休息环境选择了新的OperationContextScope。

using (OperationContextScope scope = new OperationContextScope((IContextChannel)proxy))
{
  proxy.myMethod();
}

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

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