Click here to Skip to main content
11,790,613 members (62,836 online)
Click here to Skip to main content

Calling Web Services From JavaScript - Using SOAP Client

, 12 Feb 2009 CPOL 104.9K 4.9K 41
Rate this:
Please Sign up or sign in to vote.
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. Smile | :)


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

You may also be interested in...

Comments and Discussions

QuestionAccess is denied in soapclient.js Pin
Member 450957031-Jul-15 6:09
professionalMember 450957031-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
membermanoj 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
dilip201018-Aug-10 2:36
memberdilip201018-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    Rant Rant    Admin Admin   

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

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.1509028.1 | Last Updated 12 Feb 2009
Article Copyright 2009 by Gökmen BULUT
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid