WebServicesEx Program

Uses

  • program~~webservicesex~~UsesGraph program~webservicesex WebServicesEx module~esmf ESMF program~webservicesex->module~esmf module~esmf_testmod ESMF_TestMod program~webservicesex->module~esmf_testmod module~esmf_webservmod ESMF_WebServMod program~webservicesex->module~esmf_webservmod module~esmf_webservusermodel ESMF_WebServUserModel program~webservicesex->module~esmf_webservusermodel

Calls

program~~webservicesex~~CallsGraph program~webservicesex WebServicesEx esmf_gridcompsetservices esmf_gridcompsetservices program~webservicesex->esmf_gridcompsetservices proc~esmf_finalize ESMF_Finalize program~webservicesex->proc~esmf_finalize proc~esmf_gridcompcreate ESMF_GridCompCreate program~webservicesex->proc~esmf_gridcompcreate proc~esmf_initialize ESMF_Initialize program~webservicesex->proc~esmf_initialize proc~esmf_stest ESMF_STest program~webservicesex->proc~esmf_stest c_esmc_getcompliancechecktrace c_esmc_getcompliancechecktrace proc~esmf_finalize->c_esmc_getcompliancechecktrace proc~esmf_calendarfinalize ESMF_CalendarFinalize proc~esmf_finalize->proc~esmf_calendarfinalize proc~esmf_logfinalize ESMF_LogFinalize proc~esmf_finalize->proc~esmf_logfinalize proc~esmf_logflush ESMF_LogFlush proc~esmf_finalize->proc~esmf_logflush proc~esmf_logrc2msg ESMF_LogRc2Msg proc~esmf_finalize->proc~esmf_logrc2msg proc~esmf_logwrite ESMF_LogWrite proc~esmf_finalize->proc~esmf_logwrite proc~esmf_traceclose ESMF_TraceClose proc~esmf_finalize->proc~esmf_traceclose proc~esmf_vmabort ESMF_VMAbort proc~esmf_finalize->proc~esmf_vmabort proc~esmf_vmfinalize ESMF_VMFinalize proc~esmf_finalize->proc~esmf_vmfinalize c_esmc_vmaddfobject c_esmc_vmaddfobject proc~esmf_gridcompcreate->c_esmc_vmaddfobject proc~esmf_clockgetinit ESMF_ClockGetInit proc~esmf_gridcompcreate->proc~esmf_clockgetinit proc~esmf_compconstruct ESMF_CompConstruct proc~esmf_gridcompcreate->proc~esmf_compconstruct proc~esmf_configgetinit ESMF_ConfigGetInit proc~esmf_gridcompcreate->proc~esmf_configgetinit proc~esmf_gridcompset ESMF_GridCompSet proc~esmf_gridcompcreate->proc~esmf_gridcompset proc~esmf_gridgetinit ESMF_GridGetInit proc~esmf_gridcompcreate->proc~esmf_gridgetinit proc~esmf_hconfiggetinit ESMF_HConfigGetInit proc~esmf_gridcompcreate->proc~esmf_hconfiggetinit proc~esmf_imerr ESMF_IMErr proc~esmf_gridcompcreate->proc~esmf_imerr proc~esmf_logfoundallocerror ESMF_LogFoundAllocError proc~esmf_gridcompcreate->proc~esmf_logfoundallocerror proc~esmf_logfounderror ESMF_LogFoundError proc~esmf_gridcompcreate->proc~esmf_logfounderror proc~esmf_frameworkinternalinit ESMF_FrameworkInternalInit proc~esmf_initialize->proc~esmf_frameworkinternalinit proc~esmf_initialize->proc~esmf_logfounderror proc~esmf_vmbarrier ESMF_VMBarrier proc~esmf_initialize->proc~esmf_vmbarrier proc~esmf_vmgetglobal ESMF_VMGetGlobal proc~esmf_initialize->proc~esmf_vmgetglobal interface~esmf_vmget ESMF_VMGet proc~esmf_stest->interface~esmf_vmget proc~esmf_stest->proc~esmf_logwrite proc~esmf_test ESMF_Test proc~esmf_stest->proc~esmf_test proc~esmf_stest->proc~esmf_vmgetglobal

