Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: WCF jQuery JSON
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 23:41pm
Umais ASGHAR at 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 at 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
0 OriginalGriff 300
1 ProgramFOX 165
2 Peter Leow 130
3 Fredrik Bornander 85
4 Sergey Alexandrovich Kryukov 85
0 OriginalGriff 300
1 ProgramFOX 165
2 Peter Leow 130
3 Sergey Alexandrovich Kryukov 85
4 Maciej Los 80

Advertise | Privacy | Mobile
Web04 | 2.8.150301.1 | Last Updated 15 Jan 2013
Copyright © CodeProject, 1999-2015
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