简体   繁体   中英

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. I am using .net framework 4.0.

I have issue with request format.

Unit test and sample aspx page working as expected. But when calling rest service in soap method, request format setted as xml instead of json.

It is look like soap content-type request header used for new rest header.

We neeed new OperationContextScope for rest environment before request like below.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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