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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:03:17+00:00 2026-06-15T19:03:17+00:00

The following code samples are from my aspx web service. I would like to

  • 0

The following code samples are from my aspx web service.

I would like to know how it should be changed so that i could return it as an object. All the following codes are on the web service and i am trying to call the object from Android.

So i would just like to know what changes i have to make in order to be able to pass the object.

Any help would be greatly appreciated.

[WebMethod]
public object SomeMethod(Vehicle obj)
{
    return obj;
}

[WebMethod]
public void simpleCase()
{
    Vehicle obj = new Vehicle();
    obj.VehicleID = "KL-9876";
    obj.VehicleType = "Nissan";
    obj.VehicleOwner = "Sanjiva";
}

public class Vehicle
{
    public string VehicleID { get; set; }
    public string VehicleType { get; set; }
    public string VehicleOwner { 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-06-15T19:03:18+00:00Added an answer on June 15, 2026 at 7:03 pm
    [DataContract]
    public class Salesman
    {
    
        [DataMember(Name = "a")]
        public virtual string Id { get; set; }
    
        [DataMember(Name = "b")]
        public virtual int RoleId { get; set; }
    
        [DataMember(Name = "c")]
        public virtual string Name { get; set; }
    
        [DataMember(Name = "d")]
        public virtual string Address { get; set; }
    
        [DataMember(Name = "e")]
        public virtual string Phone { get; set; } 
    } // "a","b","c","d"... are the values with which you'll identify the object properties - client side - when json parsing.
    
    
    
    
     [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
        [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
        public class SalesmanService 
        {
    
            [OperationContract]
            [WebGet(UriTemplate = "/get/{id}", 
                RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
            public Salesman Get(string id)
            {
              //return your salesman
            }
        }
    

    Don’t forget about this in global.asax:

    RouteTable.Routes.Add(new ServiceRoute(“salesman”, new WebServiceHostFactory(), typeof(SalesmanService)));

    Basically you should be able to make such a call:
    “..localhost/salesman/50” for example

    This is just a small sample, you’ll have to put your hands on wcf and json for a wider understanding.

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

Sidebar

Related Questions

I would like to understand how socket work, especially I need some code samples
I have the following code that is used to download files from the server,
The following code is a combination of samples taken from red5. Basically I am
Following code is from a sample of playframework-2.0: /** * Display the dashboard. */
I have downloaded sample code from Apple Center.I also have gone through following question:
I have the following code sample that im trying to wrap my head around
I have the following sample code and noticed that if I attempt to use
I am trying to output audio samples, and do so with cswavplay from http://www.codeproject.com/KB/audio-video/cswavplay.aspx
The following code samples produce the same error when I perform the SAVEAS: Microsoft.Office.Interop.Excel.Application
My question stems from the code samples from Wrox Press's Professional ASP.NET Design Patterns.

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.