We help IT Professionals succeed at work.
Get Started

How do I write a C# client to consume a WCF RESTFul service with mutiple input parameters?

jxbma
jxbma asked
on
1,987 Views
Last Modified: 2016-03-07
Hi:

I have a WCF Restful service call which expects multiple parameters.

Consider the following data and service contracts.
public class ClassA
{
   public string aString{ get; set;}
   public int aInt {get; set;}
}

public class ClassB
{
   public string bString{ get; set;}
   public int bInt {get; set;}
}

[ServiceContract]
public interface ISampleService
{
   [OperationContract(IsOneWay = false)]
   ClassC GetSomeData(ClassA classA, string sValue, ClassB classB);
}

Open in new window


I have a C#/winform based test application. I know all these parameters need to be wrapped before calling the service. I'm having difficulty figuring out what the C# code to call the service would look like on the client side.

Can someone show me an example of how I would structure the code on the client side to call the above defined service?

Thanks, JB
Comment
Watch Question
CERTIFIED EXPERT
Top Expert 2015
Commented:
This problem has been solved!
Unlock 1 Answer and 18 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant

An Experts Exchange subscription includes unlimited access to online courses.

Get Started
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE