Friday, January 4, 2013

TIP: How to view log statements generated by WSO2 ESB log mediator in System Logs UI?

When you use log mediator inside sequences and proxy services in WSO2 ESB , the logs are shown by default in wso2carbon.file which can be found in CARBON_HOME/repository/logs directory. The same logs are viewable from "System Logs" page in ESB management console.
However, from ESB-4.5.X releases, you should do the following simple change in order to see these logs in "System Logs" UI in management console.

Step 1
Open CARBON_HOME/repository/conf/axis2/axis2.xml

Step 2
Uncomment the following element.

             <handler class="org.wso2.carbon.utils.logging.handler.TenantDomainSetter" name="TenantDomainSetter">

Now, restart the server. Send a request to ESB and see the logs in "System Logs" UI in management console.

Wednesday, November 21, 2012

TIP: Error handling in WSO2 ESB APIs when the requested API resource does not match with the given URL template or pattern

When you send a HTTP request to an API in WSO2 ESB, if the requested API resource URL does not comply with the API resource definition, ESB returns HTTP 202 accepted response to the user. Due to  this behavior, the client is unable to distinguish if they have made an error. We can use the following procedure to return a fault to the client in case of non-matching API resource is requested by client.

Step 1:

Suppose, we have an API similar to the following. Note that, the target web service is a JAXRS web application (jaxrs_basic) which is included in WSO2 Application Server by default.

<api xmlns="http://ws.apache.org/ns/synapse" name="jaxrs" context="/jaxrs">
<resource methods="GET" uri-template="/customers/{id}">
<inSequence>
<send>
<endpoint>
<address uri="http://localhost:9764/jaxrs_basic/services/customers/customerservice"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<send/>
</outSequence>
</resource>
</api>

Step 2:

Send the following HTTP GET request to the above API. (You can use a soapUI web testcase as instructed in one of my previous blog posts).

GET http://localhost:8280/jaxrs/customers-wrong/123

Step 3:

You will get HTTP 202 accepted response because the request URL does not match with the resource url-template defined in the API.

Step 4:

Now, add the following fault handling sequence in ESB. Once the API receives a request which does not match with any of the resource url patterns/templates, this sequence will be invoked. Make sure to name the sequence as _resource_mismatch_handler_

 <sequence xmlns="http://ws.apache.org/ns/synapse" name="_resource_mismatch_handler_">
<payloadFactory>
<format>
<tp:fault xmlns:tp="http://test.com">
<tp:code>404</tp:code>
<tp:type>Status report</tp:type>
<tp:message>Not Found</tp:message>
<tp:description>The requested resource (/$1) is not available.</tp:description>
</tp:fault>
</format>
<args>
<arg xmlns:ns="http://org.apache.synapse/xsd" expression="$axis2:REST_URL_POSTFIX"/>
</args>
</payloadFactory>
<property name="RESPONSE" value="true" scope="default"/>
<property name="NO_ENTITY_BODY" action="remove" scope="axis2"/>
<property name="HTTP_SC" value="404" scope="axis2"/>
<header name="To" action="remove"/>
<send/>
<drop/>
</sequence>

Step 5:

Send the above HTTP GET request again. This time, you will get a proper error as shown below.

HTTP/1.1 404 Not Found
Content-Type: application/xml; charset=UTF-8
Accept-Encoding: gzip,deflate
Host: 10.100.3.37:8280
Date: Fri, 16 Nov 2012 06:06:51 GMT
Server: Synapse-HttpComponents-NIO
Transfer-Encoding: chunked

Monday, November 19, 2012

How to enable mail transport for WSO2 data services

We can use mail transport to send and receive messages to and from web services using MIME complaint mail messages. We can configure mail transport for Axis2 services which are deployed in WSO2 Application Server by following the instructions given in the official documentation.
In there, you will notice that, a set of mail transport specific parameters need to be configured in the services.xml of Axis2 service in order to enable mail transport in Axis2 services.
How can we do the same for data services which are deployed in WSO2 Application Server?
This post summarizes the procedure of configuring mail transport for a data service.

Step 1:

Download and install WSO2 Application Server-5.0.0 or a later version. Configure mail transport sender and receiver in axis2.xml configuration file which can be found at CARBON_HOME/repositiry/conf/axis2/axis2.xml (see WSO2 Application Server official documentation on how to configure mail transport sender and receiver in axis2.xml)
After configuring axis2.xml, make sure to restart the server.

Step 2:

Once the server is started, you will see the existing services become faulty with the warnings similar to the following. 

WARN {org.apache.axis2.transport.mail.MailTransportListener} -  Unable to configure the service TestService for the MAILTO transport: Service doesn't have configuration information for transport mailto. This service is being marked as faulty and will not be available over the MAILTO transport.

