Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
aionin Absent Member.
Absent Member.
10878 views

Is it possible to call WebService from JavaScript?


Hi

I know there is a way to call TeamScript from Javascript code running on the SBM transition form or listing report template. I wonder if there is a way to call a Web service in the same situation? Has anyone try to anything similar?

Thanks in advance
0 Likes
3 Replies
pmthompson1954 Absent Member.
Absent Member.

Re: Is it possible to call WebService from JavaScript?

0 Likes
jeff_malin Absent Member.
Absent Member.

Re: Is it possible to call WebService from JavaScript?


If you want to make any Web calls through JavaScript I would highly recommend using jQuery, it handles all of the messy details required for cross-browser compatibility behind the scenes, and is community-supported so that later versions support new browsers/specs as they come on-scene.

Here's an example of how you would make an HTTP POST call to a web service using JQuery: http://api.jquery.com/jQuery.post/
0 Likes
Highlighted
dwimpelb Absent Member.
Absent Member.

Re: Is it possible to call WebService from JavaScript?


The code below is taken from a working solution. Works for Both IE and Firefox. There is a browser checker that is written in javascript which you can query first to see if the user is using a supported browser.

I am going to assume you are calling a soap service, so I used a call to the mashups API, which is why the destinationURI is ..\ and not a full URL.

NOTE: the last line of xmlDOC = ... is the return response from the SOAP service. Also note this is being sent synchronously, IE, will wait for a return from the service. If this is a service that takes a long time, then you might write a return function and pass true with the POST command to make it asynch.

Hope this helps. (had to make the code an image. Was having issues formatting the XML, and done have time to fool around with it right now.)


0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.