1. #1
    Ext User
    Join Date
    Nov 2010
    Posts
    1
    Vote Rating
    0
    adelavega is on a distinguished road

      0  

    Thumbs up Problem when trying to call a WebService asmx

    Problem when trying to call a WebService asmx


    Hello, I need your help, I have a webservice that uses a parameter but when trying to call it from sends me by mistake.

    This is my function, when I run it shows me: Error ('No se pudo cargar desde el WebService')

    var makeAjaxConParam = function() {
    Ext.getBody().mask('Loading...', 'x-mask-loading', false);
    Ext.Ajax.request({ url: 'http://localhost/rechum2007/direcmy/serviceipad.asmx/getemployeesbynopersonalxml',
    method: 'POST',
    params: {NoPersonal: '101122'},
    headers: {'Content-Type': 'application/json'},
    success: function(result, request) {
    var wsResult = Ext.decode(result.responseText);
    Ext.getCmp('content').update(wsResult);
    Ext.getCmp('status').setTitle('Datos cargados con exito desde el servicio');
    Ext.getBody().unmask();
    },
    failure: function(result, request) {
    Ext.getCmp('content').update("Error");
    Ext.getCmp('status').setTitle('No se pudo cargar desde el WebService');
    Ext.getBody().unmask();
    }
    });
    };


    This the method

    <WebMethod(Description:="Traer conforme a una condicion y deja XML")> _
    <ScriptMethod(ResponseFormat:=ResponseFormat.Json, UseHttpGet:=True, XmlSerializeString:=False)> _
    PublicFunction GetEmployeesByNoPersonalXML(ByVal NoPersonal AsString) As clGeneralesEmp2()
    Dim cDatos AsNew ClasesParaDatosAux.clsADONet2.clsADONet_SQL
    Utilerias.PrepararDatos(cDatos)
    cDatos.ArmarCadenaConexion()
    Dim strSQL AsString = _
    "SELECT Nombre, P.NoPosicion, FechaNacimiento, FechaIngreso " & _
    "From perFuerzaTrabajo P, orgPosiciones S, orgUnidadesOrg O, orgDivisiones D," & _
    " orgSubdivisiones SD " & _
    "Where S.NoPosicion = P.NoPosicion and O.NoUnidadOrg = S.NoUnidadOrg" & _
    " and D.Division = S.Division and" & _
    " (S.Division = SD.Division and S.Subdivision = SD.SubDivision) " & _
    "And ( NoPersonal = " & NoPersonal & ")"
    Dim datares As DataTable
    Dim ds AsNew DataSet
    If cDatos.conectar Then
    Try
    If cDatos.PreparaDataSet(ds, strSQL, "perFuerzaTrabajo") Then
    datares = ds.Tables(0)
    EndIf
    Catch ex As Exception
    Finally
    IfNot IsNothing(ds) Then ds.Dispose()
    cDatos.CerrarConexion()
    EndTry
    EndIf
    Dim Al AsNew ArrayList
    ForEach row As Data.DataRow In datares.Rows
    Utilerias.MoverDtEmpl2RowAArray(row, Al)
    Next
    datares.Dispose()
    Dim outArray() As clGeneralesEmp2 = CType(Al.ToArray(GetType(clGeneralesEmp2)), clGeneralesEmp2())
    Return outArray
    EndFunction

    This is the out class clGeneralesEmp2

    Imports Microsoft.VisualBasic
    PublicClass clGeneralesEmp2
    Public Nombre AsString
    Public NoPosicion AsLong
    Public FechaNacimiento AsString
    Public FechaIngreso AsString
    End
    Class

    This is the function that convert the datarow in array
    PublicSharedSub MoverDtEmpl2RowAArray(ByRef drP As Data.DataRow, ByRef ArrayRef As ArrayList)
    Dim obj As clGeneralesEmp2 = New clGeneralesEmp2
    IfNot IsDBNull(drP.Item("Nombre")) Then
    obj.Nombre = CType(drP.Item("Nombre"), String)
    Else
    obj.Nombre = ""
    EndIf
    IfNot IsDBNull(drP.Item("NoPosicion")) Then
    obj.NoPosicion = CType(drP.Item("NoPosicion"), Long)
    Else
    obj.NoPosicion = 0
    EndIf
    IfNot IsDBNull(drP.Item("FechaNacimiento")) Then
    obj.FechaNacimiento = Utilerias.FechaConMes_str(CType(drP.Item("FechaNacimiento"), Date).ToString, False).ToUpper
    Else
    obj.FechaNacimiento = Utilerias.FechaConMes_str(Now.ToString, False).ToUpper
    EndIf
    IfNot IsDBNull(drP.Item("FechaIngreso")) Then
    obj.FechaIngreso = Utilerias.FormatearFecha(CType(drP.Item("FechaIngreso"), Date).ToString, False).ToUpper
    Else
    obj.FechaIngreso = Utilerias.FechaConMes_str(Now.ToString, False).ToUpper
    EndIf
    ArrayRef.Add(obj)
    EndSub

    This is the result of webservices method

    <?xml version="1.0" encoding="utf-8" ?>
    - <ArrayOfClGeneralesEmp2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
    - <clGeneralesEmp2>
    <Nombre>ANTONIO ADAMS JHONSON</Nombre>

    <NoPosicion>1889</NoPosicion>

    <FechaNacimiento>AGO/12/1968</FechaNacimiento>

    <FechaIngreso>01/07/1992</FechaIngreso>

    </clGeneralesEmp2>


    </ArrayOfClGeneralesEmp2>




  2. #2
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,361
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    Are you serious!???!

    1) Post code in code tags
    2) Please ost a specific problem, not a general one.

Similar Threads

  1. How to call ASP WebService from ExtJS?
    By Goldcoding in forum Ext 3.x: Help & Discussion
    Replies: 7
    Last Post: 9 Jul 2010, 1:57 PM
  2. Not load .asmx return parameter
    By Jacky0426 in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 25 Apr 2010, 8:12 PM
  3. Extjs to call a RESTful webservice
    By vivekc in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 1 Dec 2009, 10:55 PM
  4. Can anyone give me a example which use ext to call a webservice?
    By brumby007 in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 23 Mar 2008, 1:58 AM

Thread Participants: 1

Tags for this Thread