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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:08:54+00:00 2026-05-30T04:08:54+00:00

I’m trying to pass information between domains using a combination of jQuery and WCF.

  • 0

I’m trying to pass information between domains using a combination of jQuery and WCF. This works really well for passing simple data types. This is demonstrated by the TestSimple Method below. However when I use the TestComplex method the WCF method receives nothing as the address parameter.

Hopefully an example will make my question clearer:

WCF Service:

 Function TestSimple(postcode As String) As BasicAddress Implements ISubmitVehicle.TestSimple
      Return Test(postcode)
 End Function

Function TestComplex(Address As BasicAddress) As BasicAddress Implements ISubmitVehicle.TestComplex
    If Address Is Nothing Then
        Return Test("Nothing")
    Else
        Return Test(Address.Postcode)
    End If
End Function

Function Test(postcode As String) As BasicAddress
    Return New BasicAddress With {
        .Building = "Test", .County = "Test", .Latitude = 0, .Locality = "Test",
        .Longitude = 0, .Street = "Test", .Town = "Test", .Postcode = postcode}
End Function

Client Script

function TestSimple() {
     var data = { postcode: "test" };
     Test(data, 'TestSimple');
}

function TestComplex() {
     // I also tried
     //var data = { Address: { Postcode: 'test' } }
     var data = { 
          Address: { "__type": "BasicAddress:#WPC.FADS.Web",
              "Building": "Test",
              "County": "Test",
              "Latitude": 0,
              "Locality": "Test",
              "Longitude": 0,
              "Postcode": "test",
              "Street": "Test",
              "Town": "Test"
          }
     }
     Test(data, 'TestComplex');
}

function Test(data, method) {
    $.getJSON(baseURL + 'Services/SubmitVehicle.svc/' + method + '?callback=?', data,
    function (NewBasicAddress) { alert(NewBasicAddress.Postcode); })
}

Data Contract:

<DataContract()>
Public Class BasicAddress
     <DataMember()> Property Building As String 
     <DataMember()> Property Street As String 
     <DataMember()> Property Locality As String 
     <DataMember()> Property Town As String 
     <DataMember()> Property County As String 
     <DataMember()> Property Postcode As String 
     <DataMember()> Property Latitude As Double
     <DataMember()> Property Longitude As Double
End Class

The Request for the TextComplex method

GET /Services/SubmitVehicle.svc/TestComplex?callback=jQuery15107153733184290069_1329385242312&Address%5B__type%5D=BasicAddress%3A%23WPC.FADS.Web&Address%5BBuilding%5D=Test&Address%5BCounty%5D=Test&Address%5BLatitude%5D=0&Address%5BLocality%5D=Test&Address%5BLongitude%5D=0&Address%5BPostcode%5D=test&Address%5BStreet%5D=Test&Address%5BTown%5D=Test&_=1329385253384 HTTP/1.1

The Response for the TextComplex method

jQuery15107153733184290069_1329385242312({"__type":"BasicAddress:#WPC.FADS.Web","Building":"Test","County":"Test","Latitude":0,"Locality":"Test","Longitude":0,"Postcode":"Nothing","Street":"Test","Town":"Test"});

TestSimple works but TestComplex does not, Is what I’m trying to achieve with TextComplex possible?

EDIT

also tried without the __type parameter as suggested by Zach:

var data = {
      Address: {
          "Building": "Test",
          "County": "Test",
          "Latitude": 0,
          "Locality": "Test",
          "Longitude": 0,
          "Postcode": "test",
          "Street": "Test",
          "Town": "Test"
      }
  }

Operation contracts:

   <OperationContract()>
   <WebGet(ResponseFormat:=WebMessageFormat.Json)>
   Function TestSimple(postcode As String) As BasicAddress

   <OperationContract()>
   <WebGet(ResponseFormat:=WebMessageFormat.Json)>
   Function TestComplex(Address As BasicAddress) As BasicAddress
  • 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-30T04:08:55+00:00Added an answer on May 30, 2026 at 4:08 am

    After some research I think the answer is “no”. See REST / SOAP endpoints for a WCF service for more details.

    In case anyone else comes across this problem, what I did in the end is for each method I expose I created two operation contracts:

    One which could be consumed using “GetJSON” from cross domain client script which included only simple parameters.

    One which included complex objects as parameters but could not be consumed from cross domain client script.

    The methods implementing the operation contracts both call the same code.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,

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.