Click here to Skip to main content
Licence CPOL
First Posted 12 Feb 2009
Views 40,108
Downloads 1,121
Bookmarked 33 times

Calling Web Services From JavaScript - Using SOAP Client

By Gökmen BULUT | 12 Feb 2009
We can call any web service method using JavaScript soap client

1

2
1 vote, 11.1%
3
1 vote, 11.1%
4
7 votes, 77.8%
5
4.54/5 - 9 votes
μ 4.54, σa 1.24 [?]
html_small.JPG

Introduction

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

Background

This article is based on JavaScript SOAP Client on http://www.codeplex.com/JavaScriptSoapClient.

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)
{
	alert(r);
}
// End of script.		

That's all guys.

Points of Interest

I already knew how to make a web service call from JavaScript using webservice.htc. 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.

History

  • 12th February, 2009: Initial post

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

License

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

Member
Borned in İstanbul/TURKEY....
Loves İstanbul...

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralWebService Pinmemberramalingajm2:06 25 Apr '11  
Generalsoapclient.js and firefox 3 and 4 PinmemberMember 23138412:32 6 Apr '11  
Questionnot work in firefox Pinmembernimax3d14:16 16 Oct '10  
GeneralOK. Pinmemberdilip20103:36 18 Aug '10  
QuestionWeb Service Error : "The underlying connection was closed: The connection was closed unexpectedly." Pinmemberganesh_barhate2:36 27 Jul '10  
GeneralUsing WebService Created in Java Pinmemberrraiyarela21:02 3 Jun '10  
Generalhi Please help me Pinmemberbhaveshcode21:17 27 Jul '09  
GeneralRe: hi Please help me Pinmemberspina17:59 20 Aug '09  
GeneralRe: hi Please help me Pinmemberpietjepietje4:12 8 Oct '09  
GeneralRe: hi Please help me PinmemberKiMO.133722:55 21 Aug '11  
QuestionJaume Pinmemberenric@mcrit.com2:27 22 May '09  
GeneralNot working in Firefox [modified] PinmemberSlingBlade19:46 29 Apr '09  
GeneralRe: Not working in Firefox Pinmemberpackets18:44 27 Nov '10  
GeneralRemote Web Service Pinmembersmoore43:01 18 Feb '09  
GeneralRe: Remote Web Service PinmemberGökmen BULUT4:39 6 Mar '09  

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.

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