Monday, February 28, 2011

asp:ScriptManager - Unknown server tag

Below are the links I followed in order to resolve 
the mistery of the error
 "UNKNOWN SERVER TAG"  -  related to asp:ScriptManager 

 

http://localhost/TestWeb/SimpleWebService.aspx

Server Error in '/TestWeb' Application.


Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Unknown server tag 'asp:ScriptManager'.

Source Error:
 

Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053 
 
Line 42:         form id="Form1" runat="server"
Line 43: asp:ScriptManager runat="server" ID="scriptManager" Line 44: Services Line 45:  asp:ServiceReference path="SimpleWebService.asmx"
 
 

Professional ASP.NET 2.0 AJAX
Matt Gibbs, Dan Wahlin
ISBN: 978-0-470-10962-5
Paperback
336 pages
June 2007
 
http://www.wrox.com/WileyCDA/WroxTitle/productCd-0470109629.html

Professional-ASP-NET-2-0-AJAX - source code DOWNLOAD  

I took the Web.Config from the chapter 4  ( or 5 ? )  and everything was OK ,
  problem solved !

 

~ ~ ~ 

Ajaxed Part II. Server Side AJAX
http://thejoyofcode.com/Ajaxed_Part_II._Server_Side_AJAX.aspx


How to set path to the scriptreference in ScriptManager

http://www.dotnetspider.com/forum/145097-how-set-path-scriptreference-ScriptManager.aspx

http://www.asp.net/ajax/videos/how-do-i-make-client-side-network-callbacks-with-aspnet-ajax

 How To Consume Web Services Using AJAX and ASP.NET 3.5

http://visualstudiomagazine.com/articles/2007/09/01/consuming-remote-web-services-with-aspnet-ajax.aspx 

A beginner’s guide for consuming a WCF service in JavaScript using ASP.NET AJAX

Using the ScriptManager

Calling Web Services from Client Script

http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanager.aspx

MicrosoftAjax.js ,ScriptPath , ScriptManager
http://damianblog.com/2006/11/27/scriptmanager-scriptpath/



 
 

ASP.NET Ajax :: Script Manager vs ToolkitScriptManager

http://blog.turlov.com/2008/05/scriptmanager-vs-toolkitscriptmanager.html

 

Configure Web.Config in order to use asp:ScriptManager

 

http://www.semenoff.dk/en/Code-Corner/ASP.Net.AJAX/WebService-From-JavaScript.aspx

How to call a Web Service from client-side JavaScript using ASP.Net AJAX

 



http://july-code.blogspot.com/2008/07/how-to-call-remote-web-services-from.html


Friday, February 25, 2011

AJAX : ASPX GridView - DataSet - ASMX WebMethod

Consuming a Web Service using ASP.NET Ajax



AJAX Web Services in C#

http://www.dreamincode.net/forums/topic/34279-introduction-to-web-services-in-c%23/

Creating a basic web service that retrieves data from a database,
then passes a populated DataSet back to the calling page to populate a GridView control with it.

http://articles.sitepoint.com/article/net-web-services-5-steps
http://www.daniweb.com/forums/thread151766.html
http://www.netomatix.com/DGSimple.aspx

Calling web service using javascript

http://sandblogaspnet.blogspot.com/2010/05/calling-web-service-using-javascript.html
http://sandblogaspnet.blogspot.com/2010/04/calling-web-service-using-javascript.html
http://sandblogaspnet.blogspot.com/2010/03/calling-web-service-using-javascript.html


Return Array from Web Service
using ScriptManager & Javascript

http://ciappara.wordpress.com/2009/07/31/return-array-from-web-service-using-scriptmanager-javascript/



SimpleWebService , [ScriptService]
http://msdn.microsoft.com/en-us/library/system.web.script.services.scriptserviceattribute.aspx


ASP.NET 2.0 AJAX Extensions 1.0 (Setup Wizard)

Brief Description


