Getting a work order - HxGN EAM - 12.0.1 - Customization & Programming - Hexagon

HxGN EAM Web Services Toolkit Programmer

Language
English
Product
HxGN EAM
Search by Category
Customization & Programming
HxGN EAM Version
12.0.1

The Retrieve button's click event handler calls the CallGetWorkOrderService routine, which will set up and call the GetWorkOrderService web service. The routine performs the following steps:

  • Uses the WorkOrderPromptForm to prompt for the Work Order Number and Organization to get.

  • Prompts for the login details.

    Defines variables needed to call the web service. A reference to the actual web service class:

    Dim getWOService As WebServices.MP0024.AddWorkOrderService

    An instance class that will hold the information that must be passed to the web service call:

    Dim serviceData As New WebServices.MP0024.MP0024_GetWorkOrder_001

    A reference to the class that will hold the result of the call to the web service:

    Dim result As WebServices.MP0024.MP0024_AddWorkOrder_001_Result

  • The serviceData object has a property WORKORDERID that will contain the work order number and organization gathered on dialog.

    serviceData.WORKORDERID = New WebServices.MP0024.WOID_Type serviceData.WORKORDERID.JOBNUM = workOrderNumber serviceData.WORKORDERID.ORGANIZATIONID = New

    WebServices.MP0024.ORGANIZATIONID_Type

    serviceData.WORKORDERID.ORGANIZATIONID.ORGANIZATIONCODE =

    organization

    Note that, as in the previous sample, any property that has a reference type must be instantiated before its properties can be set.

  • Calls the PrepareServiceRequest method of the global Session object. This method takes an instance of the web service class and sets all the appropriate properties of the instance needed by the web service call.

    Globals.Session.PrepareServiceRequest(getWOService)

    Globals.Session is a global instance of the Datastream.EWS.Session class. It is accessed through the Session property of the Globals module that can be found in the Globals.vb file.

  • Calls the GetWorkOrderOp method of the web service and assigns the result to the result variable. This is the routine that was generated from the WSDL file and is the actual call to the web service.

    result = getWOService.GetWorkOrderOp(serviceData)

    Always make the call to a web service in a Try/Catch block, since any problems will be raised by the web service as a SoapException.

  • The result of the call to the web service is passed to the CompleteServiceRequest method of the Session object. This method extracts the session ID returned by the web service call and stores it in the SessionId property of the Session object for later use.

    Globals.Session.CompleteServiceRequest(getWOService)

  • If the result is valid, the form controls are populated with the work order data from the result property ResultData.WorkOrder by the call to ObjFieldLinkProvider.CopyValuesToControls. See ObjectFieldLinkProvider.

    Me.ObjFieldLinkProvider.CopyValuesToControls(result.ResultData.WorkOrder)