I was looking for a SSL Restful client to send xml messages to physical MDM. There is a post on IBM site, which shows how to use Apache Wink REST client API to make unsecured (HTTP) call. Here is the link where you can find the sample:

ref: https://www.ibm.com/support/knowledgecenter/en/SSWSR9_11.4.0/com.ibm.mdmhs.dev.platform.doc/concepts/c_rest_web_services_sample_code.html

As my testing environment was secured (HTTPS), the call was failing. Here are few steps I did to send transaction over HTTPS.

1. Use InstallCert.java to get certificate from mdm server and add in local jre keystore. Compile the java file before running. The download package has a readme file. Read it before you proceed to get more information.
(ref: https://github.com/escline/InstallCert)
1.1. Go to  your jre installation location (..\Java\jre1.8.0_121\lib\security).  Run

java InstallCert mdmsrv:9043 (here mdmsrv is MDM secured server on WAS)

You will something similar when fetching certificate is done:

Added certificate to keystore ‘jssecacerts’ using alias ‘mdm114116-1’

1.2. keytool -exportcert -alias mdmsrv-1 -keystore jssecacerts -storepass changeit -file mdmsrv.cert (command to export certificate to mdmsrv.cert file)
1.3 keytool -importcert -alias mdmsrv -keystore cacerts -storepass changeit -file mdmsrv.cert (command to import certificate to jre keystore)
1.4 keytool -list -keystore cacerts (list all jre certificates. notice number of entries before and after adding certificate)

2. Use the client sample posted here:
[REST Web Services: Sample client code]
https://www.ibm.com/support/knowledgecenter/en/SSWSR9_11.4.0/com.ibm.mdmhs.dev.platform.doc/concepts/c_rest_web_services_sample_code.html
3. Add following jars to your REST client application class path:

activation-1.1.jar
commons-codec-1.10.jar (http://commons.apache.org/proper/commons-codec/download_codec.cgi)
commons-lang-2.3.jar
geronimo-jaxrs_1.1_spec-1.0.jar
jaxb-api-2.2.jar
jaxb-impl-2.2.1.1.jar
slf4j-api-1.6.1.jar
slf4j-simple-1.6.1.jar
stax-api-1.0-2.jar
wink-client-1.4.jar
wink-common-1.4.jar

You should see proper response from MDM. The key is to add certificate in your client jre (where you want to run the client).

Hope it will help.

 

 

 

 

 

Advertisements