JSON is a YAML language
and YAML is short for "Aint a Markup Language"
YAML easily maps data types common to most 
high-level languages: list, hash, and scalar to 
YAML hierarchies are structured according to indents e.g.
receipt:     Oz-Ware Purchase 
   Invoice
date: 2007-08-06

   customer:
    
     given:   Dorothy
    family:  Gale
   


and a corresponding JSON example would be
var receipt_item = [
   {"receipt": "OZ Ware Purchase"},
   {"customer" :
     {"given": "Dorothy", "family": "Gale"}
   }
];
so why would anyone care to use JSON?
Dojo passes JSON JavaScript Object Notational arrays from XMLHttpRequest
its up to 30 times faster to process JSON over XML
what are the dangers? JSON could be loaded with malicious JS as with eval(JSON) 
..its up to the coder
to check for malicious JS behaviour and or scriptlets ..generally checking 
hrefs and any or redirect
http://dojotoolkit.org/book/dojo-book-0-9/part-3-programmatic-dijit-and-dojo/ajax-transports/passing-data-json

php has some utilities which parse JSON such as json_encode ..doc available at
http://www.php.net/json_encode

a fairly descriptive and intuitive explanation of JSON is available at
http://en.wikipedia.org/wiki/JSON

HTH
Martin 
______________________________________________ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business 
of Sender. This transmission is of a confidential nature and Sender does not 
endorse distribution to any party other than intended recipient. Sender does 
not necessarily endorse content contained within this transmission. 


Date: Sun, 21 Sep 2008 22:42:43 +0530
From: [EMAIL PROTECTED]
To: [email protected]
Subject: Re: [AXIS2] Should JSON messages be considered as REST?

I'm not too familiar with YAML. For what sort of situations is YAML used for? 
is it used widely?

Thanks,
Keith.
On Sun, Sep 21, 2008 at 8:25 PM, Martin Gainty <[EMAIL PROTECTED]> wrote:






curious as to when/if a YAML2XML plugin will be available  ?
thanks,
Martin
______________________________________________ 

Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business 
of Sender. This transmission is of a confidential nature and Sender does not 
endorse distribution to any party other than intended recipient. Sender does 
not necessarily endorse content contained within this transmission. 



Date: Sun, 21 Sep 2008 19:31:42 +0530
From: [EMAIL PROTECTED]
To: [email protected]

Subject: Re: [AXIS2] Should JSON messages be considered as REST?

Hi Chinthaka,

See comments inline,

On Sun, Sep 21, 2008 at 12:43 AM, Eran Chinthaka <[EMAIL PROTECTED]> wrote:


Hi Keith and all,

This argument is based on the following assumption ( You know about 
assumptions, if you've watched "Under Siege 2" ;) )


Axis2 REST implementation is based on WSDL 2.0 HTTP Binding. At least this was 
the case, when I was implementing and sorry if the implementation is now 
changed. Nothing has changed with this regard.  ;).





In the spec, it says, if we have our own custom content-type, then it should be 
compatible with application/xml 
(http://www.w3.org/TR/wsdl20-adjuncts/#_http_ser_xml). 


I don't think that thats the case. The WSDL 2.0 spec specifies three 
serializations, they are application/x-www-form-urlencoded, application/xml and 
multipart/form-data. And the area in the spec you have referred to is talking 
about these three. I the section you have referred to the spec says,



"[Definition: The serialization
format is a media type token ("type/subtype"). It
identifies rules to serialize the payload in an HTTP message. Its
value is defined by the following rules. The HTTP request
serialization format MUST be in the media type range specified by
the {http input
serialization} property. "

So it basically supports any media-Type. Its just that the working group took 
the trouble in describing the three serializations above in detail.
 

Do you think application/json is compatible with application/xml? 
As long as application/json is a standard I dont see any issues with it. 





I don't think so because in the spec once again it says the following here : 
http://www.w3.org/TR/wsdl20-adjuncts/#_http_operation_xml_encoding



"The instance
data of the input, output or fault message is serialized as an
XML document in the message body of the HTTP message" Since JSON serialization 
is not XML, rather name/value pair, application/xml is not compatible with 
application/json.
Answered that too above.



Thanks,
Keith.
 

So considering JSON messages as REST messages seems to be fundamentally wrong. 



But since we think (at least I think) JSON is something we should support, we 
should think about supporting content-types which are not compatible with SOAP 
or REST. 

Thanks,
Chinthaka




On Wed, Sep 3, 2008 at 11:10 PM, keith chapman <[EMAIL PROTECTED]> wrote:


Hi devs,

This idea came up because of the following scenario.

Currently the logic for creating a AxisFault  for a fault received lies in 
org.apache.axis2.util.Utils.java (lines 507 - 530). This works perfectly when 
the received fault is SOAP or REST. But it does not work as expected when the 
response is JSON ( rather a exception is thrown saying "The MessageContext does 
not have an associated SOAPFault."). The reason is the logic we use to build 
the AxisFault. If the fault message is not a SOAP message we check for the flag 
messageContext.isDoingREST() and get the first element of the SOAPBody as the 
fault message.





When the fault message is JSON its neither SOAP and the 
messageContext.isDoingREST() returns false. Should we consider  JSON messages 
as REST messages? I believe so.

WDYT?

Thanks,
Keith.




-- 
Keith Chapman
Senior Software Engineer
WSO2 Inc.
Oxygenating the Web Service Platform.
http://wso2.org/

blog: http://www.keith-chapman.org








-- 
With Mettha,
Eran Chinthaka

--------------------------------------------------------------------
Health is the greatest gift; contentment is the greatest wealth; trusting is 
the best relationship; nirvana is the highest joy. - Dhammapada







-- 
Keith Chapman
Senior Software Engineer
WSO2 Inc.
Oxygenating the Web Service Platform.
http://wso2.org/


blog: http://www.keith-chapman.org




See how Windows connects the people, information, and fun that are part of your 
life. See Now


-- 
Keith Chapman
Senior Software Engineer
WSO2 Inc.
Oxygenating the Web Service Platform.
http://wso2.org/

blog: http://www.keith-chapman.org




_________________________________________________________________
Get more out of the Web. Learn 10 hidden secrets of Windows Live.
http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008

Reply via email to