Click here to Skip to main content
15,306,017 members
Articles / Programming Languages / Javascript
Posted 12 Feb 2009


42 bookmarked

Calling Web Services From JavaScript - Using SOAP Client

Rate me:
Please Sign up or sign in to vote.
4.63/5 (15 votes)
12 Feb 2009CPOL
We can call any web service method using JavaScript soap client


This article will show you how to make a web service call using only HTML markup and JavaScript.


This article is based on JavaScript SOAP Client on

Using the Code

Just copy and and change the scripts and markups. You can see a JavaScript example below.

//Calls Hello World Web Method.
var url = document.location.href.replace("default.htm", "webservicedemo.asmx");
// DEMO 1
function HelloWorld()
	var pl = new SOAPClientParameters();
	SOAPClient.invoke(url, "HelloWorld", pl, true, HelloWorld_callBack);
function HelloWorld_callBack(r)
// End of script.		

That's all guys.

Points of Interest

I already knew how to make a web service call from JavaScript using I could not make these calls on browsers other than Internet Explorer. So I searched and found this method. It is so simple to use. Add soapclient.js to your project and some code like the above. Then call it with something like button, etc.


  • 12th February, 2009: Initial post

I will be waiting for your questions. If you like it, please vote. :)


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Gökmen BULUT
Web Developer
Turkey Turkey
Borned in İstanbul/TURKEY....
Loves İstanbul...

Comments and Discussions

Suggestionno se entiende nada Pin
Wilmer Rivera16-Apr-18 9:56
MemberWilmer Rivera16-Apr-18 9:56 
GeneralRe: no se entiende nada Pin
Nelek16-Apr-18 9:59
protectorNelek16-Apr-18 9:59 
QuestionAccess is denied in soapclient.js Pin
Member-clarence31-Jul-15 6:09
professionalMember-clarence31-Jul-15 6:09 
GeneralGreat Example, works in all browser Pin
Tahir Saleem19-Feb-13 0:33
MemberTahir Saleem19-Feb-13 0:33 
GeneralRe: Great Example, works in all browser Pin
Gökmen BULUT23-Feb-13 12:38
MemberGökmen BULUT23-Feb-13 12:38 
GeneralMy vote of 5 Pin
Tahir Saleem19-Feb-13 0:30
MemberTahir Saleem19-Feb-13 0:30 
GeneralMy vote of 4 Pin
Unareshraju22-Jul-12 23:15
MemberUnareshraju22-Jul-12 23:15 
GeneralMy vote of 5 Pin
Manoj Kumar Choubey27-Mar-12 4:11
professionalManoj Kumar Choubey27-Mar-12 4:11 
GeneralWebService Pin
ramalingajm25-Apr-11 1:06
Memberramalingajm25-Apr-11 1:06 
Generalsoapclient.js and firefox 3 and 4 Pin
Member 23138416-Apr-11 1:32
MemberMember 23138416-Apr-11 1:32 
Questionnot work in firefox Pin
nimax3d116-Oct-10 3:16
Membernimax3d116-Oct-10 3:16 
QuestionRe: not work in firefox Pin
rayrogar30-Oct-12 10:32
Memberrayrogar30-Oct-12 10:32 
GeneralOK. Pin
amity201018-Aug-10 2:36
Memberamity201018-Aug-10 2:36 
QuestionWeb Service Error : "The underlying connection was closed: The connection was closed unexpectedly." Pin
ganesh_barhate27-Jul-10 1:36
Memberganesh_barhate27-Jul-10 1:36 
GeneralUsing WebService Created in Java Pin
rraiyarela3-Jun-10 20:02
Memberrraiyarela3-Jun-10 20:02 
Generalhi Please help me Pin
bhaveshcode27-Jul-09 20:17
Memberbhaveshcode27-Jul-09 20:17 
GeneralRe: hi Please help me Pin
spina20-Aug-09 16:59
Memberspina20-Aug-09 16:59 
GeneralRe: hi Please help me Pin
pietjepietje8-Oct-09 3:12
Memberpietjepietje8-Oct-09 3:12 
GeneralRe: hi Please help me Pin
KiMO.133721-Aug-11 21:55
MemberKiMO.133721-Aug-11 21:55 
QuestionJaume Pin
enric@mcrit.com22-May-09 1:27
Memberenric@mcrit.com22-May-09 1:27 
GeneralNot working in Firefox [modified] Pin
SlingBlade29-Apr-09 18:46
MemberSlingBlade29-Apr-09 18:46 
GeneralRe: Not working in Firefox Pin
packets27-Nov-10 17:44
Memberpackets27-Nov-10 17:44 
GeneralRemote Web Service Pin
smoore418-Feb-09 2:01
Membersmoore418-Feb-09 2:01 
GeneralRe: Remote Web Service Pin
Gökmen BULUT6-Mar-09 3:39
MemberGökmen BULUT6-Mar-09 3:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.