

CREATE COMPUTE MODULE WS_ROUTER_SUBFLOW_ECHO_TEST_SET_RESPONSE
	CREATE FUNCTION Main() RETURNS BOOLEAN
	BEGIN
		DECLARE tns NAMESPACE 'http://soa.btn.co.id/dokpok';
		CALL CopyMessageHeaders();
		-- CALL CopyEntireMessage();
		SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)XmlDeclaration.(XMLNSC.Attribute)Version = '1.0';
		SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)XmlDeclaration.(XMLNSC.Attribute)Encoding = 'UTF-8';

		SET OutputRoot.XMLNSC.tns:echoTestResponse.paramoutResult = InputRoot.XMLNSC.tns:echoTestRequest.paramin;
		RETURN TRUE;
	END;

	CREATE PROCEDURE CopyMessageHeaders() BEGIN
		DECLARE I INTEGER 1;
		DECLARE J INTEGER;
		SET J = CARDINALITY(InputRoot.*[]);
		WHILE I < J DO
			SET OutputRoot.*[I] = InputRoot.*[I];
			SET I = I + 1;
		END WHILE;
	END;

	CREATE PROCEDURE CopyEntireMessage() BEGIN
		SET OutputRoot = InputRoot;
	END;
END MODULE;


CREATE COMPUTE MODULE WS_ROUTER_SUBFLOW_SET_DATA
	CREATE FUNCTION Main() RETURNS BOOLEAN
	BEGIN
		-- CALL CopyMessageHeaders();
		-- CALL CopyEntireMessage();
		CALL CopyEntireMessageToData();
		
		SET OutputRoot.XMLNSC.data.code = InputLocalEnvironment.SOAP.Envelope.SOAP.Context.service || '.' || InputLocalEnvironment.SOAP.Envelope.SOAP.Context.operation;
		SET OutputRoot.XMLNSC.data.group = FIELDVALUE(InputLocalEnvironment.SOAP.Envelope.SOAP.Context.service);
		SET OutputRoot.XMLNSC.data.operation = FIELDVALUE(InputLocalEnvironment.SOAP.Envelope.SOAP.Context.operation);
		SET OutputRoot.XMLNSC.data.service = FIELDVALUE(InputLocalEnvironment.SOAP.Envelope.SOAP.Context.service);
		SET OutputRoot.XMLNSC.data.namespace = FIELDVALUE(InputLocalEnvironment.SOAP.Envelope.SOAP.Context.portTypeNamespace);
		SET OutputRoot.XMLNSC.data.reqtimestamp = InputLocalEnvironment.request_timestamp;
		SET OutputRoot.XMLNSC.data.request_timestamp = InputLocalEnvironment.request_timestamp;
		SET OutputRoot.XMLNSC.data.request_id = InputLocalEnvironment.request_id;
		
		RETURN TRUE;
	END;

	CREATE PROCEDURE CopyMessageHeaders() BEGIN
		DECLARE I INTEGER 1;
		DECLARE J INTEGER;
		SET J = CARDINALITY(InputRoot.*[]);
		WHILE I < J DO
			SET OutputRoot.*[I] = InputRoot.*[I];
			SET I = I + 1;
		END WHILE;
	END;

	CREATE PROCEDURE CopyEntireMessage() BEGIN
		SET OutputRoot = InputRoot;
	END;
	
	CREATE PROCEDURE CopyEntireMessageToData() BEGIN
		SET OutputRoot.HTTPInputHeader = InputRoot.HTTPInputHeader;
		SET OutputRoot.XMLNSC.data = InputRoot.XMLNSC.*;
	END;
END MODULE;


CREATE COMPUTE MODULE SET_COREL_ID
	CREATE FUNCTION Main() RETURNS BOOLEAN
	BEGIN
		-- CALL CopyMessageHeaders();
		CALL CopyEntireMessage();
		SET OutputRoot.Properties.ReplyIdentifier = InputRoot.MQMD.MsgId;
		RETURN TRUE;
	END;

	CREATE PROCEDURE CopyMessageHeaders() BEGIN
		DECLARE I INTEGER 1;
		DECLARE J INTEGER;
		SET J = CARDINALITY(InputRoot.*[]);
		WHILE I < J DO
			SET OutputRoot.*[I] = InputRoot.*[I];
			SET I = I + 1;
		END WHILE;
	END;

	CREATE PROCEDURE CopyEntireMessage() BEGIN
		SET OutputRoot = InputRoot;
	END;
END MODULE;
