Tuesday, June 19, 2012

Test WebService on WebSphere Application Server using Curl

1. Export Certificates and Private Keys from key.p12 and trust.p12

copy the effective key store and trust store to /var/tmp

cd /var/tmp

Export all signer certificates to /var/tmp/trust.pem
# openssl pkcs12 -in trust.p12 -out trust.pem -info -nokeys

Export Client Private Key to /var/tmp/key.pem
# openssl pkcs12 -in key.p12 -out key.pem -nocerts

Export Client Certificates to /var/tmp/personal.pem
# openssl pkcs12 -in key.p12 -out personal.pem -clcerts -nokeys


Form your curl command line as below:

curl --capath /var/tmp/curl --cert personal.pem:WebAS --key key.pem --pass WebAS --cacert trust.pem --data @<request xml> -H "Content-Type:text/xml;Charset='UTF-8'" <WebService URL>

i.e.
curl --capath /var/tmp/curl --cert personal.pem:WebAS --key key.pem --pass WebAS --cacert ca.pem --data @xam_in.xml -H "Content-Type:text/xml;Charset='UTF-8'" https://webservice.articy.net:5156/myWebService

1 comment:

  1. Sample with proxy server:

    curl -v -x 20.34.68.51:8080 --capath /var/tmp/soap --cert personal.pem:abcd --key key.pem --pass WebAS --cacert trust.pem --data @fectiva.xml -H "Content-Type:text/xml;Charset='UTF-8'" https://articy.dowjones.com/watchlist.asmx/SearchPersonEntity

    ReplyDelete