JBeckton
JBeckton

Reputation: 7111

Need help using a Service Reference in VS 2010

This is my first time consuming a SOAP web service in ASP.Net and I am a little lost on how this works.

https://www.secureach.com/AchProcessorWebService/AchProcessorService.asmx

I created the Service Reference called AchProcessor in VS 2010 and now I have some Code hints in the VS editor. My first bit of code looks like this..

AchProcessor.WebServiceInfoRequest ws = new AchProcessor.WebServiceInfoRequest();

At this point I am kind of lost.. if I type ws. the only code hint I get is 'Body' with the exception of ToString, GetType etc...

Upvotes: 0

Views: 716

Answers (1)

Grant Thomas
Grant Thomas

Reputation: 45068

Visual Studio would have generated the code using svcutil (or an app named along these lines) as you have seen, among such code is a proxy, or, a client, and this can be used as follows:

using (var client = new MyWebServiceClient())
{
    var result = client.MyMethod();   
}

So, in your case, MyWebServiceClient should be replaced with AchProcessorClient. As mentioned above by John Saunders, use the Object Browser to determine the definite name of the type if not so easily found as described here.

Although an appropriate binding for the service is most likely already in the configuration file, it is worth mentioning that you can actually specify the binding used in the constructor of the client, too.

Upvotes: 1

Related Questions