Welcome!

XML Authors: Pat Romanski, Liz McMillan, Carmen Gonzalez, Elizabeth White, Esmeralda Swartz

Blog Feed Post

SOAP-to-REST with Parameterized URLs and content-based routing using the Vordel API Server

The world is moving from SOAP to REST. Many applications continue to send old-style SOAP messages. Therefore, a very common usage of the Vordel API Server is to convert from legacy SOAP messages into REST API calls. This provides the best of both worlds: (1) Existing SOAP apps continue to work and don't have to be re-coded, and (2) going forward, REST APIs are used instead.

I've put together an example of this below. In this case, I'm using the common Parlay-X format which is SOAP-based, and I'm converting to the GSMA OneAPI, which is a REST API. The example I'm using is the common "amountCharging" service, which, here in Vordel, we often encounter with our telecoms customers [Side note: Here is some information about how BT, 3 UK, Telefonica, and TIM Brasil are using Vordel with their telecoms services]. 

Here's an example of a legacy SOAP message to our Parlay-X API:


<?xml version="1.0" encoding="UTF-8" standalone="no"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <par2:chargeAmount xmlns:par2="http://www.csapi.org/schema/parlayx/payment/amount_charging/v2_1/local"> <!-- Element must appear exactly once --> <par2:endUserIdentifier>www.abc.com</par2:endUserIdentifier> <!-- Element must appear exactly once --> <par2:charge> <!-- Element must appear exactly once --> <description>a</description> <!-- Zero or one occurrences --> <currency>a</currency> <!-- Zero or one occurrences --> <amount>1.0</amount> <!-- Zero or one occurrences --> <code>a</code> </par2:charge> <!-- Element must appear exactly once --> <par2:referenceCode>a</par2:referenceCode> </par2:chargeAmount> </soap:Body> </soap:Envelope>


You can see above that this is a charge for some "Game Currency", of the amount of 25 US Dollars. 

We want to convert this to a REST API call like this:

http://api.myhostname.com/1/payment/6175551234/transactions/amount

You might notice, in the example, that the "endUserIdentifier" value in the SOAP message must be mapped into part of the URL used by the REST API. This is sometimes called a "Parameterized URL", or REST API parameterization.

Let's see how this is configured at the Vordel API Server...

The first step is to register the Parlay-X WSDL. I am doing this within the API Server's Repository, which I am accessing using the Policy Studio (Under "API Server" -> "Business Services", then right-clicking on the group I want to import the service into, and selecting "Register Web Service"). 



I am choosing the "chargeAmount" operation, as shown above, by selecting it. I simply follow through the rest of the steps as default, and for the final step, I'm choosing to deploy under a group called "Default Services", which has a number of HTTP listeners, and an SSL listener, as shown below:

The API Server will automatically create the mapping from the inbound path to the policy for our Parlay-X service. 

Finally we hit "Deploy" to deploy our new SOAP service to the API Server. 


The next step is to map from the SOAP message to the REST API call. Let's see how this is done.

Here is the WSDL for the virtualized Parlay-X service at the API Gateway. I load this up into the free Vordel SOAPbox tool (or SOAPUI) in order to generate a sample SOAP request to this Parlay-X service. 


I then save this sample request as a file called "SampleSOAPMessage.xml". We will use this in order to tell the API Server how to look up the "EndUserIdentifier" value from the SOAP now.

When I registered the Parlay-X WSDL, a sample "handler" was created for me. I am going to delete this, and configure my own handler, which reads the value from the SOAP and dynamically constructs the REST API requests based on the "EndUserIdentifier" value. So first let's delete the default handler:


Next, I drag in a "Set Service Context" into my empty canvas, and I choose the WSDL for the Parlay-X service I just imported. What I am doing here is telling the API Server (and Vordel Analytics) the name of the SOAP service, so that this shows up in monitoring and Analytics. 


Remember to select "Set as start" for this filter. Otherwise it will continue to be grayed out and will not run. Here I am setting it as start:


In the next step, I am setting Schema Validation for my incoming message. Note that, if we don't want to schema-validate the message, you can skip this step. I put a green arrow from the "Set Service Context" filter into the "Schema Validation" filter. 


Next, I am using a "Retrieve from message" filter to select the value of the EndUserIdentifier field from the XML. As you can see below, I am using the XPath Wizard in Policy Studio with the sample message which I made from SOAPbox (or SOAPui if you prefer). I select the place where the EndUserIdentifer is to be found in the message, and I set that it will be placed into an attribute (variable) called "EndUserIdentifier". 



Next, I am using a "Switch" filter to switch based on the content of that "EndUserIdentifier" variable. You can see that I'm saying "If it starts with '617', use routing policy 'Route to Px Service 1", "If it starts with '212', use routing policy 'Route to Px Service 2", etc. This Switch filter is very powerful.


At this point your policy should look like this next screenshot:


So let's look at one of the routing policies which we are calling from our Switch filter. This is a routing policy which is creating a REST API request. It consists of four simple steps. 

Step one is to rewrite the URL, taking into account the EndUserIdentifier value which we read in from the SOAP message. You can see it below with the syntax ${EndUserIdentifier}


