2

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> 
user1201810
  • 23
  • 1
  • 5
  • refer http://stackoverflow.com/questions/492407/operationformatter-encountered-an-invalid-message-body an answer states The BodyStyle in the operation contract has been set to WrappedResponse. Change the BodyStyle to WebMessageBodyStyle.Bare. – Devjosh Feb 10 '12 at 10:40
  • @Devjosh, that question isn't relevant to this one: this one is about SOAP endpoint, while BodyStyle (in WebGet/WebInvoke) is about non-SOAP ones. – carlosfigueira Feb 10 '12 at 14:49
  • @user1201810, can you post the actual request which is being made to this service (i.e., the one sent by the 3rd party)? Feel free to strip any identifyable information for the client. – carlosfigueira Feb 10 '12 at 14:50

1 Answers1

4

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.

Shiraz Bhaiji
  • 64,065
  • 34
  • 143
  • 252
  • Thanks, i knew it had to be something simple, i kept trying to match the tns: part as well. you sir have made my day! thank you! – user1201810 Feb 10 '12 at 15:25