ASP.NET AJAX is a set of technologies to add AJAX (Asynchronous JavaScript And XML) support to ASP.NET. It consists of a client-side script framework, server controls, and more.

 http://www.microsoft.com/downloads/

ASPAJAXExtSetup.msi
type or namespace name Script does not exist in the namespace System.Web
using System.Web.Extensions




Different methods to call Web Services from AJAX

 http://www.codeproject.com/KB/ajax/Ajax_and_Web_Services.aspx

 

 Client-Side Web Service Calls with AJAX Extensions

http://msdn.microsoft.com/en-us/magazine/cc163499.aspx



Understanding ASP.NET AJAX Web Services

http://www.asp.net/ajax/tutorials/understanding-asp-net-ajax-web-services



ScriptManager Enables AJAX In Your Web Apps
http://msdn.microsoft.com/en-us/magazine/cc163354.aspx#S3


Exposing Web Services to Client Script
http://msdn.microsoft.com/en-us/library/bb398998.aspx 


ASP.NET AJAX ScriptManager webservice

http://www.codedigest.com/Articles/ASPNET/387_Asynchronous_Access_To_WebServices_using_ScriptManager_in_AspNet_Ajax.aspx


Thursday, February 24, 2011

android.jar and KSOAP2

The android.jar file is 11MB!

   Android does not contain any tools to help building SOAP based web service clients.
Google seems to like  REST services. The SDK is not bundled with any SOAP-related tools.
An alternative is to add kSOAP 2 to (Java ME) projects ... Or better we can use ksoap2 for android

   If an Android Activity access the internet via HTTP connection
the following line must be added to  AndroidManifest.xml :


http://romenlaw.blogspot.com/search/label/Web%20Service
http://romenlaw.blogspot.com/2008/08/consuming-web-services-from-android.html
http://www.android10.org/index.php/articleslibraries/167-using-ksoap2-for-android-soap-web-service


In general the Android API is very complete and offeres support for a whole lot of features and task. I did however have to find out that SOAP support is generally non existant. Given the widely known problems with SOAP and the trend towards simpler REST based services and the young age of the Android platform this is not too surprising. However in reality many people still need to work with legacy SOAP services.

http://www.simpligility.com/2010/05/attribute-support-for-ksoap2-on-android/

When you research on the web for SOAP support libraries on embedded devices including Android
you end up running into KSOAP and KSOAP2.
KSOAP2 library is used on J2ME devices like RIM Blackberry, and now Android.

On Android  KSOAP2 is alive :
http://code.google.com/p/ksoap2-android/updates/list

Unfortunately everything around KSOAP for JavaME seems to be rather old and inactive.
The project has a few issues assigned and had no activity for a while.

Return SalesAgents byName Or byZone

http://www.flickr.com/photos/24834074@N04/5472432292/sizes/l/in/photostream/
http://www.flickr.com/photos/24834074@N04/5471839947/sizes/l/in/photostream/
http://www.flickr.com/photos/24834074@N04/5472432212/sizes/l/in/photostream/
http://www.flickr.com/photos/24834074@N04/5471839801/sizes/l/in/photostream/



public class SalesAgent
{
    private string _name     = string.Empty;
    private string _surname  = string.Empty;
    private string _userID   = string.Empty;
    private string _zoneID   = string.Empty;
    private string _zoneName = string.Empty;
    private string _password = string.Empty;
   
    public SalesAgent(){}

    public string Name
    {
        get { return _name;  }
        set { _name = value; }
    }

    public string Surname
    {
        get { return _surname;  }
        set { _surname = value; }
    }

    public string UserID
    {
        get { return _userID;  }
        set { _userID = value; }
    }

    public string ZoneID
    {
        get { return _zoneID;  }
        set { _zoneID = value; }
    }

    public string ZoneName
    {
        get { return _zoneName; }
        set { _zoneName = value; }
    }
   
