/*
Asset Suite IFBO (Integration Framework Business Objects)
WSDL 1.1 Ref: Entry in wsdl: http://schemas.xmlsoap.org/wsdl/soap12/ (paste into browser)
SOAP 1.2 Ref: Entries in the wsdl
JAX-WS 2.1.7 Ref: /jaxws-ri/docs/ReleaseNotes.html
Java 1.5 Ref: Must match version JAX-WS was built with.
Synchronous Ref:
Certificate length and Signature Algorithm are defined in the etc/deploy-targets.xml.
Verify certificate by accessing wsdl via browser and looking at certificate.
Define TLS/SSL for web service endpoint within Tomcat:
/tomcat/webapps/jaxws-ifbo-wsdl-xml-secure/WEB-INF/web.xml
Transport Layer Security (TLS)/Secure Sockets Layer (SSL) with no Mutual Authentication (server authentification). Ref: http://java.sun.com/developer/EJTechTips/2006/tt0527.html#1
<security-constraint>
<web-resource-collection>
<web-resource-name>ifboService</web-resource-name>
<url-pattern>/ifboService</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
PassPortGeek.com Winter 2009
*/
// Unix commands for defining certificate location, creating web service stubs, and creating jar file of web service stubs.
//
// Define shell variable WSIMPORT_OPTS to let the Java environment know where to find SSL certificates.
// export WSIMPORT_OPTS="-Djavax.net.ssl.trustStore=.../jaxws-ri/samples/ifbo-wsdl-xml-secure/etc/certs/client.truststore"
//
// Use wsimport to create stubs:
// .../jaxws-ri/bin/wsimport.sh -keep -extension -verbose https://server:port/jaxws-ifbo-wsdl
-xml-secure/ifboService?wsdl
//
//Create a zip file and rename it to jar and put in the classpath.
// find ./assetsuite/ifbo_wsdl_xml_secure -name "*.class" -print | zip ./ifboWsdlXmlSec -@
//
// Windows commands for same.
//
// Verify Java version 1.5 with: java -version
//
// Define shell variable WSIMPORT_OPTS to let the Java environment know where to find SSL certificates.
// set WSIMPORT_OPTS="-Djavax.net.ssl.trustStore=.\tomcat.keystore"
// Note that tomcat.keystore and client.truststore depend on how you created the certificates.
//
// Use wsimport to create stubs:
// wsimport.bat -keep -extension -verbose https://server:port/jaxws-ifbo-wsdl-xml-secure/ifboService?wsdl
//
// If the above setting of WSIMPORT_OPTS and execution of wsimport.bat doesn't work, try:
// java -Djavax.net.ssl.trustStore=.\tomcat.keystore -jar w:\temp\java\jaxws-ri\
lib\jaxws-tools.jar -keep -extension -verbose https://server:port/jaxws-ifbo-wsdl-xml-secure/ifboService?wsdl
//
//Create a zip file and rename it to jar and put in the classpath.
// Not sure how to do this in Windows.
//
Experiment of IFBO as a webservice (client)
/*
Asset Suite IFBO (Integration Framework Business Objects)
WSDL 1.1 Ref: Entry in wsdl: http://schemas.xmlsoap.org/wsdl/soap12/ (paste into browser)
SOAP 1.2 Ref: Entries in the wsdl
JAX-WS 2.1.7 Ref: /jaxws-ri/docs/ReleaseNotes.html
Java 1.5 Ref: Must match version JAX-WS was built with.
Synchronous Ref:
Certificate length and Signature Algorithm are defined in the etc/deploy-targets.xml.
Verify certificate by accessing wsdl via browser and looking at certificate.
Define TLS/SSL for web service endpoint within Tomcat:
/tomcat/webapps/jaxws-ifbo-wsdl-xml-secure/WEB-INF/web.xml
Transport Layer Security (TLS)/Secure Sockets Layer (SSL) with no Mutual Authentication (server authentification). Ref: http://java.sun.com/developer/EJTechTips/2006/tt0527.html#1
<security-constraint>
<web-resource-collection>
<web-resource-name>ifboService</web-resource-name>
<url-pattern>/ifboService</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
PassPortGeek.com Winter 2009
*/
// Unix commands for defining certificate location, creating web service stubs, and creating jar file of web service stubs.
//
// Define shell variable WSIMPORT_OPTS to let the Java environment know where to find SSL certificates.
// export WSIMPORT_OPTS="-Djavax.net.ssl.trustStore=.../jaxws-ri/samples/ifbo-wsdl-xml-secure/etc/certs/client.truststore"
//
// Use wsimport to create stubs:
// .../jaxws-ri/bin/wsimport.sh -keep -extension -verbose https://server:port/jaxws-ifbo-wsdl
-xml-secure/ifboService?wsdl
//
//Create a zip file and rename it to jar and put in the classpath.
// find ./assetsuite/ifbo_wsdl_xml_secure -name "*.class" -print | zip ./ifboWsdlXmlSec -@
//
// Windows commands for same.
//
// Verify Java version 1.5 with: java -version
//
// Define shell variable WSIMPORT_OPTS to let the Java environment know where to find SSL certificates.
// set WSIMPORT_OPTS="-Djavax.net.ssl.trustStore=.\tomcat.keystore"
// Note that tomcat.keystore and client.truststore depend on how you created the certificates.
//
// Use wsimport to create stubs:
// wsimport.bat -keep -extension -verbose https://server:port/jaxws-ifbo-wsdl-xml-secure/ifboService?wsdl
//
// If the above setting of WSIMPORT_OPTS and execution of wsimport.bat doesn't work, try:
// java -Djavax.net.ssl.trustStore=.\tomcat.keystore -jar w:\temp\java\jaxws-ri\
lib\jaxws-tools.jar -keep -extension -verbose https://server:port/jaxws-ifbo-wsdl-xml-secure/ifboService?wsdl
//
//Create a zip file and rename it to jar and put in the classpath.
// Not sure how to do this in Windows.
//
import assetsuite.ifbo_wsdl_xml_secure.*;
import java.io.*;
public class ifboWsdlXmlSecure {
private static String program = "ifboWsdlXmlSecure";
public static void main (String[] args) {
String currentMethod = "main";
String fileXML = "fileXML";
fileXML = args[0];
/* Read file */
// Get the size of the file
File input = new File(fileXML);
long filelength = input.length();
// Create the byte array to hold the data.
// The array size matches the file size.
byte fileByteArray[] = new byte[(int)filelength];
try {
FileInputStream fis = new FileInputStream(input);
filelength = fis.read(fileByteArray);
fis.close();
} catch (UnsupportedEncodingException ee) {
System.out.println("IOException error" + ee.getMessage());
} catch (IOException e) {
System.out.println("IOException error" + e.getMessage());
}
System.out.println("filelength = " + filelength);
/* end Read file */
try {
IfboServicePortType port = new IfboService_Service().getIfboServicePort();
String IFBOxml = new String(fileByteArray);
String resultS = "";
System.out.printf (program + " " + currentMethod + " invoking ifboService(%s)\n", IFBOxml);
resultS = port.ifboService(IFBOxml);
System.out.printf ("The result of ifboService is %s.\n", resultS);
} catch (IfboServiceFault_Exception ex) {
System.out.printf ("Caught IfboServiceFault_Exception: %s\n", ex.getFaultInfo().getFaultInfo ());
}
}
}