gpt4 book ai didi

javascript - 删除 XML 消息

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:23:01 24 4
gpt4 key购买 nike

一个多星期以来,我一直在尝试在 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

最佳答案

问题不见了

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

关于javascript - 删除 XML 消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50830589/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com