    public string Password
    {
        get { return _password;  }
        set { _password = value; }
    }

}


[WebMethod(Description = "Method to obtain SalesAgents by Zone or by Name")]
public SalesAgent[] ReturnSalesAgents(string theZone, string theAgent)
{

    SqlConnection dbConn = new SqlConnection(connStr);
    dbConn.Open();
    string sqlSelect = " ";
    if ( theZone.Equals("") && theAgent.Equals("") ) {
    sqlSelect = " SELECT TOP (100) dbo.PersoanaFizica.Nume as Name,
                          dbo.PersoanaFizica.Prenume as Surname,  " +
                       " dbo.Utilizator.UtilizatorID as UserID, dbo.Utilizator.Parola as Password,
                         dbo.Utilizator.ZonaID as ZoneID, " +
                       " dbo.Zona.Denumire as ZoneName " +
                       " FROM dbo.PersoanaFizica , dbo.Zona , dbo.Utilizator  " +
                       " WHERE dbo.PersoanaFizica.PersoanaFizica_ID = dbo.Utilizator.UtilizatorID and " +
                       " dbo.Utilizator.ZonaID = dbo.Zona.Id " +
                       " ORDER BY dbo.PersoanaFizica.Nume, dbo.PersoanaFizica.Prenume ";
    }
    else if (theAgent.Equals(""))
    {
        sqlSelect = " SELECT TOP (100) dbo.PersoanaFizica.Nume as Name,
                            dbo.PersoanaFizica.Prenume as Surname,  " +
                           " dbo.Utilizator.UtilizatorID as UserID, dbo.Utilizator.Parola as Password,
                             dbo.Utilizator.ZonaID as ZoneID, " +
                           " dbo.Zona.Denumire as ZoneName" +
                           " FROM dbo.PersoanaFizica , dbo.Zona , dbo.Utilizator  " +
                           " WHERE dbo.PersoanaFizica.PersoanaFizica_ID = dbo.Utilizator.UtilizatorID and " +
                           " dbo.Utilizator.ZonaID = dbo.Zona.Id and " +
                           " dbo.Zona.Denumire LIKE" + "'%" + theZone + "%'" +
                           " ORDER BY dbo.PersoanaFizica.Nume, dbo.PersoanaFizica.Prenume ";
    }
    else {
        sqlSelect = " SELECT TOP (100) dbo.PersoanaFizica.Nume as Name,
                              dbo.PersoanaFizica.Prenume as Surname,  " +
                           " dbo.Utilizator.UtilizatorID as UserID, dbo.Utilizator.Parola as Password,
                              dbo.Utilizator.ZonaID as ZoneID, " +
                           " dbo.Zona.Denumire as ZoneName" +
                           " FROM dbo.PersoanaFizica , dbo.Zona , dbo.Utilizator  " +
                           " WHERE dbo.PersoanaFizica.PersoanaFizica_ID = dbo.Utilizator.UtilizatorID and " +
                           " dbo.Utilizator.ZonaID = dbo.Zona.Id and " +
                           " ( dbo.PersoanaFizica.Nume LIKE " + "'%" + theAgent + "%' or
                               dbo.PersoanaFizica.Prenume LIKE " + "'%" + theAgent + "%' )";
    }
   
   
    SqlDataAdapter da = new SqlDataAdapter(sqlSelect, dbConn);
    DataTable dt = new DataTable();
    SqlCommand dbCommand = new SqlCommand(sqlSelect, dbConn);
    da.Fill(dt);
    dbConn.Close();
    List list = new List();
    foreach (DataRow row in dt.Rows)
    {
        SalesAgent target = new SalesAgent();
        target.Name = row["Name"].ToString();
        target.Surname = row["Surname"].ToString();
        target.ZoneID = row["ZoneID"].ToString();
        target.UserID = row["UserID"].ToString();
        target.Password = row["Password"].ToString();
        target.ZoneName = row["ZoneName"].ToString();
        list.Add(target);
    }
    return list.ToArray();
}

