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 6155601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:27:45+00:00 2026-05-23T20:27:45+00:00

I am using the following JQuery\JavaScript code to communicate with a WCF 4 REST

  • 0

I am using the following JQuery\JavaScript code to communicate with a WCF 4 REST service.

<script>
var serviceUrl = "http://services.xiine.com/Xiine/Live/AccountService/rest/json/Login";
var userInfo = {
    "IsNotEncrypted":true,
    "Password":null,
    "UserName":null
};

var loginSuccess = function(data, textStatus, jqXHR){
console.log("yay");
};
var loginError = function(){
console.log("oh no");
};

$.post(serviceUrl , userInfo, loginSuccess);
$.post(serviceUrl , loginSuccess);

</script>

I am trying to establish why it is that the service will correctly return a false value when I do not pass the user data:

$.post(serviceUrl , loginSuccess);

As opposed to when I do pass user data, at which point it gives a POST 400 (Bad Request) error.

$.post(serviceUrl , userInfo, loginSuccess);

I am sure it has to do with how the JSON object, userInfo, is being built or interpreted, and I can post Fiddler 2 or WireShark dumps, if that will help. Just let me know…

I don’t really have access to changing the WCF side of the service, so hopefully there is something I can do on my end to make this work.

Thanks!

Edit

I got a little more information… Apparently, the problem is that the server is responding with the following 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.MessageRpc.Process(Boolean isOperationContextSet)

So I am thinking I need to figure out how to get the object to go across the wire as a JSON object via a JQuery.post() method.

More information — Again…

ok… There is no app.config or web.config, as such.

Here is what I can get as far as the contracts and code and what-not.

[ServiceContract]
public interface IAccount
{
[OperationContract]
bool Login(UserInformation user);
}

[ServiceBehavior(IncludeExceptionDetailInFaults = true)]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class AccountService : IAccount
{
public bool Login(UserInformation user)
{
    //stuff...
}
}

[DataContract]
public class UserInformation
{
[DataMember(IsRequired = true)]
public string UserName;

[DataMember(IsRequired = true)]
public string Password;

[DataMember(IsRequired = true)]
public bool IsNotEncrypted;
}

public interface IUserInformation
{
UserInformation UserInformation { get; set; }
}
  • 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-23T20:27:45+00:00Added an answer on May 23, 2026 at 8:27 pm

    So, I found the answer to my question.

    Someone attempted to point me in the right direction with a mention of the JSON.stringify() method, but it took me a little effort to get it implemented correctly.

    In the end, I used WireShark to sniff out the http request, see what was actually being sent and received, and observe that not only did I need to stingify the data, but I also needed to specify the content type.

    Here is the final code.

    // This is the URL that is used for the service.
    var serviceUrl = "http://services.xiine.com/Xiine/Live/AccountService/rest/json/Login";
    
    
    // This is the JSON object passed to the service
    var userInfo = {
        "UserName": null,
        "Password": null,
        "IsNotEncrypted": true
    };
    
    // $.ajax is the longhand ajax call in JQuery
    $.ajax({
        type: "POST",
        url: serviceUrl,
        contentType: "application/json; charset=utf-8",
    
        // Stringify the userInfo to send a string representation of the JSON Object
        data: JSON.stringify(userInfo),
        dataType: "json",
        success: function(msg) {
            console.log(msg);
            }});
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the following jquery code: $(#top ul li.corner).mouseover(function(){ $(span.left-corner).addClass(left-corner-hover); $(span.right-corner).addClass(right-corner-hover); $(span.content).addClass(content-hover); }).mouseout(function(){
I am using jQuery and Ajax. My MainFile has the following code: <html> <head>
I'm using the following html to load dojo from Google's hosting. <script src=http://www.google.com/jsapi></script> <script
I am using the following jQuery code to fill my DIV in the ASPX
I'm using the following jQuery code to remove options from a select and it
I am using the following jQuery plug-in, i.e: http://flowplayer.org/tools/scrollable.html The issue I am having
I am using jQuery and Ajax, and my Ajax.php file returns the following field
How do you rotate an image using jQuery-rotate plugin? I have tried the following
I am using following PHP code to connect to MS Access database: $odb_conn =
Using the following code I get a nice formatted string: Request.QueryString.ToString Gives me something

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.