Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calling a .NET WebService
Message
De
03/02/2010 11:13:56
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Web Services
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Vista
Divers
Thread ID:
01447226
Message ID:
01447275
Vues:
59
>Well, that would be very helpful indeed !

More of a step-by-step guide I guess:

To create the .NET client:

Create a new Project (of type Class Library) in the same solution as your WebService project.

Select References/Add Service Reference
Click the 'Advanced' button - then the 'Add Web Reference' button
Select 'Web Services in this Solution'

(Assuming, since you had a HelloWorld method, you were working with the VS default Webservice):

Select the service (Service1?)
Change the 'Web reference name' if you want - this will become the name for the generated class.
Click 'Add Reference'

This should add a 'Web Reference' folder to the client project.

Create a class as a wrapper. Simple example:
using System.Runtime.InteropServices;
public class MyService
{
    public string SayHello()
    {
        localhost.Service1 s1 = new WSClient.localhost.Service1();
        string result = s1.HelloWorld();
        return result;
    }
}
In 'Project/Properties'
In 'Application' Tab: click 'Assembly Information', check "Make Assembly COM-Visible;
In 'Build' Tab: check 'Register for COM interop'

Build the project. This should create the relevant Registry entries.

Now, from VFP it should just be as simple as:
xx = CREATEOBJECT("WSClient.MyService")
* (WSClient is VS proj name)
? xx.SayHello()
Add other methods as required. Obviously you could opt to hang on to a reference to Service1 in .NET. You could also use a property rather than a method to get the string.

HTH, shout if you have problems.....
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform