我遇到 WCF 服务错误 ....Found 节点类型 'Element'名称为“tns:downloadOrders”

发布于 2025-01-04 11:45:16 字数 2051 浏览 1 评论 0原文

我已经接管了一个使用 svc 文件在 asp.net c# 中制作的项目,该项目或多或少是完整的。我有第三方尝试连接到此服务。 他们在尝试运行 DownloadOrders 操作时收到错误

抱歉,如果这很愚蠢,但我不知道 SOAP Web 服务

OperationFormatter 遇到了无效的消息正文。期望找到名称为“DownloadOrders”和命名空间“http://schema.example.com”的节点类型“Element”。找到节点类型“Element”,名称为“tns:downloadOrders”,命名空间为“

namespace WebShopServiceLibrary
{
using System;
using System.Collections.Generic;
using System.ServiceModel;

[ServiceContract(Namespace = "http://schema.example.com", Name = "DownloadOrders")]
public interface IWebShopService
{
    [OperationContract]
    bool CompleteOrder(string cartId);
    [OperationContract(Action = "http://mywebsite.com/WebShopService?class=WebShopService&method=downloadOrders",
        Name = "DownloadOrders", ReplyAction = "http://schema.example.com")]

    IList<WSOrder> DownloadOrders();
    [OperationContract]
    string SayHello();
    }
}

http://schema.example.com 没有运气。

任何帮助将不胜感激

编辑 感谢这里是第三方的请求

POST http://www.mywebsite.co.uk/WebShop/WebShopService.svc HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol     2.0.50727.5420)
VsDebuggerCausalityData:    uIDPo6vC8nDAd61IqHUONkdct2QAAAAAPjFJqj7Kp0ucNDHglgII9Lf1sYSLziBNtVp3NnVPAecACQAA
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://thridpartywebsite.com/WebShopService?class=WebShopService&method=downloadOrders"
Host: www.mywebsite.co.uk
Content-Length: 480
Expect: 100-continue
Connection: Keep-Alive

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://schema.example.com" xmlns:types="http://schema.example.com/encodedTypes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><tns:downloadOrders /></soap:Body></soap:Envelope> 

I've taken over a project made in asp.net c# using a svc file that was more or less complete. I have a third party trying to connect to this service.
and they are getting the error when trying to run the DownloadOrders action

Sorry if this is something silly but i have no idea about SOAP webservices

OperationFormatter encountered an invalid Message body. Expected to find node type 'Element' with name 'DownloadOrders' and namespace 'http://schema.example.com'. Found node type 'Element' with name 'tns:downloadOrders' and namespace 'http://schema.example.com'

I have the code

namespace WebShopServiceLibrary
{
using System;
using System.Collections.Generic;
using System.ServiceModel;

[ServiceContract(Namespace = "http://schema.example.com", Name = "DownloadOrders")]
public interface IWebShopService
{
    [OperationContract]
    bool CompleteOrder(string cartId);
    [OperationContract(Action = "http://mywebsite.com/WebShopService?class=WebShopService&method=downloadOrders",
        Name = "DownloadOrders", ReplyAction = "http://schema.example.com")]

    IList<WSOrder> DownloadOrders();
    [OperationContract]
    string SayHello();
    }
}

I've tried a few things by guessing and finding whatever i could on the internet but am having no luck.

Any help would be greatly appriciated

EDITED
Thanks here is the request from the third party

POST http://www.mywebsite.co.uk/WebShop/WebShopService.svc HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol     2.0.50727.5420)
VsDebuggerCausalityData:    uIDPo6vC8nDAd61IqHUONkdct2QAAAAAPjFJqj7Kp0ucNDHglgII9Lf1sYSLziBNtVp3NnVPAecACQAA
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://thridpartywebsite.com/WebShopService?class=WebShopService&method=downloadOrders"
Host: www.mywebsite.co.uk
Content-Length: 480
Expect: 100-continue
Connection: Keep-Alive

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://schema.example.com" xmlns:types="http://schema.example.com/encodedTypes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><tns:downloadOrders /></soap:Body></soap:Envelope> 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

难以启齿的温柔 2025-01-11 11:45:16

名称不匹配:

DownloadOrders

tns:downloadOrders

注意大小写的差异。您必须确保服务器和客户端匹配。

There is a mismatch in the name:

DownloadOrders

and

tns:downloadOrders

Notice the difference in capitalisation. You must make sure that the server and the client match.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文