jimmysevenlopez
Member
Tengo un webservice asmx realizado en .net funcionando. Utilizo IIS.
En B4A cuando utilizo solamente un parámetro funciona perfecto pero cuando son dos o mas me regresa NULL.
Nota: Aunque diga sumanumeros o hable de numeros, utilizo strings.
Gracias.
Este es mi codigo actual en B4A
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
Mi webservice
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
' Para permitir que se llame a este servicio web desde un script, usando ASP.NET AJAX, quite la marca de comentario de la línea siguiente.
' <System.Web.Script.Services.ScriptService()> _
<System.Web.Services.WebService(Namespace:="http://192.168.0.7/sumanumeros/")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> _
Public Class WSSumaNumeros
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function SumaNumeros(A As String, B As String) As String
Dim Junta As String
Junta = A & B
Return Junta
End Function
End Class
			
			En B4A cuando utilizo solamente un parámetro funciona perfecto pero cuando son dos o mas me regresa NULL.
Nota: Aunque diga sumanumeros o hable de numeros, utilizo strings.
Gracias.
Este es mi codigo actual en B4A
			
				B4X:
			
		
		
		Private Sub CmdInicia_Click
    IniciaWebService ("Elon","Musk")
End Sub
Sub IniciaWebService(NumeroA As String, NumeroB As String)
    Dim job1 As HttpJob
    Dim XML As String
   
    XML = ""
    XML = XML & "<?xml version='1.0' encoding='utf-8'?>"
    XML = XML & "<soap12:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap12='http://www.w3.org/2003/05/soap-envelope'>"
    XML = XML & "<soap12:Body>"
    XML = XML & "<SumaNumeros xmlns='http://192.168.0.7/sumanumeros/'>"
    XML = XML & "<NumeroA>" & NumeroA & "</NumeroA>"
    XML = XML & "<NumeroB>" & NumeroB & "</NumeroB>"
    XML = XML & "</SumaNumeros>"
    XML = XML & "</soap12:Body>"
    XML = XML & "</soap12:Envelope>"
    XML = XML.Replace("'", Chr(34))
    job1.Initialize("JOBSOAP", Me)
    job1.PostString ("http://192.168.0.7/sumanumeros/WSSumaNumeros.asmx", XML)
    job1.GetRequest.SetContentType("application/soap+xml")
End Sub
Sub JobDone (Job As HttpJob)
    Dim resultat As String
    If Job.Success Then
        Dim Res As String
        Res = Job.GetString
        Select Job.JobName
            Case "JOBSOAP"
                resultat = xmlGetTagContent(Res,"SumaNumerosResult")
                MsgboxAsync(resultat,"resultat")
        End Select
    Else
        MsgboxAsync( Job.errormessage , "Error")
    End If
    Job.Release
End Sub
Sub xmlGetTagContent(xml As String, tag As String) As String
    Dim i, j As Int
    'Find start-tag:
    i = xml.IndexOf("<" & tag & ">")
    If i < 0 Then i = xml.IndexOf("<" & tag & " ")
    If i < 0 Then Return Null
    i = xml.IndexOf2(">", i) + 1
  
    'Find stop-tag:
    j = xml.LastIndexOf("</" & tag & ">")
    If i < j Then
        Return xml.SubString2(i, j)
    Else
        Return Null
    End If
End Sub
	Mi webservice
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
' Para permitir que se llame a este servicio web desde un script, usando ASP.NET AJAX, quite la marca de comentario de la línea siguiente.
' <System.Web.Script.Services.ScriptService()> _
<System.Web.Services.WebService(Namespace:="http://192.168.0.7/sumanumeros/")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> _
Public Class WSSumaNumeros
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function SumaNumeros(A As String, B As String) As String
Dim Junta As String
Junta = A & B
Return Junta
End Function
End Class
			
				Last edited: