Web Service Overview

mondCloud provides a browser based wizard for defining web services. Using the wizard, web service definition is simplified into a 6 step process. Once the web service is defined using the wizard, you can generate the WSDL and the documentation for the web service and its operations by the click of a button.

Challenges in returning multiple values from a Web Service

According to the industry, returning multiple web service values is not easy. Although returning multiple values from a web service is quite a common requirement, it could be quite a daunting task for a beginner learning web service." This is because, in Java a method cannot return multiple values. Java provides a workaround by using the concept of WS Holder. MOND WS makes it extremely easy to return multiply values by generating the java code to take care of multiple output parameters.

Example Web Service

In 20 minutes or less, let us create a web service that takes two input numbers, and returns the sum and product of the two numbers.

Requirements

There is no software to download, install. No knowledge of Java/WSDL is required.The development and testing can be done using a browser.You do not need Eclipse to create the web services or SOAPUI to test it.

Define Web Service

Define Web Service

  • Click here to login to the mondCloud™ BPM.
  • Navigate to Wizards -> Web Service Page.
  • Click New Web Service.
  • In the Web Service Name field, enter the name "MathService" for the web service
  • In the Version field, enter the version number "1.0". You can use the version number to trace and control the change history of the web service.
  • In the Namespace field, enter the namespace "com.fin.math". The namespace is a logical name for information about this service. Please ensure that the namespace entered is unique across all web services.
  • In the Description field, enter a brief description for the web service. The documentation generated for the web service will contain the description and hence it is only appropriate to mention a detailed description of the Web Service. This will also be part of the generated document.
  • Click Next.
  • Click New Operation.
  • In the Web Service Operation field, enter a name for the web service operation. There should not be any spaces in the web service operation name.
  • In the Description field, enter a brief description for the web service operation. The documentation generated for the Web Service will contain the description and hence it is only appropriate to mention a lucid description of the Web Service Operation.
  • Click Next.

Enter Web Service Operation Input Details

  • Click Add New Row and choose int in Data Type drop down and type firstNumber in Field Name. Press enter to save row.
  • Click Add New Row and choose int in Data Type and type secondNumber in Field Name. Press enter to save row.
  • Click Next.

Enter Web Service Operation Output Details

  • Click Add New Row and choose int in Data Type and type sumOutput in Field Name. Press enter to save row.
  • Click Add New Row and choose int in Data Type and type productOutput in Field Name. Press enter to save row.
  • Click Next.

Enter Web Service Operation Implementation Details

  • In the Project field, select a project where the web service implementation map will be created. Choose New Project and enter project name MathProjects
  • In the Map field, select New Map in order to define a new implementation map.
  • In the Map Name field, enter the name of the implementation map. You can enter AddAndMultiplyMap
  • Click Next.

Publish Web Service

  • Click Save & Publish
  • Once the web service details are saved successfully, you will receive success message.
  • Click the “x” button to close out of the success message
  • Once web service is saved successfully, the deployment process would have started in the background.
  • The deployment process may take 20-30 seconds. While it is being deployed, you will see intermediate status messages from the deployment process. For example, you may see something like “Compiling required classes”, “Generating Service Endpoint” etc.
  • Once the Web Service is fully deployed, you will see the WSDL URL.
  • Click WSDL URL to see the contents of the published WSDL file in the next tab of browser.

Web Service Published and Available

  • That is all – your web service is fully deployed and available!
  • All but one step is remaining – that is to actually implement the business logic which computes sum and product.

Define Web Service Implementation using mondCloud™ ESB

Implementation of web service can be done without writing Java code. mondCloud Integration Development Console provides a service development interface which can be used by business analysts to develop service logic using a standard web browser.

  • Click here to login to  mondCloud™ESB
  • Click the Build tab. Based on your access rights you might see Build, Test, Deploy and Manage tabs.

Define business logic of the Web Service Operation

  • Choose MathProjects in Project drop down and the list of mondCloud Services under MathProjects Project will be shown.
  • The mondCloud Map which you created as part of the web service Implementation, that is, AddAndMultiplyMap is listed.
  • Click mondCloud Service AddAndMultiply to start defining the business logic.

Define business logic of the Web Service Operation

  • You will see the mondCloud™ Service development interface using which you can define the business logic to be applied when web service operation addAndMultiply is invoked
  • On the first row, click Add at Same Level.

Define business logic of the Web Service Operation

  • For computing sum of the two numbers, choose the operator Math->Add
  • Choose $firstNumber as Operand1 and $secondNumber as Operand2.
  • You will notice that the operation input variables defined in the Web Service Wizard, that is, firstNumberand secondNumber are automatically populated in the Operand drop downs.
  • Choose $sumOutput as Set Field.
  • You will notice that the operation output variables defined in Web Service Wizard, that is sumOutput and productOutput are automatically populated in the Set Field drop down.
  • Click Save. 

Define business logic of the Web Service Operation

  • Click Add at Same Level.
  • For computing product of the two numbers, choose the operator Math->Multiply.
  • Choose $firstNumber as Operand1 and $secondNumber as Operand2
  • You will notice that the operation input variables defined in the Web Service Wizard, that is, firstNumberand secondNumber are automatically populated in the Operand drop downs.
  • Choose $productOutput as Set Field.
  • You will notice that the operation output variables defined in Web Service Wizard, that is sumOutput and productOutput are automatically populated in the Set Field drop down.
  • Click Save.

Define business logic of the Web Service Operation

  • Now your mondCloud Service should look similar to below screenshot.
  • That is all! The web service implementation is complete.
  • Now, all that is remaining is to actually test the web service.
  • To see the input and output for this service, click Input Output button.

Test Web Service Operation

You can quickly test the web service from within mondCloud without needing SOAP UI or any other web service client.

Test Web Service Operation

  • On the left hand side navigation menu choose Web Service/Rest->Web Service.
  • You will notice that the web service which you created, that is, MathService is listed.
  • Click MathService to view details.

Test Web Service Operation

  • Click Service Operation tab to view details of the operation addAndMultiply.
  • Click Simulate icon that is next to operation name and SOAP version.

Test Web Service Operation

  • In the Simulate screen you will see the WSDL URL, Port and Operation details.
  • Click Generate Sample Request and mond will generate a sample SOAP request for the addAndMultiply operation.

Test Web Service Operation

  • Edit the generated sample request to set firstNumber as 10 and secondNumber as 5.
  • Click Simulate.

Test Web Service Operation

  • You will see the Web Service SOAP response where in and sumOutput and productOutput have been computed by mondCloud web service operation and returned as a SOAP response.
  • That is it! You have defined, deployed and tested a fully operational web service that returns multiple values in just a few clicks.

Conclusion

In this section, you defined a web service that takes two input numbers and returns the sum and product of the two numbers. You deployed and tested the web service without leaving the browser window and all this took not more than 20 minutes!

Your Message to mondCloud
Optional Information That Helps Us Process Your Request Faster