HEAD.result == 1
If not, then all the different types of possible errors are packed in a consistent format inside;
HEAD.errors
This means you can easily pass back multiple errors, each one has a specific error code and message and they are grouped by ENVELOPE, HEAD, BODY and OPTIONS so error handling is clean, fast and consistent.
HEAD // parameters about the request (service_type, action_type, session id, etc.)
BODY // the real payload of the request
/*
Common SETUP design pattern:
----------------------------
- create a SOAPjr_request object
- set the HEAD and BODY values
- then call send()
The real work that handles the response is done in the callback below
*/
/*
Common CALLBACK design pattern:
-------------------------------
- get the response object's HEAD (for convenience)
- if the result was successful process the BODY
- else get the errors object and process any errors you find
NOTE: Now all transport, application and validation errors can be handled in a common way.
Also, multiple errors can easily be returned and common or domain specific error codes can also be standardised.
NOTE: This demo will be simplified and bought into line with the new SOAPjr lite jQuery plugin API
*/
See http://SOAPjr.org/js/basic_demo.js for a working example.
See http://SOAPjr.org/js/jquery.SOAPjr-1.1.0.js for the jQuery plugin.
?json={"HEAD":{"service_type":"contacts","action_type":"view",
"sid":"80e5b8a8b9cbf3a79fe8d624628a0fe5"},"BODY":{"username":"jbloggs"}}
Of course this would be supplied with the relevant encoding.
{
"HEAD" : {
"service_type" : "contacts",
"action_type" : "view",
"sid" : "80e5b8a8b9cbf3a79fe8d624628a0fe5"
},
"BODY" : {
"username" : "jbloggs"
}
}
{
"HEAD" : {
"result" : 1
},
"BODY" : {
"email" : [
{
"type" : ["internet","pref"],
"value" : "jbloggs@SOAPjr.org"
}
],
"fn" : "Joe Bloggs",
"kind" : "individual",
"n" : {
"family-name" : ["Bloggs"],
"given-name" : ["Joe"],
"value" : "Bloggs;Joe"
},
"org" : [
{
"organization-name" : "SOAPjr.org"
}
]
}
}
{
"HEAD" : {
"result" : 0,
"errors" : {
"HEAD" : {
"sid" : {
"code" : "401",
"message" : "Invalid Session ID"
}
}
}
}
}
A new site has been added to the demonstration section that shows a live working example of SOAPjr services - see http://SOAPjr.org/demos.html
A new version of the jquery plugin that support file uploads using the "related API" has been released. Version 1.3.0 of the SOAPjr jQuery plugin is available on the jQuery plugin site.
A new version of the perl libs that support file uploads using the "related API" have been uploaded to CPAN. Thanks for the update Sean.
In 2007 Redhat lodged a patent on SOAP processing over CGI. Yet another great reason to migrate to SOAPjr which uses lightweight JSON instead of XML.
A variety of small bug fixes and tidy ups have been released (see revision history for more details). Version 1.1.2 of the SOAPjr jQuery plugin is available on the jQuery plugin site.
Now you can make SOAPjr calls with a single line, configure default settings or automatically validate the "send" or "receive" data against JSON Schemas. Version 1.1.0 of the SOAPjr jQuery plugin is available on the jQuery plugin site.
