[英]Change WCF service to accept content-type “application/xml;charset=utf-8”
I created WCF service that's going to be consumed by a third-party that needs to accept content-type application/xml;charset=utf-8 and SOAP 1.1 envelope namespace. 我创建了WCF服务,该服务将由需要接受内容类型application / xml; charset = utf-8和SOAP 1.1信封命名空间的第三方使用。 The service is currently accepting text/xml;charset=utf-8.
该服务当前正在接受text / xml; charset = utf-8。 Having the client change the content-type is not an option.
让客户端更改内容类型不是一种选择。
I haven't made any changes to the web.config file, except setting the basicHttpBinding maxReceivedMessageSize. 除了设置basicHttpBinding maxReceivedMessageSize外,我没有对web.config文件进行任何更改。
<bindings>
<basicHttpBinding>
<binding name="http" maxReceivedMessageSize="2147483647"/>
</basicHttpBinding>
</bindings>
This issue typically due to the service type. 此问题通常是由于服务类型引起的。 Traditional SOAP web service based on the web service specification, SOAP envelope is the communication carrier and content-type is “application/soap+xml;
传统的基于Web服务规范的SOAP Web服务,SOAP信封是通信载体, 内容类型是“ application / soap + xml”。 charset=utf-8” or “text/xml;charset=utf-8” (for compatible with XML web service).
charset = utf-8”或“ text / xml; charset = utf-8” (与XML Web服务兼容)。
https://en.wikipedia.org/wiki/SOAP https://zh.wikipedia.org/wiki/SOAP
The specifical HTTP header is commonplace in the Restful style service. 特定的HTTP标头在Restful样式服务中很常见。 WCF could create a restful style service too.
WCF也可以创建一个宁静的样式服务。
https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/wcf-web-http-programming-model https://docs.microsoft.com/zh-cn/dotnet/framework/wcf/feature-details/wcf-web-http-programming-model
Example. 例。
https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/how-to-create-a-basic-wcf-web-http-service https://docs.microsoft.com/zh-cn/dotnet/framework/wcf/feature-details/how-to-create-a-basic-wcf-web-http-service
Here is an example I ever wrote. 这是我曾经写过的一个例子。
How to fix "ERR_ABORTED 400 (Bad Request)" error with Jquery call to C# WCF service? 如何通过Jquery调用C#WCF服务来修复“ ERR_ABORTED 400(错误请求)”错误?
Feel free to let me know if there is anything I can help with. 请随时告诉我是否有什么我可以帮助的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.