Fredrik
Fredrik

Reputation: 195

Calling ServiceStack service from WCF client

I have an old SOAP service developed using WCF and also a number of .NET clients using WCF to call the service.

I have created a new service using the ServiceStack framework that implements the same functionality.
Is it possible to call ServiceStack from WCF clients without any code or config changes to the clients?

I am free to make any needed changes to the ServiceStack service.

Edit:
A small step forward.
After adding the correct namespace to AssemblyInfo.cs and appending "/soap11" to the URL the correct service method is finally invoked but the parameter data is not transferred.

The WCF proxy method called in the client takes one parameter "e" which is a class with some string and int properties.
The SOAP body sent over the wire begins with:

<MyMethod xmlns="http://mynamespace">
  <e>
    <PropertyA xmlns="http://schemas.datacontract.org/2004/07/MyProject.Service.Entities">somestring</PropertyA>
    <PropertyB xmlns="http://schemas.datacontract.org/2004/07/MyProject.Service.Entities">123</PropertyB>

The ServiceStack DTO looks like:

[DataContract]
public class MyMethod
{
  [DataMember] public EventData e { get; set; }
}

[DataContract]
public class EventData
{
  [DataMember] public string ProperyA { get; set; }
  [DataMember] public int ProperyB { get; set; }
  ...
}

How do I add the correct property namespace definitions in the service?
Should I need to?

Upvotes: 3

Views: 289

Answers (1)

Fredrik
Fredrik

Reputation: 195

Adding correct namespace to the DataContract attribute in my parameter class solved the problem.

[DataContract(Namespace = "http://schemas.datacontract.org/2004/07/MyProject.Service.Entities")]
public class EventData
{
  [DataMember] public string ProperyA { get; set; }
  [DataMember] public int ProperyB { get; set; }
  ...
}

Upvotes: 2

Related Questions