Step two is to set the verb to "GET". Because the incoming SOAP message was sent using a POST verb, but we want to use GET to connect to our REST API, I am using a "Set HTTP Verb" filter to convert the verb to "GET".


Step three is to use a "Static Router" filter to set the hostname and port of my REST API server which I want to route to:



Step four is to place a "Connection" filter after the "Static Router". I accept all the default for the "Connection" filter. Note that if I was connecting over SSL to the API, I'd have to make sure I checked the boxes for the certificates used at the endpoint, so that they are trusted.


And that's it! What we achieved here is:

1) Converting from a legacy SOAP request to a REST API call
2) Parameterization of a URL, based on a value read from a SOAP message
3) Conditional routing based on the value from a message (content-based routing).

If you'd like to see more "recipes" like this, check out the tutorials on the Vordel website.

Read the original blog entry...

More Stories By Mark O'Neill

Mark O'Neill is VP Innovation at Axway - API and Identity. Previously he was CTO and co-founder at Vordel, which was acquired by Axway. A regular speaker at industry conferences and a contributor to SOA World Magazine and Cloud Computing Journal, Mark holds a degree in mathematics and psychology from Trinity College Dublin and graduate qualifications in neural network programming from Oxford University.

@ThingsExpo Stories
SYS-CON Events announced today that SOA Software, an API management leader, will exhibit at SYS-CON's 15th International Cloud Expo®, which will take place on November 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA. SOA Software is a leading provider of API Management and SOA Governance products that equip business to deliver APIs and SOA together to drive their company to meet its business strategy quickly and effectively. SOA Software’s technology helps businesses to accelerate their digital channels with APIs, drive partner adoption, monetize their assets, and achieve a...
From a software development perspective IoT is about programming "things," about connecting them with each other or integrating them with existing applications. In his session at @ThingsExpo, Yakov Fain, co-founder of Farata Systems and SuranceBay, will show you how small IoT-enabled devices from multiple manufacturers can be integrated into the workflow of an enterprise application. This is a practical demo of building a framework and components in HTML/Java/Mobile technologies to serve as a platform that can integrate new devices as they become available on the market.
BSQUARE is a global leader of embedded software solutions. We enable smart connected systems at the device level and beyond that millions use every day and provide actionable data solutions for the growing Internet of Things (IoT) market. We empower our world-class customers with our products, services and solutions to achieve innovation and success. For more information, visit www.bsquare.com.
Almost everyone sees the potential of Internet of Things but how can businesses truly unlock that potential. The key will be in the ability to discover business insight in the midst of an ocean of Big Data generated from billions of embedded devices via Systems of Discover. Businesses will also need to ensure that they can sustain that insight by leveraging the cloud for global reach, scale and elasticity.
SYS-CON Events announced today that Red Hat, the world's leading provider of open source solutions, will exhibit at Internet of @ThingsExpo, which will take place on November 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA. Red Hat is the world's leading provider of open source software solutions, using a community-powered approach to reliable and high-performing cloud, Linux, middleware, storage and virtualization technologies. Red Hat also offers award-winning support, training, and consulting services. As the connective hub in a global network of enterprises, partners, a...
SYS-CON Events announced today that Utimaco will exhibit at SYS-CON's 15th International Cloud Expo®, which will take place on November 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA. Utimaco is a leading manufacturer of hardware based security solutions that provide the root of trust to keep cryptographic keys safe, secure critical digital infrastructures and protect high value data assets. Only Utimaco delivers a general-purpose hardware security module (HSM) as a customizable platform to easily integrate into existing software solutions, embed business logic and build s...
How do APIs and IoT relate? The answer is not as simple as merely adding an API on top of a dumb device, but rather about understanding the architectural patterns for implementing an IoT fabric. There are typically two or three trends: Exposing the device to a management framework Exposing that management framework to a business centric logic • Exposing that business layer and data to end users. This last trend is the IoT stack, which involves a new shift in the separation of what stuff happens, where data lives and where the interface lies. For instance, it’s a mix of architectural style...
Connected devices are changing the way we go about our everyday life, from wearables to driverless cars, to smart grids and entire industries revolutionizing business opportunities through smart objects, capable of two-way communication. But what happens when objects are given an IP-address, and we rely on that connection, sometimes with our lives? How do we secure those vast data infrastructures and safe-keep the privacy of sensitive information? This session will outline how each and every connected device can uphold a core root of trust via a unique cryptographic signature – a “bir...
SYS-CON Events announced today that Matrix.org has been named “Silver Sponsor” of Internet of @ThingsExpo, which will take place on November 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA. Matrix is an ambitious new open standard for open, distributed, real-time communication over IP. It defines a new approach for interoperable Instant Messaging and VoIP based on pragmatic HTTP APIs and WebRTC, and provides open source reference implementations to showcase and bootstrap the new standard. Our focus is on simplicity, security, and supporting the fullest feature set.
Internet of @ThingsExpo Silicon Valley announced on Thursday its first 12 all-star speakers and sessions for its upcoming event, which will take place November 4-6, 2014, at the Santa Clara Convention Center in California. @ThingsExpo, the first and largest IoT event in the world, debuted at the Javits Center in New York City in June 10-12, 2014 with over 6,000 delegates attending the conference. Among the first 12 announced world class speakers, IBM will present two highly popular IoT sessions, which will take place November 4-6, 2014 at the Santa Clara Convention Center in Santa Clara, Calif...
P2P RTC will impact the landscape of communications, shifting from traditional telephony style communications models to OTT (Over-The-Top) cloud assisted & PaaS (Platform as a Service) communication services. The P2P shift will impact many areas of our lives, from mobile communication, human interactive web services, RTC and telephony infrastructure, user federation, security and privacy implications, business costs, and scalability. In his session at Internet of @ThingsExpo, Robin Raymond, Chief Architect at Hookflash Inc., will walk through the shifting landscape of traditional telephone a...
WebRTC defines no default signaling protocol, causing fragmentation between WebRTC silos. SIP and XMPP provide possibilities, but come with considerable complexity and are not designed for use in a web environment. In his session at Internet of @ThingsExpo, Matthew Hodgson, technical co-founder of the Matrix.org, will discuss how Matrix is a new non-profit Open Source Project that defines both a new HTTP-based standard for VoIP & IM signaling and provides reference implementations.

