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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:18:14+00:00 2026-06-12T19:18:14+00:00

I have WCF service that uses raw messages (Message class). 1) Service side: [DataContract]

  • 0

I have WCF service that uses raw messages (Message class).

1) Service side:

[DataContract]
public class Person
{
    [DataMember]
    public int Id { get; set; }

    [DataMember]
    public string FirstName { get; set; }

    [DataMember]
    public string LastName { get; set; }
}

[ServiceContract]
public interface ITestService
{
    [OperationContract(Action = TestService.RequestAction3)]
    void AddNewPerson(Message newPerson);

public void AddNewPerson(Message newPerson)
{
    Person personToAdd = newPerson.GetBody<Person>();
    Employees.Persons.Add(personToAdd);
}

2) Client side:

TestServiceClient client = new TestServiceClient();

String RequestAction3 = "http://localhost:4249/Message_RequestAction3";
TestService.Person person = new TestService.Person
{
    Id = 6,
    FirstName = "Aleksey",
    LastName = "Alekseyev"
};

Message request3 = Message.CreateMessage(MessageVersion.Default, RequestAction3, person);
string soapRequest = request3.ToString();
client.AddNewPerson(request3);

What’s the problem here? I have Person class (data contract) on service side that is placed in TestService namespace: TestService.Person. Everything is fine on service side. But after I added service reference to client side by using “Add Service Reference…” option in VS2008, there’s no such a type (TestService.Person) on client side. What I did to resolve this issue? I’ve simply copied the file with original data contract (TestService.Person) on client side, created object of Person type and passed it to the service method.

My question is – did I do it in correct way or there is another way to do this?

Thank you in advance.

Goran

  • 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-12T19:18:15+00:00Added an answer on June 12, 2026 at 7:18 pm

    Because Person class is not exposed in none of your service contracts their information is not shared via service metadata. That’s why you get an error on the client side. If you copy the classes to your client with the same namespace that will do.

    However a better solution is to place Person class in another assembly and reference this assembly from your client.

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

Sidebar

Related Questions

I have a WCF service that uses Message contract for request and replies of
I have a WCF service that uses a reference to a class library. Classes
I have a WCF service that uses transport and message security. How do i
I have a wcf service that uses the .net System.AddIns framework to load assemblies
I have a very simple (new to this) RESTful WCF service that uses a
I have an wcf service that is hosted in II6. The service uses the
I have a Data Service created using WCF that internally uses nHibernate. This WCF
I have WCF service that uses wsHttpBinding and authentication with certificate. I run this
I have a wcf service that uses callbacks with DualHttpBindings. The service pushes back
We have a WCF service that uses Entity Framework to query a SQL database.

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.