Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6686521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:10:53+00:00 2026-05-26T05:10:53+00:00

I have IDispatchMessageFormatter implementation class ServerMessageFormatter : IDispatchMessageFormatter { private IDispatchMessageFormatter Formatter; public ServerMessageFormatter(IDispatchMessageFormatter

  • 0

I have IDispatchMessageFormatter implementation

    class ServerMessageFormatter : IDispatchMessageFormatter
{
    private IDispatchMessageFormatter Formatter;

    public ServerMessageFormatter(IDispatchMessageFormatter formatter)
    {
        this.Formatter = formatter;
    }

    public void DeserializeRequest(System.ServiceModel.Channels.Message message, object[] parameters)
    {
        Formatter.DeserializeRequest(message, parameters);
    }
}

and in OperationBegavior

        public void ApplyDispatchBehavior(OperationDescription operationDescription, DispatchOperation dispatchOperation)
    {
        ServerMessageFormatter Formatter = new ServerMessageFormatter(dispatchOperation.Formatter);
        dispatchOperation.Formatter = Formatter;
    }

and call soap service

  GetInfoRequest message = CheckedFields;
    string soap = @"<?xml version=""1.0"" encoding=""utf-8""?>
            <soap12:Envelope xmlns:soap12=""http://www.w3.org/2003/05/soap-envelope"">
              <soap12:Header>
                <Action soap12:mustUnderstand=""1"" xmlns=""http://www.w3.org/2005/08/addressing"">ServiceModel/IService/GetSoapData</Action>
              </soap12:Header>
            <soap12:Body>
        <GetInfoRequest  xmlns=""ServiceModel"">
            <Data xmlns:d4p1=""http://schemas.microsoft.com/2003/10/Serialization/Arrays"" xmlns:i=""http://www.w3.org/2001/XMLSchema-instance""/>
        </GetInfoRequest>
        </soap12:Body>
        </soap12:Envelope>";
    XmlSerializer serializer = new XmlSerializer(typeof(GetInfoRequest));
    HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create("http://dev.add.renault.com/Service.svc/soap");
    MemoryStream stream1 = new MemoryStream();
    serializer.Serialize(stream1, message);
    stream1.Position = 0;
    StreamReader sr = new StreamReader(stream1);
    string t = sr.ReadToEnd();
    t = t.Remove(0, 22).Trim();
    t = string.Format(soap, t);
    ASCIIEncoding encoding = new ASCIIEncoding();
    request.Timeout = 99999999;
    request.ContentLength = t.Length;
    request.Method = "POST";
    request.ContentType = "application/soap+xml; charset=utf-8";
    request.Accept = "application/soap+xml; charset=utf-8";

    using (Stream stm = request.GetRequestStream())
    {
        using (StreamWriter stmw = new StreamWriter(stm))
        {
            stmw.Write(t);
        }
    }

    var response = (HttpWebResponse)request.GetResponse();
    var abc = new StreamReader(response.GetResponseStream());

Problem is that when I call my REST service and set breakpoint in DeserializeRequest I see that Formatter has set value from Operation Behavior. But when call soap service my Formatter has null value and deserialization was aborted. Why when calling soap I have that problem? Any idea?

Unfortunatelly I can not fire breakpoint in Operaration Behavior and see what value have dispatchOperation…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:10:53+00:00Added an answer on May 26, 2026 at 5:10 am

    You don’t show how you configure your service to add your custom IDispatchMessageFormatter extension. So just taking a guess here, you may be adding it only to the webHttpBinding endpoint and not to the soap based binding endpoint. If you are using the WebHttpBehavior methods (GetRequestDispatchFormatter & GetReplyDispatchFormatter) then this won’t apply to your soap endpoints. This blog post has a good overview of how to use IDispatchMessageFormatter with webHttpBinding and basicHttpBinding.

    EDIT:
    The specific code in the article that shows how to add the a custom message formatter to the basicHttpBinding is below. Just prior to that section, he explains why this approach is necessary.

        //--- snipped ---//
    
        string baseAddress = "http://" + Environment.MachineName + ":8000/Service";
        ServiceHost host = new ServiceHost(typeof(Service), new Uri(baseAddress));
        ServiceEndpoint endpoint = host.AddServiceEndpoint(typeof(ITest), new BasicHttpBinding(), "");
        endpoint.Contract.Operations.Find("Add").Behaviors.Add(new MyOperationBehaviorAttribute());
        host.Open();
    
        //--- snipped ---//
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have you used VS.NET Architect Edition's Application and System diagrams to start designing a
Have you managed to get Aptana Studio debugging to work? I tried following this,
Have following setup: MainActivity class - extends activity MyLayout class - extends View Prefs
have such zend query: $select = $this->_table ->select() ->where('title LIKE ?', '%'.$searchWord.'%') ->where('description LIKE
Have a look at the menus on this page: http://www.pieterdedecker.be/labs/vspwpg/?page_id=96 They look okay in
Have same challenge as this guy: How to copy dependencies to gae war/WEB-INF/lib Applying
have a wierd issue. for the life of me can't trace this back (its
Have a slight problem. Trying to post XML to a server. To do this,
have tried a few different approaches to this but with no success so far.
Have a xml data like <Items><Item><name>test1</name></Item><Item><name>test2</name></Item></Items> Looks like jaxb cannot unmashall this when defining

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.