.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan
Santhakumar Munuswamy
Fauzul Azmi
Asad Ali
Post New Web Links

Web Service via JavaScript

Posted By:      Posted Date: October 22, 2010    Points: 0   Category :ASP.Net
 

Hi All,

I am unable to access web service it is always throwing error . Microsoft JScript runtime error: Object doesn't support this property or method

Below is my code.

<SCRIPT language="JavaScript">
		function initWebHTC()
		{
		//init and create short-cut name for web service
		dNtWbSvc.useService("../../WebService1.asmx?WSDL","dNtSvc");
		var iCallID;
		if (dNtWbSvc.dNtSvc)
			{
		document.getElementById("lblDateTime").innerHTML="Loadin..."	
		iCallID= dNtWbSvc.dNtSvc.callService(gtDnTRslt,"Check_NewAlert");
			}
		}
		function gtDnTRslt(result)
		{
	      //if an error then get error details
		if(result.error)
			{
		      //Pull error info from event.result.errorDetail properties
			var xfaultcode   = result.errorDetail.code;
			var xfaultstring = result.errorDetail.string;
			var xfaultsoap   = result.errorDetail.raw;
			// Add code to handle specific error codes here
		document.getElementById("lblDateTime").innerHTML="Error: " + xfaultcode + " ; " + xfaultstring + " ; " + xfaultsoap;							
		}
		else
			{
			//alert(result.value);
			document.getElementById("lblDateTime").innerHTML=result.value;
			//clear any selection
			var sRng;
			sRng = document.selection.createRange();
			


View Complete Post


More Related Resource Links

Update SharePoint List item using UpdateListItem web service with javascript

  
I'm using the Custom_AddListMenuItems function in a CEWP to add a menu item to each list item to Archive that item. This is achieved by updating a choice field in the item to 'Archived'. I'm trying to do this using the web service UpdateListItem web service to update the item using Javascript, but I can not find the correct code that updates the list item. I'm using this code:     var ctx=currentCtx;     var ciid=currentItemID;     var xmlHttp=null;     if (confirm("Are you sure you want to Archive this item?"))     {         var soapRequest = '<?xml version="1.0" encoding="utf-8"?>'+             '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">'+             '    <soap:Body>'+             '        <UpdateListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">'+         

javascript web service in different virtual directory?

  
Hi, I've searched far and wide, but can't find out why this is happening. I have a clientside javascript ajax call into a web service that works fine if both the service and the calling page are in the same directory. If I try to move the web service to another virtual directory, I get this: Exception type: InvalidOperationException Exception message: Request format is unrecognized for URL unexpectedly ending in '/js'. Here are the relevant code tidbits for the separate directories attempt. Thanks for any help! aspx file:<div> <form id="form1" runat="server"> <asp:ScriptManager runat="server" ID="scriptManagerId"> <Scripts> <asp:ScriptReference Path="CallYahooQuotesServiceMethods.js" /> </Scripts> <Services> <asp:ServiceReference Path="/quotesservice/YahooQuotesService.asmx" /> <--- this works if remove /quotesservice/ and service is in same dir </Services> </asp:ScriptManager> </form> </div> <div>  <input type="button" value="Client" id="Button2" onclick="GetQuotes(ticker

web service access from javascript

  
Hi,I am new to webservice accessing from javascript.I call a webmethod from javascript which returns a string array. whith this array i bind a dropdown list at client. At dropdownList selectedIndexchanged event I found there is no item in DropDownList. Is there any way how to bind the DropDownList using webMethod so that on postback i can get the dropdowns item.

How to get web service address in a ajax enabled page to use it in javascript

  

Hii everyone,


I have a requirement where I am using web service from  a server and adding that to a client

website .I have referenced the web service in my client web site  but not able to get the

address of web service. When I click on the path I get the disco file of web service and

the result is not displayed.My code is like this


</p><p>&lt;script&nbsp; language="javascript"&gt;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function btnadd_Click() {

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var x = document.getElementById('txtA').value;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var y = document.getElementById('txtB').value;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var ans = WebService.Add(parseInt(x), parseInt(y), OnComplete, OnTimeOut, onerror);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return true;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }

&n

Item update in the sharepoint list using web service with javascript

  

HI 

I am using below code for web services with javascript

<script>

function CreateListItem(Title)

 {  

 

    var soap1 = createEnvelope(Title);

 

    var ws = new ActiveXObject("Microsoft.XMLHTTP");    

      if(ws == null) 

       return null;

 

    ws.open("POST", 

         "http://dca-app-200:44444/sites/corpmarketing/_vti_bin/lists.asmx",

         false);

    ws.setRequestHeader("Content-Type", "text/xml; charset=utf-8");            

    ws.setRequestHeader("SOAPAction", 

        "http://schemas.microsoft.com/sharepoint/soap/UpdateListItems");

    ws.send(soap1);  

       alert("success");

 

}     

  function createEnvelope(Title)

{               

     var batch;

var xmldoc;    

var ListName = 'S

what is the syntax for populating dropdown in Javascript using web service?

  

Hi

I have written the web method in web service like this

 

 [WebMethod]
    public List<Location> FindAllCountries()
    {
        List<Location> locations = new List<Location>();
        string connectionString =
            "Data Source=.;Initial Catalog=Test;Integrated Security=True";
        using (SqlConnection connection = new SqlConnection(connectionString))
        {
            using (SqlCommand command = new SqlCommand())
            {
                command.Connection = connection;
                command.CommandText = "SelectAllCountries";
                command.CommandType = CommandType.StoredProcedure;
                connection.Open();
                using (SqlDataReader dataReader = command.ExecuteReader())
                {
                    Location location;
                    if (dataReader != null)
                        while (dataReader.Read())
                        {
                            location = new Location();
                            location.CountryID = (int)dataReader["CountryID"];
                            location.CountryName = Convert.ToString(dataReader["CountryName"]);
                            locations.Add(location);
                        }
                }
            }
        }
        return locations;
    }

I m calling the webservic

Call web service and list product list from jquery or javascript

  

Hi,

 

How can i Call web service and list product list to web page. I want do it from jquery or javascript. I want create peace of html code to paste any site to dsiplay some product. Like google adsense.

Through javascript and html codei want call to web service and get product and display site

 

lakmal

 


ASP.NET, HTML, JavaScript Snippet Support (VS 2010 and .NET 4.0 Series)

  
This post covers another useful improvement in VS 2010 - HTML/ASP.NET/JavaScript snippet support. Snippets allow you to be more productive within source view by allowing you to create chunks of code and markup that you can quickly apply and use in your application with a minimum of character typing.

Visual Studio has supported the concept of "snippets" for VB and C# in previous releases - but not for HTML, ASP.NET markup and JavaScript. With VS 2010 we now support snippets for these content types as well.

Windows Service Applications Tutorials

  
You can easily create services by creating an application that is installed as a service. For example, suppose you want to monitor performance counter data and react to threshold values. You could write a Windows Service application that listens to the performance counter data, deploy the application, and begin collecting and analyzing data.

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side.

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side

WCF Tip: Using Properties in Service Contracts

  
you'll notice all of the Service Contracts are implemented with interfaces containing only methods. For the longest time I thought that's all that was supported, until I thought about it a little more. In C# land, properties are simply wrappers around a get method and set method, so why wouldn't we be able to use properties in a service contract? Well the answer is we can.

Realizing a Service-Oriented Architecture with .NET

  
This article is meant to be a practical discussion guide to building a .NET application in a service-oriented architecture. We will consider real-world goals, real-world obstacles, and experience-based solutions. I quickly concede the approaches discussed here are not exhaustive or infallible. This paper is focused on application development, not application integration. We will specifically consider architectural issues and component design issues.

The Potential of Web Services

Ajax Enabled Gridview using JavaScript in ASP.NET

  
Before explaining the article, I would like to thank all readers who read my article and voted for it. Your appreciation for my article gives me strength to write more good articles. Hope in future I will get your valuable comments and suggestions. Now I won't waste your time and come back to the topic. I have written this article on 'Ajax Enabled Gridview Using JavaScript in ASP.NET'. In this article, I will show you how to make a Gridview using a simple HTML table, JavaScript and XML HTTP for Ajax call without using any ASP.NET control.

Using Code

GridView Javascript Click Row and Ajax

  
This article shows 2 common tasks with the ASP.NET GridView: Binding a List (generic) of objects as DataSource and on clicking a row, getting the values of the selected row by a javascript function. In the example a List with User-objects is displayed. On clicking a row containing the data of a User-object, the Id of the object is used to get the address of the user by an Ajax-call and display it in a details-field.

Web Service for uploading documents into SharePoint

  
WS UploadService is a web service written for Microsoft Office SharePoint Server 2007 and Windows SharePoint Services 3.0 and is meant for uploading documents into SharePoint. I have just uploaded the zip file to GotDotNet.com so it will take some time before the zip file appears in the list of downloads. For the time being, you can download the zip file from the following location

Combine, minify and compress JavaScript files to load ASP.NET pages faster

  
Websites are getting more interactive these days and most of this interactivity comes from JavaScript. People are using different JavaScript libraries and frameworks to make their websites more interactive and user friendly.
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend