使用 UPS Web 服务时出现 System.Web.Services.Protocols.SoapException 异常
我正在使用 https://wwwcie.ups.com/ups.app 的网络服务/xml/Rate 将 UPS 运输计算合并到我的 asp.net 项目中。在运行项目时,我遇到了如下异常:
描述:System.Web.Services.Protocols.SoapException:服务器无法识别 HTTP 的值 标头 SOAPAction:http://localhost:4594/ShippingModule.asmx/GetUPSShippingCost。在 System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest() 在 System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage 消息) 在 System.Web.Services.Protocols.SoapServerProtocol.Initialize() 在 System.Web.Services .Protocols.ServerProtocol.SetContext(类型类型,HttpContext上下文, HttpRequest 请求、HttpResponse 响应)位于 System.Web.Services.Protocols.ServerProtocolFactory.Create(类型类型、HttpContext 上下文、HttpRequest 请求、HttpResponse 响应、Boolean& abortProcessing) 来源:System.Web.Services
我现在正在本地主机中运行它。这是这个异常的根源吗?或者 Web 服务中使用的自定义命名空间是主要问题? 我在网上搜索了很多这个问题。但没有找到任何办法来解决这个问题。
I am using a web service from https://wwwcie.ups.com/ups.app/xml/Rate to incorporate UPS shipping calculations in my asp.net project. While running the project, I got an exception as below:
Description: System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP
Header SOAPAction: http://localhost:4594/ShippingModule.asmx/GetUPSShippingCost. at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest() at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message) at System.Web.Services.Protocols.SoapServerProtocol.Initialize() at System.Web.Services.Protocols.ServerProtocol.SetContext(Type type, HttpContext context, HttpRequest request, HttpResponse response) at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)
Source: System.Web.Services
I am running it now in localhost. Is that the source of this exception? Or the customed namespace used in the web service is the main issue?
I searched a lot on web for this problem. But didn't get any wayout to resolve this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
@user286035,
异常本身很清楚,服务器无法识别 HTTP 标头 SOAPAction 的值
这意味着您发送的肥皂信封有一个标头,其中包含服务器无法识别其值的元素 SOAPAction。如果需要 SOAPAction 元素,则尝试在其中放入适当的值然后将其发布到 SOAP 服务。
使用 TCPMonitor 监视正在发送到服务器的请求,它将为您提供清晰的想法。
@user286035,
The exception itself is clear,Server did not recognize the value of HTTP Header SOAPAction
That means the soap envelope you are sending has a header which has element SOAPAction whose value is not recognized by the server. If SOAPAction elemnt is required then try to put proper value in it & then post it to the SOAP service.
Use TCPMonitor to monitor the request that is being sent to server, it will provide you a clear idea.