Versions of software used:
TIBCO BusinessWorks Designer 220.127.116.11
SOAP UI 3.0.1
A quick round of testing within the Designer before packaging the project and deploying anything on a full scale test setup is always a good idea.
So you have just designed and implemented your first web-service in TIBCO Designer. But what about testing it from outside the TIBCO environment with a non-TIBCO client? After all the point of web-services is to be independent of implementation!
There are several ways of doing this. You could quickly create a client in your language of choice, especially with modern IDEs supporting auto-client generation from the WSDL file. Or you could use a software like SOAP UI and do everything in SOAP without bothering with the SOAP-to-Language API.
Now as such it is VERY EASY to test a web-service running under TIBCO Designer with SOAP UI:
1) Save the WSDL generated by TIBCO (how to save will depend on whether you are using a SOAP Event Source Starter Activity or a Service Resource for your Web-Service).
2) Start SOAP UI and create a new project.
3) It will ask for the WSDL associated with the Web-Service that you want to test, supply the saved WSDL.
4) Click OK and default SOAP requests for all operations will be created by SOAP UI.
Things get a bit complicated when it comes to testing Web-Services which require authentication. This is so because TIBCO leaves authentication with the BusinessWorks Administrator and credentials are defined in the domain (which makes sense). Then how can we check web-services with authentication without needing to package and deploy them?
There is an easy way, especially if you are using basic authentication.
Setting Web-Service to use Basic Authentication
To enable basic authentication in a Service Resource (see image below) you will need to go to the Endpoint Bindings tab within the Service for which you want to set the basic authentication. Select a SOAP endpoint for which you want to setup the authentication. This will give you two tabs, one for Transport and one for SOAP details.
Within the Transport tab you will find a check-box titled ‘Use Basic Authentication’. Select it to use basic authentication.
To achieve the same in a SOAP Event Source starter activity just go to the Transport Details tab within the configuration and you will see a similar ‘Use Basic Authentication’ checkbox.
One word of warning: once you select basic authentication your web-service clients will NOT work till you finish the next step and add a valid username and password to the request.
Enable Authentication in Designer
Now that your web-service is setup for using basic-authentication, you need to setup TIBCO Designer to authenticate incoming requests.
To do this copy tibco\tra\domain\[Domain Name]\AuthorizationDomain.properties to tibco\tra\5.5 (x.x is the version number of the installed TRA, in my case it was version 5.5).
Found this solution here: http://eai.ittoolbox.com/groups/technical-functional/tibco-l/bw-http-basic-authentication-2526019
Final step is to test the web-service using basic authentication.
If you try and invoke the web-service without copying the properties file and without supplying the username and password you will get an ‘Internal Error’ response.
If you try and invoke the web-service without a username or password (irrespective of whether you copied the properties file or not) you will get a ‘This request requires HTTP authentication’ error response.
Once the properties file has been copied to the correct location the only thing that is left is to supply the username and password in the request.
In SOAP UI, navigate to the request generated for the web-service being tested. In the bottom left hand side there will be a Request Properties box (see image below). Scroll till you see the option for Username and Password. Enter the details for the username defined in the properties file (UserID property) and execute the request. This time if all is well then you should get the correct response from the web-service.
If you don’t get the correct response make sure you restart SOAP UI and Designer after copying the file.
Always remember to test your web-service WITHOUT basic authentication BEFORE testing with it. This will ensure there is nothing fundamentally wrong with the web-service.
You do not need to refresh the WSDL file for the web-service after enabling/disabling basic authentication. This is because basic-authentication operates at the level of the HTTP request and does not affect the SOAP content which is a payload of the request. Therefore basic authentication is available for HTTP transport only and not for JMS.