我使用一个或多或少完整的svc文件接管了在asp.net c#中创建的项目。我有第三方试图连接到这项服务。 并且他们在尝试运行DownloadOrders操作时收到错误
很抱歉,如果这是愚蠢的,但我不知道SOAP webservices
OperationFormatter遇到无效的Message正文。预计会找到名为“DownloadOrders”的节点类型“Element”和名称空间“http://schema.example.com”。找到名为'tns:downloadOrders'和名称空间'http://schema.example.com'的节点类型'Element'
我有代码
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();
}
}
我通过在互联网上猜测并找到我能做的任何东西尝试了一些事情,但我没有运气。
任何帮助都会非常适合
EDITED 在此感谢第三方的请求
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>
答案 0 :(得分:4)
名称不匹配:
DownloadOrders
和
tns:downloadOrders
注意资本化的差异。您必须确保服务器和客户端匹配。