Back to Web Services Resources and Tutorials
To write an console application client outside of Visual Studio, you will first need to create a .NET proxy to the JBoss web service, then refer to it (in DLL form) from the client application. These same steps occur in Visual Studio; they are just performed in the process of creating Web References. You'll need the .NET wsdl.exe utility, to create the proxy, and then csc.exe to compile it into a DLL, and to compile the command-line test client. If you have Visual Studio installed, you will be able to find wsdl.exe under that distribution; the .NET Framework should have the C# compiler csc.exe. Both utilities are available from the Visual Studio command prompt (in Windows XP, reach this via "Start | All Programs | Microsoft Visual Studio .NET 200X | Visual Studio .NET Tools | Visual Studio .NET 200X Command Prompt)
From the top-level tutorial directory, create a directory called C#.NET. From that directory, execute the following:
wsdl.exe /l:CS /protocol:SOAP ..\wsdl\tutorial.wsdlthis will generate a file called TutorialService.cs in the same directory. Since Axis won't like the unqualified attributes on the web-service request parameters, open this file and change the "Unqualified" attribute on the PingRequestType's "requestParam" to "Qualified". Then, from the C#.NET directory, compile the proxy into a DLL with
csc.exe /t:library /r:System.Web.Services.dll /r:System.Xml.dll TutorialService.cs
For the console application, you can write one in a text editor or just use the Tutorial.cs file generated in the Visual Studio version. If you use the version generated in Visual Studio, you will need to make some modifications:
Next, compile this from the C#.NET directory (assuming the client is in the same directory) with:
csc.exe /r:TutorialService.dll Tutorial.csthen execute the application Tutorial.exe with the command
Tutorial endpointURL pingMessagewhere the endpoint URL is either
http://localhost:8080/jboss-net/services/TutorialService_Port?wsdlfor the JBoss-3.2.7 version, or
http://localhost:8080/tutorial/pingfor the JBoss-4.0.3 and Sun Application Server versions. You should see the following output or something similar, depending on the details of your client and which web service you are targeting:
C#/.NET tutorial web service client: Ping request parameter was '.NET Ping' Ping response is 'This is the JBoss 3.2.7 response to request '.NET Ping''