Saturday, November 28, 2015

[WSO2BPS] Uploading a BPEL archive using admin services


Some users want to automate BPEL deployment using external tools. This blog post discuss how you can use BPEL Uploader admin service for this purpose.

Applies to WSO2 BPS 3.x. ( Tested on 3.2.0 )

Viewing wsdl of BPEL Uploader admin service

  1. Change "HideAdminServiceWSDLs" to false in Carbon.xml.
  2. (Re)Start WSO2 BPS server. 
  3. Now you can view BPEL uploader admin service WSDL from 
    • https://localhost:9443/services/BPELUploader?wsdl

Method 1 - Using SOAP UI. 


Create SOAP UI project using "https://localhost:9443/services/BPELUploader?wsdl"



  1. Open upload service request and add an attachment using Attachment tab.
  2. Select your BPEL file from file system. ( eg: Async-Client.zip )
  3. Give File Name in SOAP request  ( Async-Client.zip )
  4. Type "cid:Myzip-File" in dataHandler.
  5. Select Myzip-File in Part column in attachment tab. 
  6. In Auth tab. Configure Basic authentication ( Usernname/passowrd admin/admin - Authenticate Pre-Emptively)
Now you will able to upload BPEL file using SOAP UI. 

Note: When you send above request, SOAP UI automatically replace dataHandler content with base64 encoded content of zip file. 


Method 2 - Using Curl Command line tool.

  1. First Convert zip file content into base64 format. For that use base64 command line tool as follows,

  2. $ base64 Async-Client.zip > base64.txt

  3. Create request.xml file with following content. Replace dataHandler text with content of base64.txt


  4. Use following curl command to upload your BPEL file. 

curl --user admin:admin -k -s -v --header "Content-Type: text/xml;charset=UTF-8" --header "SOAPAction: urn:uploadService" --data @request.xml https://localhost:9443/services/BPELUploader 


-- End --

Wednesday, June 17, 2015

Setting Up Mutual SSL in WSO2 ESB - Enable only for selected proxy services

This Blog post is an updated version of Asela's Blog 

I am using same environment described in my previous blog for this tutorial

Configure WSO2 ESB Server 


1) Edit https transportReceiver in axis2.xml, which is located in /repository/conf/axis2/ folder and Add SSLVerifyClient to optional as follows.
2) Restart ESB Server.

Note: This will make Mutual SSL optional for proxy services exposed on https transport.

Now you will able to Invoke Test Proxy without SSL KeyStore property in SOAP UI. To verify this remove value of SSL KeyStore and Invoke Request 1 Again.



Enable Mutual SSL for Test Proxy


1) Create a ESB XML local entry called MutualSSLPolicy.xml with following content.




2) Add following parameters to Test Proxy. 


( Add these parameters to proxy services you want to enable mutual authentication. )'

3) Final Test proxy will look like this



Testing With SOAP UI 

1) Try Request 1 without SSL KeyStore parameter. Request Fails with SOAP Fault



2) Now try with SSL KeyStore Parameter, Now you will able to invoke Test Proxy Service.




Setting Up Mutual SSL in WSO2 ESB and Testing Using SOAP UI

This Blog post is an updated version of Asela's Blog 


Exchanging Certificates with Client and Server. 


First step is to create Client Key Store and Client Trust Store. Here I am using Java Keytool, which can be found in JDK bin directory.

1) Create Client ( let's call wso2client ) Key Store (wso2clientkeystore.jks)

keytool -genkey -keyalg RSA -keystore wso2clientkeystore.jks  -alias wso2client -dname "CN=wso2client" -validity 3650 -keysize 2048

Provide Store password and Key password.

2) Create Client Certificates. 

keytool -export -keyalg RSA -keystore wso2clientkeystore.jks -alias wso2client  -file wso2client.cert

3) Create Client Trust Store (wso2clientTrustStore.jks)

keytool -import -file wso2client.cert -alias wso2client -keystore wso2clientTrustStore.jks

Provide Trust store password.

4) Export ESB Server Certificate

keytool -export -keyalg RSA -keystore /repository/resources/security/wso2carbon.jks -alias wso2carbon -file wso2carbon.cert

Provide wso2carbon store password "wso2carbon"

5) Import Client Certificate wso2client.cert to WSO2 ESB client-trustStore.jks

keytool -import -file wso2client.cert -alias wso2client -keystore /repository/resources/security/client-truststore.jks

Provide wso2carbon store password "wso2carbon"

6) Import ESB Server Certificate wso2carbon.cert to client-trust store 

keytool -import -file wso2carbon.cert -alias wso2carbon -keystore wso2clientTrustStore.jks


Configure WSO2 ESB Server 


1) Edit https transportReceiver in axis2.xml, which is located in /repository/conf/axis2/ folder and Add SSLVerifyClient to require as follows.




2) Restart ESB Server.

Note: This will Enable Mutual SSL for Proxies on https transport in ESB.

Create Test Proxy

Create a test proxy with Following Content




Testing Test Proxy Using SOAP UI

1) Open SOAP UI and create a SOAP UI project using Test Proxy WSDL. ( https://localhost:9443/services/Test?wsdl )

2) Try to Invoke Test Proxy with default configuration.

As shown bellow, it will fail with javax.net.SSLHandshakeException. This is because Soap UI doesn't have wso2client key store and trust store.



3) Let's Add Key store and Trust Store to Project.  Open Test Project Properties. -> WS-Security Configuration -> Key Store -> Add Key Store as shown in following picture. -> Select wso2clientkeystore.jks



4) Enter store password for wso2clientkeystore.jks




5) Similarly add Client Trust store to SOAP UI ( An optional step for this tutorial )


6) Select SSL Keystore to wso2clientkeystore.jks.



7) Invoke Request 1 again with SSL configuration.



Now you will be able to invoke Test proxy service with Mutual SSL enabled.

In Next blog, I will discuss how to Enable Mutual SSL only for One proxy.

Monday, May 11, 2015

[SOAPUI] Generating an unique property per test case and referring it in multiple requests.


1) Create a SoapUI project and create a test case. 
2) Crete a Script test step and enter following code snippet. This should be the first test step of the test case. 

Node : this will create a property called id  in test case scope. So it won't get altered in multithreaded test.

Groovy Script

def key = java.util.UUID.randomUUID().toString()
context.getTestCase().getProperty( "id" ).setValue(key);



3) You can access property id in using following inline script. 

${=context.getTestCase().getPropertyValue( "id" )}

Example :






Tuesday, January 20, 2015

[Oracle] How to get raw counts of all tables at once


SQL Query : 

select
      table_name,
      to_number(
        extractvalue(
          xmltype(dbms_xmlgen.getxml('select count(*) c from '||table_name))
          ,'/ROWSET/ROW/C')
          )
          count
    from user_tables 
/