The reason for this is, though we have configured mail transport globally in axis2.xml configuration file, we have not configured mail transport at individual service level. Thus, if you have Axis2 Services or data services or any other service type, the mail transport will not be enabled for them. You can configure mail transport for specific Axis2 services as instructed in here.

However, data services do not have a services.xml associated with it by default. Thus, we need to follow a different procedure for them.

Step 3:

Locate the *.dbs file in CARBON_HOME/repository/deployment/server/dataservices/ directory. Let's assume the data service is GUEST_T_DataService.dbs. Create a file GUEST_T_DataService_services.xml at the same directory. (Make a note of the name of the file which is in the format; _services.xml)

GUEST_T_DataService_services.xml can be similar to the following. Note the mail related parameters section.

<serviceGroup>
<service name="GUEST_T_DataService">
<Description>This sample demonstrates some of the main functionalities of a dataservice using an RDBMS data source
</Description>
<!--mail related parameters-->
<parameter name="transport.mail.Address">synapse.demo.1@gmail.com</parameter>
<parameter name="transport.mail.Protocol">pop3</parameter>
<parameter name="transport.PollInterval">5</parameter>
<parameter name="mail.pop3.host">pop.gmail.com</parameter>
<parameter name="mail.pop3.port">995</parameter>
<parameter name="mail.pop3.user">synapse.demo.1</parameter>
<parameter name="mail.pop3.password">mailpassword</parameter>

<parameter name="mail.pop3.socketFactory.class">javax.net.ssl.SSLSocketFactory</parameter>
<parameter name="mail.pop3.socketFactory.fallback">false</parameter>
<parameter name="mail.pop3.socketFactory.port">995</parameter>
<parameter name="transport.mail.ContentType">text/xml</parameter>


</service></serviceGroup>


Step 4:

Now, check the dashboard of your data service. You will see mail transport is enabled as shown below. (Restart server if the mail transport is still not enabled for data service).

 










Thursday, November 1, 2012

Input/Output Redirection


Unix provides the capability to change where standard input comes from, or where output goes using a concept called Input/Output (I/O) redirection. I/O redirection is accomplished using a redirection operator which allows the user to specify the input or output data be redirected to (or from) a file. Note that redirection always results in the data stream going to or coming from a file.

The

Tuesday, October 30, 2012

Difference Between Linux and UNIX




 UNIX is copyrighted name only big companies are allowed to use the UNIX copyright and name, so IBM AIX and Sun Solaris and HP-UX all are UNIX operating systems. The Open Group holds the UNIX trademark in trust for the industry, and manages the UNIX trademark licensing program.
Most UNIX systems are commercial in nature.
Linux is a UNIX CloneBut if you consider Portable Operating System

Monday, October 29, 2012

"Web Services Testing with soapUI" book is published!

It is with extreme pleasure that I announce, Web Services Testing with soapUI, the first book authored by me, is now published! This is a remarkable achievement of my life and I'm really happy to make the first announcement about the new book through my blog.



On 9th of September 2011, Packt publishers suggested me to write a book on soapUI. By that time, I had published many blog posts about soapUI and SOA/Web services testing. I hesitated to take the challenge at first, because I had been extremely busy with my work at WSO2 and I doubted whether I would find any spare time to work on authoring a book. After taking various facts into consideration, I agreed to start the authoring process in November 2011.
Writing a book has been a great experience. I read a lot and gathered a great deal of information. Finally, I was able to complete the book with 332 pages, covering almost all important features of the free version of soapUI.

I always loved to read and write since my school days. My father and mother guided me to read news papers from my early childhood. I still remember, I published my own news paper when I was studying at grade 6 and represented it in many exhibitions at my school. Therefore, I have no others but my beloved family to whom the book was dedicated for!

Excerpt from page 11:


"This book is dedicated to my parents, who have raised me to be the person I am today 
and my beloved wife Thushari and my loving kids, Risith and Nethul."

I acknowledged all who helped me in many ways to make the book successful, as follows.

Excerpt from page 5:


Making a book reality takes many dedicated people, and it is my great pleasure to
acknowledge their contributions.
First, I'd like to thank Packt Publishers, in particular, Kartikey Pandey – Senior
Acquisition Editor, who proposed me to write this book. I'm grateful for all the
help I got from the editorial staff at Packt Publishers in reviewing this book,
specially Hithesh Uchil – Lead Technical Editor and Sai Gamare who coordinated
the progress of writing, by ensuring that I stayed on track.
This book has benefited from a great set of technical reviewers. I'd like to thank
each of them for volunteering their time reviewing drafts of this book and providing
valuable feedback. Specially, my colleague at WSO2 QA team, Evanthika Amarasiri
who carried out in-depth quality assurance process in all chapters by executing
each sample.
I sincerely thank my wife, Thushari for her patience, support, and understanding
throughout the writing process. Many thanks to my beloved parents who raised me,
made me the person who I am today by providing their insightful guidance in all
aspects of my life.
Though I'm unable to name individually, I would like to extend my heartfelt
gratitude to many colleagues at WSO2, who never hesitated to give their support to
the fullest extent, whenever I requested help on various subject matters. I must thank
Dr. Sanjiva Weerawarana, Founder, Chairman and CEO of WSO2, Inc. whose vision
inspires me and guides me to accomplish my career aspirations.
Finally, a big thank goes to the developers and contributors of Smartbear software
for making soapUI the world's best open source web services testing tool.


