DEV Community

Danilo Soares Cardoso
Danilo Soares Cardoso

Posted on

Testing requests to SOAP Webservices in Weblogic

Every time when I work with a new technology, I like to read more about this stuff and do some experiments. When we work with development, this lead us to that way, learning with the pratice and day-by-day activies. One of the examples of this learning that I acquired in the last months was working with some new technologies in my career.

In the area that I am responsible for at TCS, one of the applications we care for is made in Java and runs on Weblogic, a server maintained by Oracle for Java EE systems. Something very interesting that I have been deepening in the last months dealing with Weblogic is the test of web services that it brings as standard, called Web Services Test Client.

This tool is very useful because it allows tests to be done quickly, without having to create mocks in SoapUI, for example. According to the official documentation, the Web Services Test Client is used to:

  • test basic functionality to test the correct operation of the 'deployed' webservice
  • basic security tests for authentication
  • view the web service WSDL
  • advanced tests, such as atomic transactions, sending SOAP messages, Oracle Web Service Manager (OWSM) security policies, among others

If you have a web service implemented on a Weblogic server, it is very easy to access the Web Services Test Client, just access the URL http://host:port/ws_utc of your project. The host must be replaced by the Weblogic server being used and the port must be the one used by your Weblogic (usually port 7001 is used as the default).

Exemplifying

I will show below some screenshots of how the test scenario can be set up. For the example, I used this repository available on Github. After uploading the environment, just access the project URL following the pattern mentioned above, and what will appear will be the screen below:

Weblogic Web Service Test Client

Image 1 - Endpoints registered in the application

In the screen above we can see the two endpoints created in this project, "GetRhymingWorld" and "Hello". When clicking on the first, we have the screen shown below, listing the received parameters and options for authentication, addressing, among others. For our example, we will only use the function of passing parameter, to check how the API tests work in this scenario.

Weblogic Web Service Test Client
Image 2 - Parameter of the first endpoint

This application's endpoint was created to receive a word and return its rhymes from the Datamuse website. I took the test searching for the word 'Java'. When clicking on 'Invoke', Weblogic will send a request to the API, bringing the results in xml format.

Below we see the xml that was returned with the English synonyms for the word 'Java'. We can also see that there is some data in JSON, but this is because this is the way that the Datamuse API returns its results. Nothing that a simple stop in the application does not solve.

Weblogic Web Service Test Client
Image 3 - Endpoint return

It is worth mentioning that there are other applications that bring the same type of functionality, such as SoapUI. The difference is that with this tool you gain a little more agility because it is already a feature implemented in Weblogic, in addition to having one more option for the time when multiple tests are needed.

If you have any suggestions or questions, just send me in the comments or by message!

Top comments (0)