Wednesday, February 23, 2011

Web Service call with a String as a parameter

ASP.NET Web Service ( ASMX ) call from Android with a String parameter :

http://www.flickr.com/photos/24834074@N04/5469116121/sizes/l/in/photostream/

http://www.flickr.com/photos/24834074@N04/5469710588/sizes/l/in/photostream/
http://www.flickr.com/photos/24834074@N04/5469116261/sizes/l/in/photostream/
http://www.flickr.com/photos/24834074@N04/5469710484/sizes/l/in/photostream/


[WebMethod(Description = "Method to obtain Orders By Zone")]
public Order[] ReturnOrdersByZone(string theZone)
{

    SqlConnection dbConn = new SqlConnection(connStr);
    dbConn.Open();

    string sqlSelect = " SELECT TOP (100) dbo.PersoanaFizica.Nume as Name , dbo.PersoanaFizica.Prenume as Surname, dbo.Zona.Denumire AS Zone, dbo.Persoana.Denumire AS Client , dbo.[Document].Control " +
" FROM dbo.[Document] INNER JOIN " +
" dbo.PersoanaFizica ON dbo.[Document].Utilizator_ID =
dbo.PersoanaFizica.PersoanaFizica_ID INNER JOIN " +
 " dbo.Persoana ON dbo.[Document].Persoana_ID = dbo.Persoana.PersoanaID INNER JOIN " +
 " dbo.Comanda ON dbo.[Document].DocumentID = dbo.Comanda.Comanda_ID INNER JOIN  " +
 " dbo.Utilizator ON dbo.[Document].Utilizator_ID = dbo.Utilizator.UtilizatorID INNER JOIN " +
                   " dbo.Zona ON dbo.Utilizator.ZonaID = dbo.Zona.Id " +
                   " WHERE  (dbo.Zona.Denumire LIKE" + "'%" + theZone + "%')" +
                   " ORDER BY Control DESC ";


    SqlDataAdapter da = new SqlDataAdapter(sqlSelect, dbConn);
    DataTable dt = new DataTable();
    SqlCommand dbCommand = new SqlCommand(sqlSelect, dbConn);
    da.Fill(dt);
    dbConn.Close();
    List list = new List();
    foreach (DataRow row in dt.Rows)
    {
        // Person target = Activator.CreateInstance();
        Order target = new Order();
        target.Name = row["Name"].ToString();
        target.Surname = row["Surname"].ToString();
        target.Zone = row["Zone"].ToString();
        target.Client = row["Client"].ToString();
        target.Control = row["Control"].ToString();
        list.Add(target);
    }
    return list.ToArray();
}

Monday, February 21, 2011

LateOrders

http://code.google.com/p/jtelmon/source/browse/trunk/LateOrders/src/ro/jlsoft/lateorders


<%@ WebService class = "ReturnOrders" Language="C#" Debug = "true"%>


using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data;
using System.Data.SqlClient;
using System.Web.Services;

public class Order
{
    private string _name = string.Empty;
    private string _surname = string.Empty;
    private string _zone = string.Empty;
    private string _client = string.Empty;
    private string _control = string.Empty;
   
    public Order() {}

    public string Name
    {
        get { return _name; }
        set { _name = value; }
    }
 
    public string Zone
    {
        get { return _zone; }
        set { _zone = value; }
    }
   
    public string Surname
    {
        get { return _surname; }
        set { _surname = value; }
    }

    public string Client
    {
        get { return _client; }
        set { _client = value; }
    }

    public string Control
    {
        get { return _control; }
        set { _control = value; }
    }
   
}

public class ReturnOrders : WebService
{

