wcf - 响应内容验证失败
问题描述
我正在将应用程序从 .NET Framework 4.6.1 重写为 .NET Core 3.1。一个库需要与 Soap 服务进行通信。基本上一切正常,除了响应阅读。
看起来问题出在字符集上,预计是charset="utf-8" received charset=utf-8。
有人知道如何在客户端进行调整吗?
最好的问候法比安
System.ServiceModel.ProtocolException: The content type text/xml; charset="utf-8" of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 518 bytes of the response were: '<?xml version="1.0" ?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:generatePackagesNumbersV2Response xmlns:ns2="http://dpdservices.dpd.com.pl/"><return xmlns=""><Status>OK</Status><SessionId>2722911</SessionId><Packages><Package><Status>OK</Status><PackageId>1264106</PackageId><Parcels><Parcel><Status>OK</Status><ParcelId>1758645</ParcelId><Waybill>0000000831731Q</Waybill></Parcel></Parcels></Package></Packages></return></ns2:generatePackagesNumbersV2Response></S:Body></S:Envelope>'.
at System.ServiceModel.Channels.HttpResponseMessageHelper.ValidateContentTypeAsync()
at System.ServiceModel.Channels.HttpResponseMessageHelper.ParseIncomingResponse(TimeoutHelper timeoutHelper)
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpClientRequestChannel.HttpClientChannelAsyncRequest.ReceiveReplyAsync(TimeoutHelper timeoutHelper)
at System.ServiceModel.Channels.RequestChannel.RequestAsync(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.RequestAsyncInternal(Message message, TimeSpan timeout)
at System.Runtime.TaskHelpers.WaitForCompletionNoSpin[TResult](Task`1 task)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(MethodCall methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(MethodInfo targetMethod, Object[] args)
--- End of stack trace from previous location where exception was thrown ---
at System.Reflection.DispatchProxyGenerator.Invoke(Object[] args)
at generatedProxy_1.generatePackagesNumbersV2(generatePackagesNumbersV2Request )
at ServiceReference2.DPDPackageObjServicesClient.generatePackagesNumbersV2(generatePackagesNumbersV2Request request) in C:\Users\fabia\Repos\DocFlowPlatformCore.Server\ClassLibrary1\Connected Services\ServiceReference2\Reference.cs:line 9646
at Scodes.ShippingProvider.Dpd.DpdProvider2.Create(Shipment shipment) in C:\Users\fabia\Repos\DocFlowPlatformCore.Server\ClassLibrary1\Class1.cs:line 67
解决方案
推荐阅读
- sql - 在 SQL Server 的列中搜索值
- python - DataFrame pop 函数在 Nest Dictionary 中删除想要的值
- arrays - 我非常坚持这个 Kata ...需要返回一个由偶数和奇数组成的数组,分成两部分
- gatsby - 在 Gatsby 源插件中更新数据
- javascript - 基本身份验证 axios - klarna 结帐
- php - 根据 Laravel 中的数据库值动态更改 SAAS 变量
- excel - 将文本拆分为列错误 VBA 1004 错误
- python - 使用__dict__时如何只获取没有父类的类内容
- cmd - 我可以使用 VBS 在 cmd telnet 会话中读取数据吗?
- android - SearchView 和 NavigationUI - 显示以前的结果