Variables

Type Attributes Name Initial
character(len=ESMF_MAXSTR) :: failMsg
character(len=ESMF_MAXSTR) :: testname
integer :: finalrc
integer :: portNum
integer :: rc
integer :: result
type(ESMF_GridComp) :: comp1

Source Code

program WebServicesEx
#include "ESMF.h"

  ! ESMF Framework module
  use ESMF
  use ESMF_TestMod

  use ESMF_WebServMod
  use ESMF_WebServUserModel

  implicit none

  ! Local variables
  type(ESMF_GridComp) :: comp1     !! Grid Component
  integer             :: rc        !! Return Code
  integer             :: finalrc  !! Final return code
  integer             :: portNum   !! The port number for the listening socket
!EOC
  integer             :: result   
  character(ESMF_MAXSTR) :: testname
  character(ESMF_MAXSTR) :: failMsg

!-------------------------------------------------------------------------
!-------------------------------------------------------------------------

    write(failMsg, *) "Example failure"
    write(testname, *) "Example ESMF_WebServicesEx"


! ------------------------------------------------------------------------------
! ------------------------------------------------------------------------------

!BOE
!  A listening socket will be created on the local machine with the specified
!  port number.  This socket is used by the service to
!  wait for and receive requests from the client.  Check with your system
!  administrator to determine an appropriate port to use for your service.
!EOE

!BOC
  finalrc = ESMF_SUCCESS

  call ESMF_Initialize(defaultlogfilename="WebServicesEx.Log", &
                    logkindflag=ESMF_LOGKIND_MULTI, rc=rc)
!EOC
  if (rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT)
!BOC
  ! create the grid component 
  comp1 = ESMF_GridCompCreate(name="My Component", rc=rc)
!EOC
  if (rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT)
!BOC
  ! Set up the register routine 
  call ESMF_GridCompSetServices(comp1, &
          userRoutine=ESMF_WebServUserModelRegister, rc=rc)
!EOC
  if (rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT)
  !!!!!!!
  !! KDS: I've commented out the call to ESMF_WebServicesLoop so that it won't
  !! enter the infinite loop and hold up the examples run.  I'll keep it
  !! commented out until I create an example client that will send an EXIT
  !! to the loop.
  !!!!!!!
!BOC
  portNum = 27060

  ! Call the Web Services Loop and wait for requests to come in
  !call ESMF_WebServicesLoop(comp1, portNum, rc=rc)
!EOC
  if (rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT)
!BOE
!  The call to ESMF\_WebServicesLoop will setup the listening socket for your
!  service and will wait for requests from a client.  As requests are received,
!  the Web Services software will process the requests and then return to the
!  loop to continue to wait.
!EOE
!BOE
!  The 3 main requests processed are INIT, RUN, and FINAL.  These requests 
!  will then call the appropriate callback routine as specified in your 
!  register routine (as specified in the ESMF\_GridCompSetServices call).
!  In this example, when the INIT request is received, the user\_init routine
!  found in the ESMF\_WebServUserModel module is called.
!EOE
!BOE
!  One other request is also processed by the Component Service, and that is
!  the EXIT request.  When this request is received, the Web Services loop
!  is terminated and the remainder of the code after the ESMF\_WebServicesLoop
!  call is executed.
!EOE


10 continue
 ! IMPORTANT: ESMF_STest() prints the PASS string and the # of processors in the log
 ! file that the scripts grep for.
  call ESMF_STest((finalrc.eq.ESMF_SUCCESS), testname, failMsg, result, ESMF_SRCLINE)


!BOC
  call ESMF_Finalize(rc=rc)
!EOC
  
  if (rc/=ESMF_SUCCESS) finalrc = ESMF_FAILURE
  if (finalrc==ESMF_SUCCESS) then
    print *, "PASS: ESMF_WebServicesEx.F90"
  else
    print *, "FAIL: ESMF_WebServicesEx.F90"
  endif

!BOC
end program WebServicesEx