Adding a work order - HxGN EAM - 12.0 - Customization & Programming - Hexagon

HxGN EAM Web Services Toolkit Programmer Help

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

The Submit button's click event handler calls the CallAddWorkOrderService routine, which will set up and call the AddWorkOrderService web service. The routine behaves the same as the previous sample with the following differences:

  • Instead of writing a routine like InitializeWOService (See AddWorkOrder Sample.) to set all of the properties required by the web service to create the SOAP message header, we use the PrepareServiceRequest method of the global Session object.

    Globals.Session.PrepareServiceRequest(addWOService)

    result = addWOService.AddWorkOrderOp(serviceData)

    PrepareServiceRequest takes an instance of the web service class and sets all the appropriate properties of the instance needed by the web service call.

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

  • Instead of writing a routine like CreateWorkOrder (See AddWorkOrder sample) to set the WorkOrder property of the serviceData object, we use the CopyValuesFromControls method of ObjFieldLinkProvider to copy the values from the controls to the service Data.WorkOrder object.

    serviceData.WorkOrder = New WebServices.MP0023.WorkOrder serviceData.WorkOrder.FIXED = "V" ' Required and hard coded value

    Me.ObjFieldLinkProvider.CopyValuesFromControls(serviceData.WorkOrder)

  • The Fixed property is set directly in code because there is no control that maps its contents to this property.

    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.