Click here to Skip to main content
15,845,742 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:

I am getting a complier error in the following code at clsof_Factory_LineSe can any one help me out . This code works fine in Ms Access2003 but now working in MsAccess2010.I found that IGCTMObjectFactory works as a function in Access2003 and in access 2010 it works as sub routine.Help please

Private sc_LineServiceEJB As SoapClient30
Private Const c_WSDL_URL_QMAS As String = "C:\qmas.wsdl"
Private Const c_WSDL_URL_LOP As String = "C:\lop.wsdl"

Private Const c_SERVICE As String = "LineServiceEJBRemoteIFService"
Private Const c_PORT As String = "LineServiceEJBRemoteIF"
Private Const c_SERVICE_NAMESPACE As String = ""

Public Sub Custom_Initialize(blnTCS As Boolean)
    '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='LineServiceEJBRemoteIFService'>"

    str_WSML = str_WSML & "<using PROGID='MSOSOAP.GenericCustomTypeMapper30' cachable='0' ID='GCTM'/>"

    str_WSML = str_WSML & "<types>"

    str_WSML = str_WSML & "<type name='Info' targetNamespace='' uses='GCTM' targetClassName='struct_Info'/>"

    str_WSML = str_WSML & "<type name='Message' targetNamespace='' uses='GCTM' targetClassName='struct_Message'/>"

    str_WSML = str_WSML & "<type name='Parameter' targetNamespace='' uses='GCTM' targetClassName='struct_Parameter'/>"

    str_WSML = str_WSML & "<type name='UpdateInfoRequest' targetNamespace='' uses='GCTM' targetClassName='struct_UpdateInfoR'/>"

    str_WSML = str_WSML & "<type name='UpdateInfoResponse' targetNamespace='' uses='GCTM' targetClassName='struct_UpdateInfoR1'/>"

    str_WSML = str_WSML & "</types>"

    str_WSML = str_WSML & "</service>"

    str_WSML = str_WSML & "</servicemapping>"

    Set sc_LineServiceEJB = New SoapClient30

    If blnQMAS Then
        sc_LineServiceEJB.MSSoapInit2 c_WSDL_URL_QMAS, str_WSML, c_SERVICE, c_PORT, c_SERVICE_NAMESPACE
        sc_LineServiceEJB.MSSoapInit2 c_WSDL_URL_LOP, str_WSML, c_SERVICE, c_PORT, c_SERVICE_NAMESPACE
    End If
    'Use the proxy server defined in Internet Explorer's LAN settings by
    'setting ProxyServer to <CURRENT_USER>

    sc_LineServiceEJB.ConnectorProperty("ProxyServer") = "<CURRENT_USER>"

    'Autodetect proxy settings if Internet Explorer is set to autodetect
    'by setting EnableAutoProxy to True

    sc_LineServiceEJB.ConnectorProperty("EnableAutoProxy") = True

    sc_LineServiceEJB.ConnectorProperty("Timeout") = 180000

    Set sc_LineServiceEJB.ClientProperty("GCTMObjectFactory") = New clsof_Factory_LineSe
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_LineServiceEJB = Nothing

Exit Sub

  LineServiceEJBErrorHandler ("Class_Terminate")
End Sub

Private Sub LineServiceEJBErrorHandler(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_LineServiceEJB.FaultCode <> "" Then
        Err.Raise vbObjectError, str_Function, sc_LineServiceEJB.FaultString
    'Non SOAP Error
        Err.Raise Err.Number, str_Function, Err.Description
    End If

End Sub

Public Function wsm_updateInfo(ByVal obj_updateRequest As struct_InfoR) As struct_UpdateInfoR1
    'Proxy function created from  "C:\qmas.wsdl"

    'Error Trap
    On Error GoTo wsm_updateInfoTrap

    Set wsm_updateInfo = sc_LineServiceEJB.updateInfo(obj_updateRequest)

Exit Function
   LineServiceEJBErrorHandler "wsm_updateInfo"
End Function

The code of clsof_Factory_LineSe

Private Function IGCTMObjectFactory_CreateObject(ByVal par_WSMLNode As MSXML2.IXMLDOMNode) As Object
    Dim node As IXMLDOMNode

    On Error GoTo IGCTMObjectFactoryTrap

    Set node = par_WSMLNode.Attributes.getNamedItem("targetClassName")

    Set IGCTMObjectFactory_CreateObject = Nothing

    If Not (node Is Nothing) Then
        Select Case node.NODEVALUE
            Case "struct_LicenseeInfo"
                Set IGCTMObjectFactory_CreateObject = New struct_Info
            Case "struct_Message"
                Set IGCTMObjectFactory_CreateObject = New struct_Message
            Case "struct_Parameter"
                Set IGCTMObjectFactory_CreateObject = New struct_Parameter
            Case "struct_UpdateLicenseesInfoR"
                Set IGCTMObjectFactory_CreateObject = New struct_UpdateInfoR
            Case "struct_UpdateLicenseesInfoR1"
                Set IGCTMObjectFactory_CreateObject = New struct_UpdateInfoR1
        End Select
    End If

Exit Function

    Err.Raise Err.Number, "clsof_Factory_LineSe", Err.Description
End Function
Updated 13-Jun-12 20:16pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900