Ver Mensaje Individual
  #6 (permalink)  
Antiguo 21/03/2013, 12:47
th3r0rn
 
Fecha de Ingreso: noviembre-2007
Mensajes: 504
Antigüedad: 17 años, 3 meses
Puntos: 2
Respuesta: Como evitar que me salga este error

Muchas gracias Ka0stj ya logre que mi codigo funcione, solo hize una pequeña modificacion. Dejo el ejemplo por si alguien mas tiene el mismo problema:
Código vb:
Ver original
  1. Imports System.Web
  2. Imports System.Web.Services
  3. Imports System.Web.Services.Protocols
  4. Imports SAP.Middleware.Connector
  5.  
  6. ' Para permitir que se llame a este servicio Web desde un script, usando ASP.NET AJAX, quite la marca de comentario de la siguiente línea.
  7. ' <System.Web.Script.Services.ScriptService()> _
  8. <WebService(Namespace:="http://tempuri.org/")> _
  9. <WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
  10. <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
  11. Public Class CallRFC
  12.    Inherits System.Web.Services.WebService
  13.     Private _ecc As RfcDestination
  14.  
  15.     <WebMethod()> _
  16.     Public Function GetCompayName(ByVal companyID As String) As String
  17.  
  18.  
  19.         Try
  20.             _ecc = RfcDestinationManager.TryGetDestination("ECDCLNT140")
  21.  
  22.             If (_ecc Is Nothing) Then
  23.                 RfcDestinationManager.RegisterDestinationConfiguration(New ECCDestinationConfig())
  24.                 _ecc = RfcDestinationManager.GetDestination("ECDCLNT140")
  25.             End If
  26.  
  27.         Catch ex As Exception
  28.             System.Console.WriteLine(ex.Message)
  29.             System.Console.ReadLine()
  30.         End Try
  31.  
  32.  
  33.  
  34.         ' System.Console.WriteLine(String.Format("Successfully connected to System {0} Client {1}.", _ecc.SystemID, _ecc.Client))
  35.        ' System.Console.WriteLine("Enter a company ID:") ' Ingresar el ID: 000880
  36.  
  37.         ' Dim companyID As String = System.Console.ReadLine()
  38.  
  39.         While Not String.IsNullOrEmpty(companyID.Trim)
  40.  
  41.             Dim companyAPI As IRfcFunction = _ecc.Repository.CreateFunction("BAPI_COMPANY_GETDETAIL")
  42.             companyAPI.SetValue("COMPANYID", companyID)
  43.  
  44.             companyAPI.Invoke(_ecc)
  45.  
  46.             Dim companyName As String = companyAPI.GetStructure("COMPANY_DETAIL").GetString("NAME1")
  47.  
  48.  
  49.             If String.IsNullOrEmpty(companyName.Trim) Then
  50.                 companyName = "Not found 1"
  51.             End If
  52.  
  53.             Return companyName
  54.  
  55.             companyID = System.Console.ReadLine()
  56.  
  57.         End While
  58.     End Function
  59. End Class