Test the BWS accessibility with curl

event_note November 14, 2012

In previous posts we explained how the tool wget can be used as well as Windows PowerShell to test the connectivity to the BioID Web Service (BWS) using client certificates.

Same can be achieved with the tool curl of course.

Preparation

First the SOAP envelope file for the POST request has to be created . This is a simple XML file with following content:

<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope
    xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 <soap:Body>
   <Status xmlns="http://www.bioid.com/2011/12/bws">
        <Status />
  </Status>
</soap:Body>
</soap:Envelope>

Put this file in a directory on your development workstation accompanied by the BWS client certificate file and the private key file. If the certificate and key is in PKCS#12 (PFX) Format you can convert it to a certificate and separate private key file using OpenSSL.

Accessing the BioID Web Service

/usr/bin/curl --cert Client.crt --key Client.key \
              --header "Content-Type: text/xml; charset=utf-8" \              
              --header "SOAPAction: http://www.bioid.com/2011/12/bws/IBioIDWebService/Status" \
              --data @status.xml --output foo.xml \
              https://bws.bioid.com/BioIDWebService.svc

With the Parameter --verbose a much more terse output will be shown.

Output

If everything worked well you'll get an output similar to this:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   917  100   917    0     0    217      0  0:00:04  0:00:04 --:--:--   250

The output from the BWS will be stored in the file foo.xml. This file should contain the current BWS version string and some other status information about the service.