For our example, we are using a PHP web page to interact with our web service.
Note: The point of this example is to show that any program that can access web services can now interact with VTS. You could call the web service from another VTS application, from a CGI script in a web page as shown here, or from your own web-enabled application. While the following code does work, in no case should it be taken as representing a fully developed application.
The process of making the call to VTS's web services is to send a SOAP encoded message calling the operations that we exposed with the WSDL file. Depending on your application, you may or may not need to explicitly include a header with the SOAP-encoded message. If so, the header would look something like this:
POST /TagQueryServicesRealm/SOAP/ HTTP/1.1
Host: localhost
Content-Type: text/xml; charset="utf-8"
Content-Length: 343
SOAPAction: "http://localhost/GetTagValue"
In the case of our PHP example, this header is not required as the PHP SOAP client object takes care of it automatically.
<html><head><title>VTS Web Services Tester</title></head>
<body bgcolor="#ffffff">
<?php
echo "<h2>VTS Web Services Tester</h2>";
// create an instance of PHP's SOAP client object
// the client should not need a local copy of the .WSDL. It can pull it from the server
$client = new SoapClient("http://localhost/QueryServicesRealm/WSDL");
$params = array('TagName'=>'AI20_1');
try {
$result = $client->GetTagValue($params);
$tagvalue = $result->TagValue;
echo "The value of AI20_1 is ".$tagvalue
} catch (SoapFault $exception) {
echo $exception;
}
?>
</body>
</html>