Skip to content

Instantly share code, notes, and snippets.

@YannRobert
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YannRobert/9343601 to your computer and use it in GitHub Desktop.
Save YannRobert/9343601 to your computer and use it in GitHub Desktop.
poor man's soap client for sepamail webservice
#!/bin/sh
export WS_SERVER=skemqxqxxxx.test.sepamail.eu
#export WS_SERVER=sogefrp0.test.sepamail.eu
#export WS_SERVER=bpcefrppxxx.test.sepamail.eu
#export WS_SERVER=bnpafrppxxx.test.sepamail.eu
#export WS_SERVER=cmcifrpaxxx.test.sepamail.eu
## you should provide a file containing a valid SOAP request
## a valid minimal SEPAmail request that can be used to be sent is like the following
##
###### <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Header/><env:Body><ns3:sendMissive xmlns:ns3="http://xsd.sepamail.eu/1206/wsdl"><in>aGVsbG8=</in></ns3:sendMissive></env:Body></env:Envelope>
##
echo "<env:Envelope xmlns:env=\"http://www.w3.org/2003/05/soap-envelope\"><env:Header/><env:Body><ns3:sendMissive xmlns:ns3=\"http://xsd.sepamail.eu/1206/wsdl\"><in>aGVsbG8=</in></ns3:sendMissive></env:Body></env:Envelope>" > sample_soap_request_hello.xml
export REQUEST_FILE=sample_soap_request_hello.xml
export PKDIR=pk
## providing certificates and private key have been extracted from the PKCS12 file using openssl command like follows
###### export P12_FILE=skemqxqxxxx-tst-flash.p12
###### openssl pkcs12 -in ${P12_FILE} -out ${PKDIR}/ssl_ca.pem -cacerts -nokeys
###### openssl pkcs12 -in ${P12_FILE} -out ${PKDIR}/ssl_client.pem -clcerts -nokeys
###### openssl pkcs12 -in ${P12_FILE} -out ${PKDIR}/ssl_key.pem -nocerts
export WEB_SERVER_BASE_URL=https://${WS_SERVER}
#export WEB_SERVER_BASE_URL=http://localhost:8086/smpl_webservices
export WS_URL=${WEB_SERVER_BASE_URL}/test/soap
echo ""
echo " ----- STEP 1 ----- ----- ----- ----- -----"
echo ""
echo "Verify if the WebSite is accessible at root Context Path ..."
curl -v --key ${PKDIR}/ssl_key.pem --cacert ${PKDIR}/ssl_ca.pem --cert ${PKDIR}/ssl_client.pem --noproxy "localhost" -X GET ${WEB_SERVER_BASE_URL}
echo ""
echo " ----- STEP 2 ----- ----- ----- ----- -----"
echo ""
echo "Sending SOAP Request to the test/soap webservice ..."
curl -v --key ${PKDIR}/ssl_key.pem --cacert ${PKDIR}/ssl_ca.pem --cert ${PKDIR}/ssl_client.pem --noproxy "localhost" -X POST -H "Content-Type: application/soap+xml; charset=utf-8" --data @${REQUEST_FILE} ${WS_URL} | tee soapresponse.txt
## the HTTP response is expected to be exactly equal to :
##
###### <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Header/><env:Body><ns3:sendMissiveResponse xmlns:ns3="http://xsd.sepamail.eu/1206/wsdl"><out/></ns3:sendMissiveResponse></env:Body></env:Envelope>
##
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment