When a SOAP request is detected, the dispatcher is responsible for invoking the business rules associated with the requested method.
Dispatch-Request.
If Not Method-Namespace-Is-OK
Move "env:client" To FaultCode
Move "bis:WrongNamespace" To FaultString
Move "Wrong namespace for this interface"
To FaultDetail
Perform Indicate-Hard-Fault
Else
Evaluate True
When Method-Is-Find
Perform Process-Find-Method
When Other
Move "env:client" To FaultCode
Move "bis:WrongMethod" To FaultString
Move
"Method invoked is unknown to this interface" To
FaultDetail
Perform Indicate-Hard-Fault
End-Evaluate
End-If.
Stop Run.
Process-Find-Method.
open input office-code-file.
move spaces to output-parameters of Find--method-parameters.
if office-code-success
move desired-company-name of input-parameters of Find--method-parameters
to company-name of office-code-file
start office-code-file key Not < company-name of office-code-file
invalid key move "Not Found" to result of Find--method-parameters
not invalid key
read office-code-file next
at end move "Not Found" to result of Find--method-parameters
not at end
move corr office-code-record
to output-parameters of Find--method-parameters
end-read
end-start
else
move "Unrecoverable Error" to result of Find--method-parameters
end-if.
perform Issue-response.
Issue-Response.
XML EXPORT FILE
SOAP-Request-Response *> data item to export from
BIS-Exchange-File-Name *> exported document file name
"SOAP-Request-Response" *> model data-name
"cobol_to_soap.xsl". *> stylesheet for transform
If Not XML-OK Go To Z.
Call "B$WriteResponse" Using
BIS-Response-SessionComplete
Giving BIS-Status
If Not BIS-OK Go To Z.
After an import of a request, the method-name field contains the requested method (folded to lower case) and the input (and input-output) parameters have been stored in the appropriate --method-parameters area. (This again is the result of the style sheet using the naming conventions described earlier.) The dispatching code checks for some errors (for example, being called erroneously by a client wanting to use a different service) and then uses EVALUATE method-name to invoke business rules appropriate to the method. After the business rules execute (the paragraph Process-Find-Method in the example), the SOAP response is exported to the exchange file (once again, the style sheet uses the method-name along with the naming conventions to 'know' which output-parameters contain the desired result data) and B$WriteResponse is called to notify the request handler that the response is in the exchange file; the request handler will send the contents of the exchange file to the client.