Overview

The calculator is a web service using the SOAP protocol and reside in thisserver,exclusively used by this LB4 tutorial, it is exposing four end points thatresembles the operation of a basic calculator as follows:

  • add
  • subtract
  • divide
  • multiply

SOAP Calculator Payloads

It expects two integer parameters named intA and intB in therequest for all the four exposed methods.

SOAP WS Request

The SOAP Web Service is expecting the following payload on a request, notice thetwo properties named intA and intB respectively. The following is just asample for the Add method.

  1. <soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:wsdl=\"http://wsdl.example.org/\">
  2. <soapenv:Header/>
  3. <soapenv:Body>
  4. <wsdl:Add>
  5. <intA>50</intA>
  6. <intB>5</intB>
  7. </wsdl:Add>
  8. </soapenv:Body>
  9. </soapenv:Envelope>

SOAP WS Response

The SOAP Web Service will respond to LB4 with the following xml result,based on the corresponding successfully invoked method, in this case the sampleis just for the Add method.

  1. <SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns1=\"http://wsdl.example.org/\">
  2. <SOAP-ENV:Body>
  3. <ns1:addResponse>
  4. <value>55</value>
  5. </ns1:addResponse>
  6. </SOAP-ENV:Body>
  7. </SOAP-ENV:Envelope>

Objective

To integrate this SOAP Web Service in our LB4 application in order tomake it available to any front-end client requiring REST Services.

In real life, you can have several legacy SOAP Web Services integrated byLB4 in a single application or in several micro services, the scenario willdepend upon your designed architecture and not LB4.

Integration Outcome

LB4 will make it very simple for any client application to access this SOAPWeb Service through the REST API endpoints exposed by LB4, as a developerthis SOAP protocol and the XML->JSON->XML transformation works transparently.

REST API Request

Any REST API client will just need to send /add/50/5 to the Add operationend point and our application will handle all the details.

REST API Response

LB4 will process the XML payload sent by the remote SOAP Web Service andconvert it to JSON format before sending it back to the client application.

  1. result: {
  2. value: 55;
  3. }

Navigation

Previous step: Tutorial overview

Next step:Create your app scaffolding