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

  • SEARCH
  • Home
  • 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 8594287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:09:47+00:00 2026-06-12T00:09:47+00:00

I have this WCF service: [ServiceContract] public interface IService { [OperationContract] [WebInvoke(Method = POST,

  • 0

I have this WCF service:

    [ServiceContract]
        public interface IService
        {
            [OperationContract]
            [WebInvoke(Method = "POST", UriTemplate = "/PostComments", BodyStyle = WebMessageBodyStyle.Wrapped,
                       RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
            string PostComments(string ItemId, string Comments, string FullName, string Location);
        }

    [DataContract]
        public class Comment
        {
            [DataMember]
            public string ItemId { get; set;}
            [DataMember]
            public string Comments { get; set;}
            [DataMember]
            public string FullName { get; set;}
            [DataMember]
            public string Location { get; set;}
        }

public class Service : IService
    {
       int i = 0;
       public string PostComments(string ItemId, string Comments, string FullName, string Location)
         {
            int Id;
            Id = Convert.ToInt32(ItemId);           
                adp = new SqlDataAdapter("insert into tblComment(intId,strComments,strFullName,strLocation,dtPosted,blnApprove) values("+Id+",'"+Comments+"','"+FullName+"','"+Location+"',GetDate(),1)", offcon);
                adp.Fill(ds1,"Comment");
                DataTable dt = ds1.Tables["Comment"];
                i++;
            }
            if (i > 0)
            {
                return "Comment Successfully Submitted.";
            }
            else
            {
                return "Comment falied to Submit.";
            }
        }

The Final URL is ::http://192.168.1.11/Service.Svc/PostComments

Now my main question is that how to do POST Action in WCF when client is JAVA ?

I get this Error:

The server encountered an error processing the request. The exception
message is ‘The incoming message has an unexpected message format
‘Raw’. The expected message formats for the operation are ‘Xml’,
‘Json’. This can be because a WebContentTypeMapper has not been
configured on the binding. See the documentation of
WebContentTypeMapper for more details.’. See server logs for more
details. The exception stack trace is:

at
System.ServiceModel.Dispatcher.DemultiplexingDispatchMessageFormatter.DeserializeRequest(Message
message, Object[] parameters) at
System.ServiceModel.Dispatcher.UriTemplateDispatchFormatter.DeserializeRequest(Message
message, Object[] parameters) at
System.ServiceModel.Dispatcher.CompositeDispatchFormatter.DeserializeRequest(Message
message, Object[] parameters) at
System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc&
rpc) at
System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&
rpc) at
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&
rpc) at
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc&
rpc) at
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc&
rpc) at
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc&
rpc) at
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc&
rpc) at
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc&
rpc) at
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc&
rpc) at
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc&
rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean
isOperationContextSet)

This is the error when i am trying to run Post method in services.. I dont know how to fix.. But it is working perfectly fine in .net application.
But not in JAVA.
How to fix this.

  • 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-06-12T00:09:49+00:00Added an answer on June 12, 2026 at 12:09 am

    Sorry Guys this was damn Content-type error:
    i set Content-Type as application/json

    and after this the error is about getting raw data from JAVA code
    i told them to send me JSON object means pure Json Data.

    and after this the error left is only foreign key value is conflicting.
    and at last the error solved after doing all this.

    But also don’t forget to check your code of Java as it might possible that your code is the problem check content type n all of your code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a wcf service defined like this: [OperationContract] [WebInvoke(Method = POST, ResponseFormat =
I have something like this: MathServiceLibrary (WCF Service Library) [ServiceContract] public interface IMathService {
I have a WCF-REST service with one method which returns a string: [ServiceContract] public
I have a WCF service which has one method returning a stream. [ServiceContract] public
I have this code in my WCF Service: public class MyImage { public Image
If I need to go from this service contract: [ServiceContract(Namespace=http://api.x.com/Svc1)] public interface IService1 {
Say I have WCF service contract like this [ServiceContract(CallbackContract = typeof(ICallback1), SessionMode = SessionMode.Required)]
I have a WCF service that is deployed on a machine. This WCF service
I have an ASP.NET page that calls to a WCF service. This WCF service
I have a very simple (new to this) RESTful WCF service that uses a

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.