SOAPjr
Encyclopedia
SOAPjr is a protocol specification for exchanging structured information in the implementation of Web service
Web service
A Web service is a method of communication between two electronic devices over the web.The W3C defines a "Web service" as "a software system designed to support interoperable machine-to-machine interaction over a network". It has an interface described in a machine-processable format...

s in computer network
Computer network
A computer network, often simply referred to as a network, is a collection of hardware components and computers interconnected by communication channels that allow sharing of resources and information....

s. It is a hybrid of SOAP and JSON-RPC
JSON-RPC
JSON-RPC is a remote procedure call protocol encoded in JSON. It is a very simple protocol , defining only a handful of data types and commands...

 (abbreviated as "jr" in this case).

Introduction

SOAPjr is designed to create clean, fast, AJAX-style APIs and is analogous to the introduction of out of band signalling in the telephony world

Traditional SOAP is no longer the Simple Object Access Protocol it was initially designed to be. It can be bloated and overly verbose making it bandwidth hungry and slow. It is also based on XML
XML
Extensible Markup Language is a set of rules for encoding documents in machine-readable form. It is defined in the XML 1.0 Specification produced by the W3C, and several other related specifications, all gratis open standards....

, making it expensive to parse and manipulate - especially on mobile or embedded clients. However, its core envelope/head/body design pattern is useful for AJAX
Ajax
- Mythology :* Ajax , son of Telamon, ruler of Salamis and a hero in the Trojan War, also known as "Ajax the Great"* Ajax the Lesser, son of Oileus, ruler of Locris and the leader of the Locrian contingent during the Trojan War.- People :...

 style APIs
Application programming interface
An application programming interface is a source code based specification intended to be used as an interface by software components to communicate with each other...

.

SOAPjr uses a similar Envelope/Head/Body model, using lightweight and easier to manipulate JSON
JSON
JSON , or JavaScript Object Notation, is a lightweight text-based open standard designed for human-readable data interchange. It is derived from the JavaScript scripting language for representing simple data structures and associative arrays, called objects...

.

In contrast to SOAP, JSON-RPC is overly simplistic and basically tunnels HTTP GET-style key/value pairs within a query string using JSON. However, within JSON-RPC
JSON-RPC
JSON-RPC is a remote procedure call protocol encoded in JSON. It is a very simple protocol , defining only a handful of data types and commands...

there is no head/body separation, leaving metadata to pollute the main data space.

SOAPjr combines the best of these two concepts and is designed to create modern AJAX APIs that can easily be used by mobile devices, embedded systems or desktop browsers.

See SOAPjr Specs for a more detailed description.

SOAPjr is an Open Source project with software released under the GPL and content under Creative Commons.

JSON-Schema definitions

The following SOAPjr entities are defined as JSON-Schemas.

The latest versions can also be downloaded in a single file.

Common data models

SOAPjr.org also aims to contribute to the creation of a common set of DMDs (Data Model Definitions) that may align with the JSON-schema proposal and Service Mapping Description Proposal so applications within specific domains can easily share data. The primary extension that SOAPjr may provide here is the use of consistent or standardised error codes.

Other resources that may inform this development are common data models utilised within microformats and RDF

Examples

This is a basic request to view the jCard details for a single user (based on their username). This message would be passed in a request within the "json" parameter e.g.

?json={"HEAD":{"service_type":"contacts","action_type":"view",
"sid":"80e5b8a8b9cbf3a79fe8d624628a0fe5"},"BODY":{"username":"jbloggs"}}


{
"HEAD" : {
"service_type" : "contacts",
"action_type" : "view",
"sid" : "80e5b8a8b9cbf3a79fe8d624628a0fe5"
},
"BODY" : {
"username" : "jbloggs"
}
}


This is a simple SOAPjr response with a HEAD.result that represents a success. The BODY contains a single jCard record. In a list "list" or "search" context this would contain an array of 0 or more jCard records.


{
"HEAD" : {
"result" : "1"
},
"BODY" : {
"email" : [
{
"type" : ["internet","pref"],
"value" : "spam@SOAPjr.org"
}
],
"fn" : "Joe Bloggs",
"kind" : "individual",
"n" : {
"family-name" : ["Bloggs"],
"given-name" : ["Joe"],
"value" : "Bloggs;Joe"
},
"org" : [
{
"organization-name" : "SOAPjr.org"
}
]
}
}

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK