Click here to Skip to main content
13,558,743 members
Rate this:
Please Sign up or sign in to vote.
See more:
I have a WCF service with a custom class object as paramter.
MyClass Call(MyParameter Parameter)

I need to pass this object, Parameter, to this service and proceed with the rest of the operations in the service. I need to call this service through JQuery. I tried JSON object but it does not work, I must be doing something wrong if it should work, that is.
            type: "GET",
            url: "http://localhost:56779/Service.svc/web/Call",
            data: { Parameter: parameter },
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            username: "xxxx",
            password: "yyyy",
            processData: true,
            success: function (msg) {
            error: function (e) {

var parameter = {
            "Parameter": {
                "ID": "A5",
                "Var": "5",
                "Reference": {
                    "ID": "12345678"
                "Order": {
                    "ID": 10,
                    "Category": {
                        "Price": {
                            "Value": "1000"
                        "Quantity": {
                            "Value": 4
                        "Date": "1/14/2013"

I also tried
data: JSON.stringify(parameter)

but it doesn't work, service is not even called and error occurs. Please let me know how to go about it.

My real task is to send such object as a SOAP message and get a SOAP response; if I don't need to go through JSON, then please guide me directly to achieve my goal.

P.S. I would want to know how to send objects to WCF service, with or without SOAP so, when I'm guided to my goal, I'd be glad to have another guidance regarding this extra goal.

Posted 13-Jan-13 22:41pm
Umais ASGHAR 14-Jan-13 4:49am
This service is being used by a windows form application as well and the return object is also a custom class object.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Umais ASGHAR 15-Jan-13 3:59am
a problem arises, I was using wsHttpBinding at one endpoint (which was used by the windows application) and had to use webHttpBinding for web client. The problem is, there's no security in webHttpBinding and the service is called with or without username-password parameters, which is not acceptable.

P.S. I have a custom username-password authentication module for this service.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01-2016 | 2.8.180515.1 | Last Updated 15 Jan 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100