IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only

Invoking WebMethods Service from COM

  • 1.  Invoking WebMethods Service from COM

    Posted Thu March 27, 2003 04:44 AM

    We are trying to implement webMethods from COM+. So, I created a service which will post a XML string to another site. Now I am trying to invoke that service from my COM component.
    Here I am using two classes CONTEXT, VALUES provided by webMethods.dll. I used CONTEXT to connect to the Integration server and VALUES class, is to Put the input values to the service and get the output back as an object.
    After these objects work is finished, The COM+ is still showing the VALUES object is still active. It is destroying after some time. My understanding is The service from integration server is not releasing the COM object immediatly.

    Basically I want to kill the two objects from COM after I finished CONTEXT for Connect and INVOKE to invoke the service.
    I used Set object=nothing…but no use. it i killing only CONTEXT object, but not VALUES object.
    Please help me…

    Here is my code…

    Option Explicit
    Private s_objWC As webMethods.Context
    Private s_objInputs As webMethods.Values
    Private s_objOutputs As webMethods.Values

    Public Function SubmitXMLToWM(ByVal p_lngApplicationNumber As Long, ByVal p_strXMLString As String) As String
    On Error GoTo ErrorHandler

    Dim s_strUID As String 
    Dim s_strPWD As String 
    Dim s_strServer As String 
    Dim s_intServerPort As Integer 
    Dim s_lngReturnValue As Long 
    Dim s_strStatus As String 
    
    Dim s_objMgr As COMPSMMGR.clsCOMPSMMGR 
    
    '---------------Read Application.ini file------------------------------ 
    Set s_objMgr = New COMPSMMGR.clsCOMPSMMGR 
    s_strUID = s_objMgr.GetConnString("WebMEthods Data Source", "UID") 
    s_strPWD = s_objMgr.GetConnString("WebMEthods Data Source", "PWD") 
    s_strServer = s_objMgr.GetConnString("WebMEthods Data Source", "Server") 
    s_intServerPort = s_objMgr.GetConnString("WebMEthods Data Source", "ServerPort") 
    Set s_objMgr = Nothing 
    
    'Open the WM Connection 
    Set s_objWC = New webMethods.Context 
    s_objWC.Connect s_strServer & ":" & s_intServerPort, s_strUID, s_strPWD 
    
    'Invoke the Web Methods Service 
    Set s_objInputs = New webMethods.Values 
    s_objInputs.put "XMLString", p_strXMLString 
    
    Set s_objOutputs = s_objWC.Invoke("PostXMLToCAPS", "Ser_PostXMLToCAPS", s_objInputs) 
    
    s_strStatus = s_objOutputs.get("Status") 
    
    Set s_objInputs = Nothing 
    Set s_objOutputs = Nothing 
    s_objWC.disconnect 
    Set s_objWC = Nothing 
    
    SubmitXMLToWM = s_strStatus 
    Exit Function 
    

    ErrorHandler:
    Set s_objMgr = Nothing
    Set s_objInputs = Nothing
    Set s_objOutputs = Nothing
    s_objWC.disconnect
    Set s_objWC = Nothing

    Call DoLogError(Err.Number, Err.Source, "EN", 9000, _ 
    "clsCOMPCCWEB - SubmitXMLToWM - (Application Number  - " & p_lngApplicationNumber & ")" & _ 
    Err.Description, 1, 1, , "") 
    SubmitXMLToWM = Err.Number 
    

    End Function

    Public Function DoLogError(ByVal p_lngErrorNumber As Long, _
    ByVal p_strErrorSource As String, _
    ByVal p_strLanguage As String, _
    ByVal p_lngEventId As Long, _
    Optional ByVal p_strCustomMessage As String, _
    Optional ByVal p_intLogTarget As Integer, _
    Optional ByVal p_intLogType As Integer, _
    Optional ByVal p_strContext As String, _
    Optional ByVal p_strPageId As String, _


    #Integration-Server-and-ESB
    #Universal-Messaging-Broker
    #webMethods
    #broker