09-25-2012 01:03 PM
hi
is there any possibility to call soap based web service in backbone..?
i this backbone support only rest webservice..![]()
10-01-2012 12:02 PM
Hello ravi1989,
By default, Backbone.js supports JSON REST web service, but this can easily be extended to work with XML SOAP web services.
//The following overrides the default sync method to fetch XML data
Backbone.sync = function(method, model, options) {
var type = methodMap[method];
// Default JSON-request options.
var params = _.extend({
type: type,
contentType: 'application/xml',
dataType: 'xml',
processData: false
}, options);
}
Now the sync command is able to fetch XML data, but we now need to convert XML to JSON which will populate Backbone models/collections. This may be done using Jath - https://github.com/dnewcome/jath
Please refer to the full example on the following page for information on how to use Jath along with XML/SOAP:
http://newcome.wordpress.com/2011/02/20/consuming-
10-01-2012 12:15 PM
can you please help me to call only one method.....?
my url is http://184.106.159.143:8080/FirstGroupRailApps/ser
method: getversion
10-01-2012 12:50 PM
Methods need to be handled in the Web Service itself and returned when the URL is called from Backbone.
For example, if you want to expose method getversion, you need to create a handle in the url which returns the version in XML:
http://184.106.159.143:8080/FirstGroupRailApps/ser
This should return JSON (or XML) data with the version number.
In your Backbone model, specify the above URL and fetch. This will produce a GET request:
object = Backbone.Model.extend({
url: 'http://184.106.159.143:8080/FirstGroupRailApps/ser vices/RailAppsCAWS/getversion',
parse: function(response){
return response; //XML response
}
});
//create the object
var SomeObject = new object():
//fetch version number
SomeObject.fetch();
For further questions, please provide an example of the code you have so far.
10-15-2012 01:39 AM
are you getting some response fron this code..?
I am not getting anything..