If you are a part of a team that builds service-oriented solutions or makes use of web
services in your project, and your primary involvement is testing such a solution,
then this book is the ideal reference for you. This book will help you to understand
the common challenges of SOA testing and how soapUI can be utilized effective
manner in testing your applications.
This book would also be a good reference for developers and QA engineers who do
researches and evaluations on various commercial and open source web services
testing tools. Though you are an experienced software professional or a novice tester, you
will quickly be able to learn the most important features of soapUI by following the
simple step-by-step instructions given in this book.


The contents of the book has been classified into 13 chapters as follows.


Chapter 1, Web Services Testing and soapUI, introduces soapUI by giving an overview
of its history, features, and installation of soapUI in your computer. We will begin
our journey towards learning soapUI by discussing some key characteristics of SOA,
Web services and Web services testing in general.

Chapter 2, The Sample Project, introduces the sample web services project which will be
used as the target application for functional and performance testing in the remaining
chapters of the book. In this chapter, we will build a simple web services based
application using Apache Axis2 open source web services framework. The primary
objective of building this sample application is to use it in all demonstrations of soapUI
features. As we will not discuss any topics related to soapUI or web services testing
in general in this chapter, you may skip the details and download the sample web
services project from http://www.PacktPub.com/support.

Chapter 3, First Steps with soapUI and Projects, serves as a guide for getting started with
soapUI projects. Based on one of the web services that we built as part of the sample
web services project in Chapter 2, The Sample Project, we will discuss the schema and
WSDL of the web service in detail. We will use soapUI to invoke the operations of
sample web service and discuss the SOAP requests, responses, and faults.


Chapter 4, Working with Your First TestSuite, demonstrates the basic constructs of a
soapUI project—TestSuites, TestCases, and TestSteps—which prepares you for the
next chapters of the book. We will also look into the validation of responses using
assertions and soapUI properties.

Chapter 5, Load and Performance Testing with soapUI, covers the steps that you
would have to follow when using soapUI as a load and performance testing
tool. We will demonstrate the load test strategies provided by soapUI and the
load test specific assertions.

Chapter 6,Web Services Simulation with soapUI, briefly describes how web services can
be simulated using soapUI. We will demonstrate the usage of soapUI mock services
model and static as well as dynamic mock responses.

Chapter 7, Advanced Functional Testing with soapUI, introduces the testing aspects of
web services extensions such as WS-Security and WS-Addressing. We will use an
improved version of the sample web services project which we built in Chapter 2, The
Sample Project for the demonstrations in this chapter.

Chapter 8, Getting Started with REST Testing, introduces the concepts related to
RESTful web services and how soapUI can be utilized in RESTful services testing.
We will demonstrate the use of soapUI in RESTful services testing by using a
publicly hosted sample web application.


Chapter 9, Testing Databases with soapUI, briefly describes the direct database query
invocations of soapUI. In this chapter, we will discuss the database testing features
provided by soapUI such as JDBC requests and assertions.

Chapter 10, JMS Testing with soapUI, demonstrates the use of JMS in soapUI. By
exposing one of the sample web services over JMS transport, we will explore
the JMS testing capabilities provided by soapUI.

Chapter 11, Extending soapUI with Scripting, introduces the scripting facilities given
by soapUI in order to extend the default behavior of soapUI tests. We will look into
the use of soapUI API methods through Groovy scripts inside our tests.

Chapter 12, Automated Testing with soapUI, demonstrates various automated testing
approaches with soapUI. In this chapter, we will discuss the integration of soapUI
tests with build tools such as Apache Maven.

Chapter 13, Miscellaneous Topics, introduces some useful tools integrated with soapUI
such as WS-I validation tool and the utilities provided by external web services
framework such as Apache Axis2. This chapter also demonstrates the use of soapUI
when testing services by sending attachments.

Download the book from http://www.packtpub.com/web-services-testing-with-soapui/book today and let me know your thoughts.




Monday, October 22, 2012

Using VRTSexplorer utility to gather information useful for Symantec Corporation Technical Support








VRTSexplorer , also known as
Veritas Explorer, VxExplorer, vxexplorer, and vxexplore,
is a tool provided by Symantec Corporation Technical Support that