Вызов Web-services из MS Visual Basi Application , нужен пример #323629


#0 by DK_L
Установил у себя Office XP Web Services Toolkit 2.0 Далее в редакторе Tools--Web... , ввожу строку URL на свой вэб-сервис - пишет гад,что не найден, а ввожу - все нормально. Я уже и писал строку URL с логином и паролем - нет результата :( .Что делать ?
#1 by DK_L
Хотя свой вэб-сервис отрабатывает через 1С-ку из другой 1С-ки - получает данные.
#2 by ШтушаКутуша
а твой вэб-сервис в какой кодировке работает?
#3 by DK_L
<?xml version="1.0" encoding="UTF-8"?>
#4 by jbond
Приведи пример вызова SOAP-метода flightstatus.wsdl
#5 by DK_L
'***************************************************************** 'This class was created by the Web Service References Tool 2.0. ' 'Created: 2/15/2008 05:53:04 PM ' 'Description: 'This class is a Visual Basic for Applications class representation of the Web service 'as defined by . ' 'To Use: 'Dimension a variable as new clsws_FlightStatus, and then write code to 'use the methods provided by the class. 'Example: ' Dim ExampleVar as New clsws_FlightStatus ' debug.print ExampleVar.wsm_AirportList("Sample Input") ' 'For more information, see Complex Types in Web Service References 'Tool 2.0 Help. ' 'Changes to the code in this class may result in incorrect behavior. ' '***************************************************************** 'Dimensioning private class variables. Private sc_FlightStatus As SoapClient30 Private Const c_WSDL_URL As String = "http://webservices.aeroflot.aero/flightstatus.wsdl" Private Const c_SERVICE As String = "FlightStatus" Private Const c_PORT As String = "FlightStatusSoap" Private Const c_SERVICE_NAMESPACE As String = "http://www.aeroflot.ru/" Private Sub Class_Initialize    '*****************************************************************    'This subroutine will be called each time the class is instantiated.    'Creates sc_ComplexTypes as new SoapClient30, and then    'initializes sc_ComplexTypes.mssoapinit2 with WSDL file found in    '.    '*****************************************************************    Dim str_WSML As String    str_WSML = "<servicemapping>"    str_WSML = str_WSML & "<service name='FlightStatus'>"    str_WSML = str_WSML & "<using PROGID='MSSOAP.GenericCustomTypeMapper30' cachable='0' ID='GCTM'/>"    str_WSML = str_WSML & "<types>"    str_WSML = str_WSML & "<type name='Airport' targetNamespace='' uses='GCTM' targetClassName='struct_Airport'/>"    str_WSML = str_WSML & "<type name='Flight' targetNamespace='' uses='GCTM' targetClassName='struct_Flight'/>"    str_WSML = str_WSML & "<type name='FlightDetail' targetNamespace='' uses='GCTM' targetClassName='struct_FlightDetail'/>"    str_WSML = str_WSML & "<type name='FlightShort' targetNamespace='' uses='GCTM' targetClassName='struct_FlightShort'/>"    str_WSML = str_WSML & "</types>"    str_WSML = str_WSML & "</service>"    str_WSML = str_WSML & "</servicemapping>"    Set sc_FlightStatus = New SoapClient30    sc_FlightStatus.MSSoapInit2 c_WSDL_URL, str_WSML, c_SERVICE, c_PORT, c_SERVICE_NAMESPACE    'Use the proxy server defined in Internet Explorer's LAN settings by    'setting ProxyServer to <CURRENT_USER>    sc_FlightStatus.ConnectorProperty("ProxyServer") = "<CURRENT_USER>"    'Autodetect proxy settings if Internet Explorer is set to autodetect    'by setting EnableAutoProxy to True    sc_FlightStatus.ConnectorProperty("EnableAutoProxy") = True    Set sc_FlightStatus.ClientProperty("GCTMObjectFactory") = New clsof_Factory_FlightStatus End Sub Private Sub Class_Terminate    '*****************************************************************    'This subroutine will be called each time the class is destructed.    'Sets sc_ComplexTypes to Nothing.    '*****************************************************************    'Error Trap    On Error GoTo Class_TerminateTrap    Set sc_FlightStatus = Nothing Exit Sub Class_TerminateTrap:    FlightStatusErrorHandler ("Class_Terminate") End Sub Private Sub FlightStatusErrorHandler(str_Function As String)    '*****************************************************************    'This subroutine is the class error handler. It can be called from any class subroutine or function    'when that subroutine or function encounters an error. Then, it will raise the error along with the    'name of the calling subroutine or function.    '*****************************************************************    'SOAP Error    If sc_FlightStatus.FaultCode <> "" Then        Err.Raise vbObjectError, str_Function, sc_FlightStatus.FaultString    'Non SOAP Error    Else        Err.Raise Err.Number, str_Function, Err.Description    End If End Sub Public Function wsm_AirportList As Variant    '*****************************************************************    'Proxy function created from .    '    '"wsm_AirportList" is an array with elements defined as struct_Airport    'See Complex Types: Arrays in Web Service References Tool 2.0 Help    'for details on implementing arrays.    '*****************************************************************    'Error Trap    On Error GoTo wsm_AirportListTrap    wsm_AirportList = sc_FlightStatus.AirportList Exit Function wsm_AirportListTrap:    FlightStatusErrorHandler "wsm_AirportList" End Function Public Function wsm_AirportInfo(ByVal str_code As String) As struct_Airport    '*****************************************************************    'Proxy function created from .    '*****************************************************************    'Error Trap    On Error GoTo wsm_AirportInfoTrap    Set wsm_AirportInfo = sc_FlightStatus.AirportInfo(str_code) Exit Function wsm_AirportInfoTrap:    FlightStatusErrorHandler "wsm_AirportInfo" End Function Public Function wsm_DateList As Variant    '*****************************************************************    'Proxy function created from .    '    '"wsm_DateList" is an array with elements defined as Date    'See Complex Types: Arrays in Web Service References Tool 2.0 Help    'for details on implementing arrays.    '*****************************************************************    'Error Trap    On Error GoTo wsm_DateListTrap    wsm_DateList = sc_FlightStatus.DateList Exit Function wsm_DateListTrap:    FlightStatusErrorHandler "wsm_DateList" End Function Public Function wsm_Arrival(ByVal str_code As String, ByVal str_date As String) As Variant    '*****************************************************************    'Proxy function created from .    '    '"wsm_Arrival" is an array with elements defined as struct_Flight    'See Complex Types: Arrays in Web Service References Tool 2.0 Help    'for details on implementing arrays.    '*****************************************************************    'Error Trap    On Error GoTo wsm_ArrivalTrap    wsm_Arrival = sc_FlightStatus.Arrival(str_code, str_date) Exit Function wsm_ArrivalTrap:    FlightStatusErrorHandler "wsm_Arrival" End Function Public Function wsm_Departure(ByVal str_code As String, ByVal str_date As String) As Variant    '*****************************************************************    'Proxy function created from .    '    '"wsm_Departure" is an array with elements defined as struct_Flight    'See Complex Types: Arrays in Web Service References Tool 2.0 Help    'for details on implementing arrays.    '*****************************************************************    'Error Trap    On Error GoTo wsm_DepartureTrap    wsm_Departure = sc_FlightStatus.Departure(str_code, str_date) Exit Function wsm_DepartureTrap:    FlightStatusErrorHandler "wsm_Departure" End Function Public Function wsm_FlightInfo(ByVal str_flt_pk As String) As Variant    '*****************************************************************    'Proxy function created from .    '    '"wsm_FlightInfo" is an array with elements defined as struct_FlightDetail    'See Complex Types: Arrays in Web Service References Tool 2.0 Help    'for details on implementing arrays.    '*****************************************************************    'Error Trap    On Error GoTo wsm_FlightInfoTrap    wsm_FlightInfo = sc_FlightStatus.FlightInfo(str_flt_pk) Exit Function wsm_FlightInfoTrap:    FlightStatusErrorHandler "wsm_FlightInfo" End Function Public Function wsm_FlightSearch(ByVal str_flight_no As String) As Variant    '*****************************************************************    'Proxy function created from .    '    '"wsm_FlightSearch" is an array with elements defined as struct_FlightShort    'See Complex Types: Arrays in Web Service References Tool 2.0 Help    'for details on implementing arrays.    '*****************************************************************    'Error Trap    On Error GoTo wsm_FlightSearchTrap    wsm_FlightSearch = sc_FlightStatus.FlightSearch(str_flight_no) Exit Function wsm_FlightSearchTrap:    FlightStatusErrorHandler "wsm_FlightSearch" End Function
#6 by DK_L
(all) прошу прощения, иду домой , доступ к тому вэб-сервису , к которому не получается подрубится - только на работе,посему буду рад на выходных услышать идеи , а протестировать только в понедельник :)
#7 by jbond
На сайте есть примеры на ASP. Вроде что-то работает:    Dim ws As New MSOSOAPLib30.SoapClient30        ws.ClientProperty("ServerHTTPRequest") = True    Call ws.MSSoapInit("http://webservices.aeroflot.ru/flightstatus.wsdl")    flights = ws.FlightInfo("Istambul")    'flights = SoapUtils.MakeVariantArray(flights)      ports = ws.AirportList
Тэги:
Ответить:
Комментарии доступны только авторизированным пользователям

В этой группе 1С