Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
Posts: 777
Registered: ‎07-21-2012
My Device: 9810
My Carrier: 0

can we call soap based web service in backbone

hi
is there any possibility to call soap based web service in backbone..?
 

i this backbone support only rest webservice..Smiley Sad

Retired
Posts: 165
Registered: ‎09-24-2012
My Device: Passport
My Carrier: Bell

Re: can we call soap based web service in backbone

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-xml-web-services-in-backbone-js-using-jath/

Developer
Posts: 777
Registered: ‎07-21-2012
My Device: 9810
My Carrier: 0

Re: can we call soap based web service in backbone

can you please help me to call only one method.....?

 

my url is http://184.106.159.143:8080/FirstGroupRailApps/services/RailAppsCAWS

 

method: getversion

Retired
Posts: 165
Registered: ‎09-24-2012
My Device: Passport
My Carrier: Bell

Re: can we call soap based web service in backbone

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/services/RailAppsCAWS/getversion

 

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/services/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.

 

Highlighted
Developer
Posts: 777
Registered: ‎07-21-2012
My Device: 9810
My Carrier: 0

Re: can we call soap based web service in backbone

are you getting some response fron this code..?

 

I am not getting anything..