Unified Software
DEVELOPERS

Overview
How BankVal Works
Technical Details

Cookbook

.NET
VB 5/6
VBA
Java
Perl
PHP
Javascript
SAP

Service Information
F.A.Q.s

 

Free Trial Register now for a free 30 day (or 300 hits) trial of BankVal.
<< Click Here >>

<< Why register? >>
 Java

Many SOAP toolkits are available for Java. Good examples are:

Apache Axis http://ws.apache.org/axis/
Systinet WASP
The Mind Electric GLUE
Cape Clear Cape Connect
IONA XMLBus
BEA Workshop
etc.

Alternatively you can write Java client code that doesn't use a toolkit. The following example accesses the bankvalidate service.


// Requires Java Secure Socket Extension (JSSE) if using J2SE < 1.4

import java.net.*;
import java.io.*;

public class soapclient {

public final static String SERVER
= "https://www.unifiedsoftware.co.uk/cgi-bin/bankvalSOAP.cgi";
public final static String SOAP_ACTION
= "http://www.unifiedsoftware.co.uk/BankValSOAP#bankvalidate";

public static void main(String[] args) {

if (args.length == 0) {
System.out.println(
"Usage: java soapclient params");
return;
}
String input = args[0];
String server = SERVER;
System.setProperty("java.protocol.handler.pkgs",
"com.sun.net.ssl.internal.www.protocol");
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());

try {
// Proxy settings
//System.setProperty("proxySet", "true");
//System.setProperty("https.proxyHost", "192.168.0.1");
//System.setProperty("https.proxyPort", "80");

URL url = new URL(server);
URLConnection urlc = url.openConnection();
HttpURLConnection connection = (HttpURLConnection) urlc;

connection.setDoOutput(true);
connection.setDoInput(true);
connection.setRequestMethod("POST");
connection.setRequestProperty
("Content-Type", "text/xml; charset=utf-8");
connection.setRequestProperty("SOAPAction", SOAP_ACTION);

OutputStream out = connection.getOutputStream();
Writer writeout = new OutputStreamWriter(out);

writeout.write
("<?xml version='1.0' encoding='UTF-8'?>\r\n");
writeout.write
("<SOAP-ENV:Envelope ");
writeout.write
("xmlns:xsi=");
writeout.write
("'http://www.w3.org/1999/XMLSchema-instance'\r\n");
writeout.write
("xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/'\r\n");
writeout.write
("xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'\r\n");
writeout.write
("xmlns:xsd='http://www.w3.org/1999/XMLSchema'\r\n");
writeout.write
("SOAP-ENV:encodingStyle
='http://schemas.xmlsoap.org/soap/encoding/'>\r\n");
writeout.write
("<SOAP-ENV:Body><namesp1:bankvalidate xmlns:namesp1");
writeout.write
("='http://www.unifiedsoftware.co.uk/BankValSOAP'>");
writeout.write
("<params xsi:type
='xsd:string'>" + input + "</params>\r\n");
writeout.write
("</namesp1:bankvalidate>");
writeout.write
("</SOAP-ENV:Body></SOAP-ENV:Envelope>");

writeout.flush();
writeout.close();

InputStream in = connection.getInputStream();
int c;
while ((c = in.read()) != -1) System.out.write(c);
in.close();

}
catch (IOException e) {
// System.err.println(e);
String SERVER2
= "https://www.unifiedservices.co.uk/cgi-bin/bankvalSOAP.cgi";
String SOAP_ACTION2
= "http://www.unifiedservices.co.uk/BankValSOAP#bankvalidate";
String server2 = SERVER2;

try {
URL url = new URL(server2);
URLConnection urlc = url.openConnection();
HttpURLConnection connection = (HttpURLConnection) urlc;

connection.setDoOutput(true);
connection.setDoInput(true);
connection.setRequestMethod("POST");
connection.setRequestProperty
("Content-Type", "text/xml; charset=utf-8");
connection.setRequestProperty
("SOAPAction", SOAP_ACTION2);

OutputStream out = connection.getOutputStream();
Writer writeout = new OutputStreamWriter(out);

writeout.write
("<?xml version='1.0' encoding='UTF-8'?>\r\n");
writeout.write
("<SOAP-ENV:Envelope ");
writeout.write
("xmlns:xsi=");
writeout.write
("'http://www.w3.org/1999/XMLSchema-instance'\r\n");
writeout.write
("xmlns:SOAP-ENC=
'http://schemas.xmlsoap.org/soap/encoding/'\r\n");
writeout.write
("xmlns:SOAP-ENV=
'http://schemas.xmlsoap.org/soap/envelope/'\r\n");
writeout.write
("xmlns:xsd='http://www.w3.org/1999/XMLSchema'\r\n");
writeout.write
("SOAP-ENV:encodingStyle=
'http://schemas.xmlsoap.org/soap/encoding/'>\r\n");
writeout.write
("<SOAP-ENV:Body><namesp1:bankvalidate xmlns:namesp1");
writeout.write
("='http://www.unifiedservices.co.uk/BankValSOAP'>");
writeout.write
("<params xsi:type=
'xsd:string'>" + input + "</params>\r\n");
writeout.write
("</namesp1:bankvalidate>");
writeout.write
("</SOAP-ENV:Body></SOAP-ENV:Envelope>");

writeout.flush();
writeout.close();

InputStream in = connection.getInputStream();
int c;
while ((c = in.read()) != -1) System.out.write(c);
in.close();
}
catch (IOException e2) {
System.err.println(e2); }

}

} // main

} // soapclient


<< back to top >>
©2003 - 2007 UNIFIED SOFTWARE LIMITED - ALL RIGHTS RESERVED
The BIC information is published with permission of SWIFT SCRL. Database Rights Reserved. 2007.
Unified Software Limited is a VOCA Authorised ISCD Distributor.