c# - Connecting to a Gateway Service

I am trying to connect to a gateway service:

The Service says this when I "Add Web Reference" to the service it says:

The HTML document does not contain Web service discovery information.

The gateway service shows this:

You have created a service.

To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax:

svcutil.exe http://xxxxxxxxxxxxxxx.com/API/Gateway.svc?wsdl

This will generate a configuration file and a code file that contains the client class. Add the two files to your client application and use the generated client class to call the Service. For example:


class Test { static void Main() { GatewayClient client = new GatewayClient();

    // Use the 'client' variable to call operations on the service.

    // Always close the client.
} }

Visual Basic

Class Test Shared Sub Main() Dim client As GatewayClient = New GatewayClient() ' Use the 'client' variable to call operations on the service.

    ' Always close the client.
End Sub End Class

So, I try connecting to this instead:


That gives me the following list:

Methods AddABAccount ( ) CloseBatch ( ) CopyVaultAccount ( ) ProcessAccount ( ) ProcessCustomer ( ) ProcessCustomerAndAccount ( ) ProcessTransaction ( ) ProcessVaultTransaction ( ) UpdateABAccount ( ) UpdateABSchedule ( ) UpdateTransaction ( )

So, I am able to add it...

But, when I try to connect to it in code as they suggests:

GatewayClient Client = new GatewayClient("wsBinding");
oT.AMOUNT = 1;
oT.TEST = "FALSE"; // When testing, use TRUE
oT.METHOD = "CC"; // We'll use a credit card
oT.ORDERID = GetOrderID(); // Define a unique id for each transaction
oT.CODE = "0000"; // An Auth only transaction
//Process the Transaction
oGr = Client.ProcessTransaction(oT);
//Close the Client
//Handle approved transaction
//Handle declined transaction
//Handle transaction error

I am not able to access GatewayClient, it says:

Cannot resolve symbol 'GatewayClient'

Where do I find GatewayClient!?

1 Answer

  1. Nicholas- Reply


    When adding a Web Reference you are trying to add a reference to an oldfashioned .asmx Web Service.

    The Service you actually try to reference is a WCF Web Service - starting with Visual Studio 2008 when adding a service reference WCF Web Services are the preferred option (you'll have to dig to some "advanced" options to add an .asmx Web Service).

    To use the Web Service client proxy created for you, make sure to include the namespace in your using statements.

    The default namespace that is set when adding the Service Reference is "ServiceReference1", so adding

    using ServiceReference1;

    should solve your problem.

Leave a Reply

Your email address will not be published. Required fields are marked *

You can use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>