How to test a SOAP Agent without needing a SOAP Server program

Date:22 June 2007
Product/Release:LANSA Integrator
Abstract:Testing a SOAP Agent program without needing a SOAP Server
Submitted By:LANSA Technical Support

When writing SOAP Agents, there are times when a SOAP Server isn't readily available to test with. Therefore one can simulate a test by using a standard Server program which tests the sending of data from the SOAP Agent.

Use the HTTPService to consume and trace the SOAP XML message and to optionally send back a SOAP XML message.

The SOAP XML response is contained in a file. This allows quick and easy modification of the XML response.

Normally you use the CALL command with no URL keyword. This will use the endpoint address embedded in the WSDL.

CHANGE FIELD(#JSMCMD) TO('''CALL'')
USE BUILTIN(JSM_COMMAND) WITH_ARGS(#JSMCMD) TO_GET(#JSMSTS #JSMMSG)

Use the URL keyword to direct the SOAP Agent to another address.

CHANGE FIELD(#JSMCMD) TO('''CALL URL(http://LANSA01:1099/cgi-bin/jsmdirect?soapstatic)''')
USE BUILTIN(JSM_COMMAND) WITH_ARGS(#JSMCMD) TO_GET(#JSMSTS #JSMMSG)

==============================================================

Process . . : JSMTEST05 JSM SOAP

JTSTS03 SOAP - Static File

********** Beginning of RDML commands **********
DEFINE FIELD(#JSMSTS) TYPE(*CHAR) LENGTH(20)
DEFINE FIELD(#JSMMSG) TYPE(*CHAR) LENGTH(255)
DEFINE FIELD(#JSMCMD) TYPE(*CHAR) LENGTH(255)
**********
********** 'Open service'
**********
USE BUILTIN(JSM_OPEN) TO_GET(#JSMSTS #JSMMSG)
EXECUTE SUBROUTINE(CHECK) WITH_PARMS(#JSMSTS #JSMMSG)
**********
********** 'Load service'
**********
CHANGE FIELD(#JSMCMD) TO('SERVICE_LOAD SERVICE(HTTPSERVICE) TRACE(*YES)')
USE BUILTIN(JSM_COMMAND) WITH_ARGS(#JSMCMD) TO_GET(#JSMSTS #JSMMSG)
EXECUTE SUBROUTINE(CHECK) WITH_PARMS(#JSMSTS #JSMMSG)
**********
********** Send response
**********
CHANGE FIELD(#JSMCMD) TO('''SEND HANDLER(InboundFile) FILE(soap-response.xml) CONTENT(*SOAP)''')
**********
USE BUILTIN(JSM_COMMAND) WITH_ARGS(#JSMCMD) TO_GET(#JSMSTS #JSMMSG)
EXECUTE SUBROUTINE(CHECK) WITH_PARMS(#JSMSTS #JSMMSG)
**********
**********
********** 'Close service'
**********
USE BUILTIN(JSM_CLOSE) TO_GET(#JSMSTS #JSMMSG)
EXECUTE SUBROUTINE(CHECK) WITH_PARMS(#JSMSTS #JSMMSG)
**********
********** SUB ROUTINES
**********
SUBROUTINE NAME(CHECK) PARMS((#JSMSTS *RECEIVED) (#JSMMSG *RECEIVED))
**********
IF COND('#JSMSTS *NE OK')
**********
********** Close service and send the HTTP response
**********
USE BUILTIN(JSM_CLOSE) TO_GET(#JSMSTS #JSMMSG)
**********
ENDIF
**********
ENDROUTINE
********** End of RDML commands **********

=================================================

Direct Service Editor screen