SUNNYVALE, Calif., Oct. 20, 2014 /PRNewswire/ -- Spansion Inc. (NYSE: CODE), a global leader in embedded systems, today added 96 new products to the Spansion® FM4 Family of flexible microcontrollers (MCUs). Based on the ARM® Cortex®-M4F core, the new MCUs boast a 200 MHz operating frequency and support a diverse set of on-chip peripherals for enhanced human machine interfaces (HMIs) and machine-to-machine (M2M) communications. The rich set of periphera...

SYS-CON Events announced today that Aria Systems, the recurring revenue expert, has been named "Bronze Sponsor" of SYS-CON's 15th International Cloud Expo®, which will take place on November 4-6, 2014, at the Santa Clara Convention Center in Santa Clara, CA. Aria Systems helps leading businesses connect their customers with the products and services they love. Industry leaders like Pitney Bowes, Experian, AAA NCNU, VMware, HootSuite and many others choose Aria to power their recurring revenue business and deliver exceptional experiences to their customers.
The Internet of Things (IoT) is going to require a new way of thinking and of developing software for speed, security and innovation. This requires IT leaders to balance business as usual while anticipating for the next market and technology trends. Cloud provides the right IT asset portfolio to help today’s IT leaders manage the old and prepare for the new. Today the cloud conversation is evolving from private and public to hybrid. This session will provide use cases and insights to reinforce the value of the network in helping organizations to maximize their company’s cloud experience.
The Internet of Things (IoT) is making everything it touches smarter – smart devices, smart cars and smart cities. And lucky us, we’re just beginning to reap the benefits as we work toward a networked society. However, this technology-driven innovation is impacting more than just individuals. The IoT has an environmental impact as well, which brings us to the theme of this month’s #IoTuesday Twitter chat. The ability to remove inefficiencies through connected objects is driving change throughout every sector, including waste management. BigBelly Solar, located just outside of Boston, is trans...
SYS-CON Events announced today that Matrix.org has been named “Silver Sponsor” of Internet of @ThingsExpo, which will take place on November 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA. Matrix is an ambitious new open standard for open, distributed, real-time communication over IP. It defines a new approach for interoperable Instant Messaging and VoIP based on pragmatic HTTP APIs and WebRTC, and provides open source reference implementations to showcase and bootstrap the new standard. Our focus is on simplicity, security, and supporting the fullest feature set.
Predicted by Gartner to add $1.9 trillion to the global economy by 2020, the Internet of Everything (IoE) is based on the idea that devices, systems and services will connect in simple, transparent ways, enabling seamless interactions among devices across brands and sectors. As this vision unfolds, it is clear that no single company can accomplish the level of interoperability required to support the horizontal aspects of the IoE. The AllSeen Alliance, announced in December 2013, was formed with the goal to advance IoE adoption and innovation in the connected home, healthcare, education, aut...
SYS-CON Events announced today that Red Hat, the world's leading provider of open source solutions, will exhibit at Internet of @ThingsExpo, which will take place on November 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA. Red Hat is the world's leading provider of open source software solutions, using a community-powered approach to reliable and high-performing cloud, Linux, middleware, storage and virtualization technologies. Red Hat also offers award-winning support, training, and consulting services. As the connective hub in a global network of enterprises, partners, a...
The only place to be June 9-11 is Cloud Expo & @ThingsExpo 2015 East at the Javits Center in New York City. Join us there as delegates from all over the world come to listen to and engage with speakers & sponsors from the leading Cloud Computing, IoT & Big Data companies. Cloud Expo & @ThingsExpo are the leading events covering the booming market of Cloud Computing, IoT & Big Data for the enterprise. Speakers from all over the world will be hand-picked for their ability to explore the economic strategies that utility/cloud computing provides. Whether public, private, or in a hybrid form, clo...