   const string connStr = "server=192.168.61.28;uid=sa;pwd=wy;database=Pan";



[WebMethod(Description = "Method to obtain All User Info")]
public Order[] ReturnArray()
{

    SqlConnection dbConn = new SqlConnection(connStr);
    dbConn.Open();
   

    string sqlSelect = " SELECT TOP (100) dbo.PersoanaFizica.Nume as Name , dbo.PersoanaFizica.Prenume as Surname, dbo.Zona.Denumire AS Zone, dbo.Persoana.Denumire AS Client , dbo.[Document].Control " +
" FROM dbo.[Document] INNER JOIN " +
" dbo.PersoanaFizica ON dbo.[Document].Utilizator_ID = dbo.PersoanaFizica.PersoanaFizica_ID INNER JOIN " +
    " dbo.Persoana ON dbo.[Document].Persoana_ID = dbo.Persoana.PersoanaID INNER JOIN " +
    " dbo.Comanda ON dbo.[Document].DocumentID = dbo.Comanda.Comanda_ID INNER JOIN  " +
    " dbo.Utilizator ON dbo.[Document].Utilizator_ID = dbo.Utilizator.UtilizatorID INNER JOIN " +
    " dbo.Zona ON dbo.Utilizator.ZonaID = dbo.Zona.Id " +
    " WHERE  (dbo.Zona.Denumire LIKE '%RESITA%') " +
    " ORDER BY Control DESC ";   
   
   
    SqlDataAdapter da = new SqlDataAdapter(sqlSelect, dbConn);
    DataTable dt = new DataTable();
    SqlCommand dbCommand = new SqlCommand(sqlSelect, dbConn);
    da.Fill(dt);   
    dbConn.Close();
    List list = new List();
    foreach(DataRow row in dt.Rows) {
        // Person target = Activator.CreateInstance();
        Order target = new Order();
        target.Name = row["Name"].ToString();
        target.Surname = row["Surname"].ToString();
        target.Zone = row["Zone"].ToString();
        target.Client = row["Client"].ToString();
        target.Control = row["Control"].ToString();
        list.Add(target);
    }
    return list.ToArray();
}

[WebMethod]
    public string HelloWorld()
    {
        return "Hello World";
    }

}

Tuesday, February 15, 2011

PersonPassport4a.asmx

Returning an ArrayList of Person class instead of Person[] :


[WebMethod]
public ArrayList GetPersonArrayList()
{
    SqlConnection dbConn = new SqlConnection(connStr);
    dbConn.Open();
    string sqlSelect = "select * from users ";
    SqlDataAdapter da = new SqlDataAdapter(sqlSelect, dbConn);
    DataTable dt = new DataTable();
    SqlCommand dbCommand = new SqlCommand(sqlSelect, dbConn);
    da.Fill(dt);
    dbConn.Close();
    ArrayList myList = new ArrayList();
    foreach (DataRow row in dt.Rows)
    {
        Person target = new Person();
        target.Name = row["Name"].ToString();
        target.UserName = row["UserName"].ToString();
        target.EMail = row["EMail"].ToString();
        target.Password = row["Password"].ToString();
        myList.Add(target);
    }
    return myList;
} 




[WebMethod(Description = "Method to obtain All User Info")]
public Person[] ReturnArray()
{
    SqlConnection dbConn = new SqlConnection(connStr);
    dbConn.Open();
    string sqlSelect = "select * from users ";
    SqlDataAdapter da = new SqlDataAdapter(sqlSelect, dbConn);
    DataTable dt = new DataTable();
    SqlCommand dbCommand = new SqlCommand(sqlSelect, dbConn);
    da.Fill(dt);   
    dbConn.Close();
    List list = new List();
    foreach(DataRow row in dt.Rows) {
        // Person target = Activator.CreateInstance();
        Person target = new Person();
        target.Name = row["Name"].ToString();
        target.UserName = row["UserName"].ToString();
        target.EMail = row["EMail"].ToString();
        target.Password = row["Password"].ToString();
        // DataColumnAttribute.Bind(row,target);
        list.Add(target);
    }
    return list.ToArray();
}