【问题标题】:Dropping XML message删除 XML 消息
【发布时间】:2018-11-22 15:26:52
【问题描述】:

一个多星期以来,我一直在尝试在 javascript(在 node.js 上运行)客户端脚本和 WCF(SOAP) 服务之间创建通信。

通信是通过:XML,POST方法

xmlhttp.setRequestHeader('Content-Type', 'text/xml; charset=utf-8');

我发送给服务的 URL 和 XML 定义为:

soapRequest('http://winserver:8735/ReportsListsService', 
    `<?xml version="1.0" encoding="UTF-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Header>
      <Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://tempuri.org/IReportsListsService/GetClients</Action>
    </s:Header>
    <s:Body>
      <GetClients xmlns="http://tempuri.org/" />
    </s:Body>
  </s:Envelope>`);

这是我的服务,目前正在尝试调用最简单的方法GetClients

using System;
using System.Collections.Generic;
using System.ServiceModel;
using System.ServiceModel.Web;
using tt4t.Dispatching.ApplicationServer.Data.CommonData;

namespace tt4t.Dispatching.ApplicationServer.Data.Reports.Lists
{
    [ServiceContract]
    public interface IReportsListsService : IMicroservice
    {
  [OperationContract]
        IEnumerable<Client> GetClients();
    }
}

但在 chrome 调试控制台中出现此错误

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault><faultcode>s:Client</faultcode><faultstring xml:lang="en-US">The incoming message contains a SOAP header representing the WS-Addressing 'Action', yet the HTTP transport is configured with AddressingVersion.None.  As a result, the message is being dropped.  If this is not desired, then update your HTTP binding to support a different AddressingVersion.</faultstring></s:Fault></s:Body></s:Envelope>

此错误响应我的 xml 请求的这一行

   <s:Header>
              <Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://tempuri.org/IReportsListsService/GetClients</Action>
   </s:Header>

完整代码:here

【问题讨论】:

    标签: javascript http post xmlhttprequest


    【解决方案1】:

    问题不见了

    xmlhttp.setRequestHeader('SOAPAction', "http://tempuri.org/IReportsListsService/GetClients");
    

    【讨论】:

      猜你喜欢
      • 2018-06-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-10
      • 2018-09-05
      相关资源
      最近更新 更多