SOAP request/response

When a SOAP request is detected, the dispatcher invokes 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 lowercase) and the input and input-output parameters are stored in the appropriate ‑‑method-parameters area. The dispatching code checks for some errors, such as erroneous calls by a client wanting to use a different service, and then uses the 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 and B$WriteResponse notifies the request handler that the response is in the exchange file. The request handler sends the exchange file contents to the client.