DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Low-Code Development: Leverage low and no code to streamline your workflow so that you can focus on higher priorities.

DZone Security Research: Tell us your top security strategies in 2024, influence our research, and enter for a chance to win $!

Launch your software development career: Dive head first into the SDLC and learn how to build high-quality software and teams.

Open Source Migration Practices and Patterns: Explore key traits of migrating open-source software and its impact on software development.

Related

  • Spring Boot - How To Use Native SQL Queries | Restful Web Services
  • How to Consume REST Web Service (GET/POST) in Java 11 or Above
  • Breaking Up a Monolithic Database with Kong
  • RESTful Web Services: How To Create a Context Path for Spring Boot Application or Web Service

Trending

  • A Look Into Netflix System Architecture
  • How to Submit a Post to DZone
  • DZone's Article Submission Guidelines
  • Applying the Pareto Principle To Learn a New Programming Language
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. How to Call SOAP Services Using REST

How to Call SOAP Services Using REST

SOAP, being a mature technology, has an extensive and often differently interpreted standard set. This article discusses how to call SOAP services using REST.

By 
Anthony Morris user avatar
Anthony Morris
·
Apr. 16, 21 · Tutorial
Like (5)
Save
Tweet
Share
21.8K Views

Join the DZone community and get the full member experience.

Join For Free

SOAP, being a mature technology, has an extensive and often differently interpreted standard set. This makes it an excellent tool for corporate users to manipulate data into their precise requirements and technology stack. However, for public consumption, this causes issues that sometimes are difficult or impossible to solve without changing code.

A good example here is that SOAP is allowed to define the same type in some standard interpretations in different XSD files. However, when trying to use this in other interpreters, it will most likely crash.

To solve this, we need to look at SOAP a little bit deeper. In essence, SOAP, as a technology, is simply a Web (or HTTP) POST call with a specifically formatted XML payload, which the SOAP server is expecting and understands. It then returns a specifically formatted XML response which the client then can parse and use.

You might be saying, 'Hey, that sounds very much like a REST call,' but that is exactly what it is. Instead of an API reference, which gives you the Request and Response formats and requirements, SOAP publishes a WSDL.

So if you've got one of these SOAP Services which breaks standards, if you can get the text of a successful Request, you can use REST to make the call with that request body.

To show you how this works, I will use a free SOAP web service that works with countries. I will use Linx, a low-code dev tool, to do this.

Linx uses .NET services to call SOAP services, following the .Net defined standards. This means that there would be SOAP services out there that would not work with Linx directly, as they would break the .NET standards for SOAP.

This example works fine with Linx's normal CallSOAPWebService function, but to show the REST option, let's imagine that it will break, and we need to use REST to call it.

Let's start:

  • WSDL URL: http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?wsdl 1
  • Service URL: http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso

First, I will use a tool like SoapUI or Postman to try and get a successful call. Alternatively, if you are already given a successful payload, like in this example, you can use that (Example Documents for CountryInfoService).

To get started, add a new SOAP Project to SoapUI and add the WSDL. We first test if SoapUI gets a successful response back. SoapUI Screenshot of the required payload (SoapUI gave us ? parameters, which we just changed to logical values) and a successful response:

Required Payload and Successful Response

Now we can set up Linx with a CallRESTWebService function and call the SOAP service.

Note: Sometimes, as in this example, the SOAP server requires specific Content-Types. Use your successful call from SoapUI to find these instances. In this example the SOAP server wanted a content type of 'text/xml;charset=UTF-8' and did not accept the default 'application/xml'.  So we just added in a Header to overwrite the content type.


Calling SOAP Service
So in summary, in the screenshot above you can see that we used the 'CallRESTEndpoint' function to call the SOAP Web service. You can now easily extend this process to any of your other target systems.

Here's the Linx Solution. Done in v5.20: CallSOAPwithREST.lsoz (5.4 KB). You will require the Linx Designer to view (free download).

SOAP Web Protocols REST Web Service

Published at DZone with permission of Anthony Morris. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Spring Boot - How To Use Native SQL Queries | Restful Web Services
  • How to Consume REST Web Service (GET/POST) in Java 11 or Above
  • Breaking Up a Monolithic Database with Kong
  • RESTful Web Services: How To Create a Context Path for Spring Boot Application or Web Service

Partner Resources


Comments

ABOUT US

  • About DZone
  • Send feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: