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
Please enter at least three characters to search
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

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

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

  • How Large Tech Companies Architect Resilient Systems for Millions of Users
  • Debugging With Confidence in the Age of Observability-First Systems
  • Unlocking AI Coding Assistants Part 1: Real-World Use Cases
  • The Role of Retrieval Augmented Generation (RAG) in Development of AI-Infused Enterprise Applications
  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
Likes (5)
Comment
Save
Tweet
Share
24.2K 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
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and 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:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!