|
|
|
The Developer's Resource & Community Site
|
'Running your first Web Services in 15 minutes' for Windows 95, 98, NT & 2000
A tutorial reproduced by permission of Salcentral
How To Guide?
So what is the Search Engine for?
It is all very well us telling everyone that this is the worlds first
WSDL search engine (in the left nav bar of this page), but because this part of the industry is
still very much in its infancy, we're constantly getting emails asking
'What is
a WSDL' or 'how do I use them'. Well here's our best go at
producing a *very* brief description of how to use a WSDL schema from the library.
This document is meant to be a quick and simple guide to running your first web
service, so follow the step by step guide and you should be up
and running your first web service in 15 minutes (fingers
crossed)!
A Brief Explanation of Web
Services
Firstly a WSDL schema is simply a text file which describes a process which
you can use/run on a remote server on the internet. It describes...
- The functions or methods it
has available
- The arguments each function
requires
- The location of the server that can run that functionality
However its not much use on its own, so you also need a piece of
software on your computer that understands this schema and can create methods, set arguments and talk to
the server on your behalf.
This is where a SOAP toolkit can
help...
There are a number of excellent toolkits available at the
moment, for the sake of this simple tutorial we have chosen
the SOAP:Net implementation.
Tutorial for 'Running your first Web Services in
15 minutes' for Windows 95, 98, NT & 2000 |
1. |
Download
and install SOAP:Net from...
Soap:Net for Windows 95, 98, NT & 2000 |
|
|
2. |
Now
lets find a web service we'd like to run. The below search is
an exact duplication of how the main search screen works. The
WSDL schema we are going to use to run our web service, defines a service that
translates text from English into French...
Below is a snippet of the
search screen showing what you should see after performing the
search...
The Schema location shown above
and located at https://www.xmethods.net/sd/BabelFishService.wsdl
is the important bit, this is the WSDL schema that actually
defines what functions & arguments you are allowed to run
along with also identifying the server location that runs
those functions. |
|
|
3. |
Load
the following page, this has a bit of vbScript which runs all the necessary objects locally on your
machine (after you have installed SOAP:Net) and executes the web service on
the remote SOAP server.
My First Web Service
|
|
|
4. |
Press
the 'Translate NOW' button on the My First Web Service
page.... |
|
|
5. |
If
you received back a valid translation, then that's it, you've
just run your first remote web service.
If the code did not run
please see Troubleshooting Notes below... |
|
|
6. |
However, it didn't really explain a lot about what's
happening... So lets briefly look at some of the code we've
used...
(The following code can be copied into either a
Microsoft Visual
BasicĀ® project or into a web page as vbScript using the
appropriate script tags)
Dim
oBA |
'Use
the business area component to create functions and hold
schemas |
Dim
oEX |
'Execute
component that talks to the remote server |
|
|
Set
oBA = CreateObject("lcTkPoSBA.CSOAPBusinessArea") |
'Create
business area |
Set
oEX = CreateObject("lcTkPoEXE.CSOAPExecute") |
'Create
execute function |
|
|
oEx.GetSchemas
oBA, "https://www.xmethods.net/sd/BabelFishService.wsdl" |
'Add
schema into the business area (you can add multiple
schemas if required) |
|
|
oBA.SP.Add
"BabelFishService","BabelFish" |
'Create
a function or method off the business area, ready to
send to the remote SOAP server (you can add multiple
functions if the server supports it). |
|
|
oBA.SP("BabelFish")("translationmode")="en_fr" |
'Set
the ' translationmode' argument (this argument is
specific to the BabelFishService web service, other web
services will have differently named arguments, or may
have no arguments). In the 'My First Web
Service' page this value is taken from the forms field. |
oBA.SP("BabelFish")("sourcedata")="Hello
sir" |
'Set
the 'sourcedata' argument. In the 'My First Web Service'
page this value is taken from the forms field. |
|
|
oEX.Execute
oBA |
'Now
execute the process against the remote server. |
|
|
msgbox
oBA.SP("Babelfish")("return") |
'Now
display the return value from the web service. In
the 'My First Web Service' page this value is put into
one of the forms fields. |
|
|
|
Troubleshooting
Notes |
'ActiveX component can't create
object' error then you need to change the "Initialize and script ActiveX
controls not marked as safe" option on the security tab inside Internet
Explorer from Disable to Prompt. If the problem persists ensure that you have downloaded
and installed SOAP:Net from Soap:Net for Windows 95, 98, NT & 2000. Please note any
previous copies of SOAP:Net (previously the Lucin SOAP
Toolkit) must be uninstalled before a new version is
installed. If the problem continues to persist, and you have not
rebooted your machine since the installation of SOAP:Net,
reboot your machine. |
'Error
on page' or 'Error'
appears at the bottom of the page Ensure that the
security internet settings allow your browser to 'Run
ActiveX controls and plug-ins' (change this option from
'disable' to 'prompt' or
'enable') and 'Initialize and script ActiveX controls
not marked as safe' (again, change this to 'prompt' or 'enable'). |
'Server
failed to return any data' Try again, this is likely
to only be a very temporary problem, if the problem
persists, contact [email protected]
for an alternative server. |
Any
other problems email us at [email protected]. |
|
Contribute to IDR:
To contribute an article to IDR, a click here.
|
|