SOAP message parsing in Tizen Web


In this tip document, a simple example of parsing SOAP structure messages using XmlHttpRequest is discussed. SOAP stands for Simple Object Access Protocol. When publishing complex application program interface (API) as a web service, SOAP is very useful as it is commonly used. A Tizen web app is developed to show a step by step approach for implementing SOAP structured message parsing.

Test Settings:


Tizen Web App


Tizen SDK 2.3.1

Tested on

Wearable Emulator (Circle)

SOAP Message Structure

A SOAP message is an ordinary XML document containing the following elements −

  • Envelope − Defines the start and the end of the message. It is a mandatory element.
  • Header − Contains any optional attributes of the message used in processing the message, either at an intermediary point or at the ultimate end-point. It is an optional element.
  • Body − Contains the XML data comprising the message being sent. It is a mandatory element.
  • Fault − An optional Fault element that provides information about errors that occur while processing the message

Figure 1 : SOAP Message Structure

What is XmlHttpRequest?

XmlHttpRequest can be used to send HTTP requests to and receive responses from a web server. The data returned from XmlHttpRequest calls will often be provided by back-end databases. Besides XML, XmlHttpRequest can be used to fetch data in other formats, e.g. JSON or even plain text. It supports Cross-origin Request Sharing (CORS) which helps to consume SOAP Service from JavaScript.

Using Simple XML HTTP Requests

The example below shows how to create an XML HTTP request on the client side, using JavaScript code that requests Ajax communication:

var method = "GET";
var url = "";
var xhr = new XMLHttpRequest();, url, true);

XmlHttpRequest have many other methods along with open and send. For example, Abort can be used to cancel any current request.

Steps to do

Step 1:  Add internet privilege in config.xml

<tizen:privilege name=""/>

Step 2:  XmlHttpRequest instance is initialized. After initialization, open method of XmlHttpRequest is called. This method needs three parameters (Request type, SOAP service URL and Async type).

var xmlhttp = new XMLHttpRequest();"POST", "",true);

Step 3:  Create SOAP message in a way for getting service of GetCountries() method.

var soap = '<?xml version="1.0" encoding="utf-8"?>' +
	 '<soap:Envelope xmlns:xsi="" ' +
	                'xmlns:xsd="" ' +
	                'xmlns:soap="">' + 
	   '<soap:Body> ' +
	    '<GetCountries xmlns="http://www.webserviceX.NET/">' +
	    '</GetCountries>' +
	  '</soap:Body>' +

Step 4:  Send the request with this soap message as parameter.


Step 5:  Wait until the readystate value is 4. The responseText is carrying text value of the XML. Here the rendering is done on XML as text in HTML.

xmlhttp.onreadystatechange=function() {
	 if (xmlhttp.readyState === 4) {
		 document.getElementById("ws_data").innerHTML = xmlhttp.responseText;

Demo:  Now, build and run the attached example. This example above is capable of showing the return value of GetCountries() method from http://www.webserviceX.NET. Please see below for screenshot.

Figure 2 : Sample Output



첨부 파일: 
SDK Version Since: 
2.4 mobile/2.3.1 wearable