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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:40:19+00:00 2026-06-03T20:40:19+00:00

I am running into a problem with webservices. My usual approach to development is

  • 0

I am running into a problem with webservices. My usual approach to development is to create classes like the following.

namespace Project.Entities
{
    public class Entity
    {
        //Some Members        
    }
}
namespace Project.Service
{
    public class EntityService
    {
        public Project.Entities.Entity Get(int EntityID); 
        // More Methods to retrive Entities
    }
}

This works fine for me when the application/website is allowed direct access to the database. I now need to expose the Project.Service methods via a webservice, e.g.

namespace Project.API
{
    public class EntitiyWebService
    {
        [WebMethod()]
        public Project.Entities.Entity Get(int EntityID)
        {
            return new Project.Service.EntityService(EntityID);
        }
    }
}

My problem is that if I call my webservice from another application (which uses Project.Entities) I cannot convert Project.Entities.Entity to Project.API.EntityWebService.Entity. I think I understand why this doesn’t compile, because as far as the compiler is concerned these two classes have nothing in common but their name.

What I really need to know is if I have hit this problem because of bad practises and if I need to start redesigning ASAP, or if I shouldn’t worry about it and just change my references from Entities.Entity to API.EntityWebService.Entity in my app (surely this can’t be the best solution), or how I would go about creating a conversion method since my app and my webservice both use the same DLL, it is only introducing the webservice that the conversion is required. Or if I have the right idea implemented wrongly, or have missed out something. Or none of the above…

I have considered making my webservice just return XML and serialising the results within my app, however this seems like a long winded approach to something there must be a better solution for. Any advice would be much appreciated.

  • 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-03T20:40:21+00:00Added an answer on June 3, 2026 at 8:40 pm

    When dealing with web services, we’ve taken the approach of NOT trying to let .net do the regular serialization/deserialization of custom objects.

    Instead, we pass everything using JSON. There are standard tools out there that make the serialization/deserialization process pretty smooth. Such as http://json2csharp.com/ and http://json.codeplex.com/

    There are several reasons. The first is that by using a standard such as JSON, then pretty much everything out there can consume it. Second, XML is messy… extremely messy. It’s also hard to do right, and very easy to do wrong. Third, we have a MUCH easier time controlling the exact output.

    Finally, an interesting note about passing JSON objects is that you can add new fields to it at the provider and change your consumers at a later date. It’s very forgiving.

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

Sidebar

Related Questions

Running into a problem. I have a table defined to hold the values of
I'm running into a problem when trying to select records from my 2005 MS-SQL
I am running into a problem that just doesn't seem right. I've got a
I'm running into the problem of users being able to submit data with '
I'm running into this problem when trying to call a SOAP Web Service from
My company is running into a problem with a web service that is written
i'm running into a problem in my maven build recently, that it downloads a
I'm running into a problem with Hibernate where when trying to delete a group
I remember running into this problem when I started using OpenGL in OS X.
So I am running into this problem. I am trying to use $.get() to

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.