Enterprises are inherently complex, comprising of hundreds of applications with completely different semantics. Some of these applications are custom built, where as some are acquired from third parties and some even can be a combination of both and they can be operating in different system environments.
WSO2 VMware Images helps you to try our products inside your virtualized environments without having to go through the trouble of installation and configuration. Download an image and get your hands on cutting edge, lightweight SOA middleware right away!
WSO2 Governance Registry is a product from WSO2 that facilitates you to govern the SOA platform of your organization by helping you store and manage SOA meta data. The product is free and open source with Apache licence and you can download it from http://wso2.org/projects/governance-registry
Hi, You can use the
Hi,
You can use the WSRequest Host Object to retrieve non XML responses. For instance, this code snippet is from the Yahoo GeoCode sample. Here we do an HTTP GET call to the Yahoo service by explicitly setting SOAP to false. Although we send a request payload to the url in this instance, it can also be set to 'null'.
var yahoo = new WSRequest();
var options = new Array();
options["useSOAP"] = "false";
options["HTTPMethod"] = "get";
yahoo.open(options, "http://local.yahooapis.com/MapsService/V1/geocode", false);
var request = "" + key + "" + street + "" + city + "" + state + "";
yahoo.send(request);
var response = yahoo.responseText;
Hope this helps,
Tyrell
Using JSON
You can also set the option "HTTPInputSerialization" if you prefer to use JSON for message exchange.
options["HTTPInputSerialization"] = "application/json/badgerfish";
See the following blog post http://www.keith-chapman.org/2008/09/invoking-mashups-using-json.html.
regards,
Ruchira
Hi Tyrell! Thanks for the
Hi Tyrell!
Thanks for the quick response. But actually this was clear to me, because the Yahoo Service returns a valid XML/REST response.
What I would like to archieve is actually like:
var service = new WSRequest();
var options = new Array();
options["useSOAP"] = "false";
options["HTTPMethod"] = "get";
// http://clients.elements.at/wso2/service.txt contains a valid textual response in JSON format
service.open(options, "http://clients.elements.at/wso2/service.txt", false);
var request = null;
service.send(request);
// The response should now actually contain the content of the JSON response
var response = service.responseText;
If I test that service the response is:
Fault: org.apache.axis2.AxisFault: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '{' (code 123) in prolog; expected '<' at [row,col {unknown-source}]: [1,1]
I therefore guess that every response is parsed by Axis and this JSON response does not - because it's JSON - start with a < character, but with a "{", representing a JSON object.
Please help ;-)
Thanks. I've already tried
Thanks. I've already tried this, too. But it seems that the Mashup Server just can't process a JSON or non XML responses.
The error is:
Fault: org.apache.axis2.AxisFault: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '{' (code 123) in prolog; expected '<' at [row,col {unknown-source}]: [1,1]
BR
Dietmar
We have just published an
We have just published an article on extending Javascript Host Object at http://wso2.org/library/tutorials/writing-custom-hostobject. This describes how to get a simpl HTTP Client integrated as a Host Object. We are planning to include this Host Object in the next release. But in the mean time, you can use the sample code here to do simple HTTP calls.
Hope this helps,
Tyrell