Monday, 25 November 2013

Acessing Database using compute node with soap web services by takeing 'AGE as input giveing FNAME of that person as output

STEP1:CREATE NEW MESSAGE BROKER PROJECT.


STEP2:CREATE NEW MESSAGE FLOW.





STEP3:CREATE NEW MESSAGE DEFNITION .

Creation of message set definition need database information according to current scenario.here age and fname are columns of database.observe below figure carefully

Here AGE and FNAME are columns of table .accroding to scnerio AGE act as input and FNAME act as output based on this u created message defination.


NOTE:

1.BEFORE THIS YOU NEED TO CREATE DATA SOURCE AND YOU NEED TO CONFIGURE DATASOURCE WITH THE BROKER .

2.WHEN YOU ARE CREATING WSDL FILE--
'SELECT THE SOAP WEB SERVICE' in drop down.
'TICK THE XMLNSC PARSER'
because soap return object so its difficult to take input data even though input came it works only when we are copying Input as it is to Output.(SO TICK THE XMLNSC PARSER)


MESSAGE FLOW:

COMPUTE NODE FIGURE:



COMPUTE NODE CODE:

DECLARE ns NAMESPACE 'http://www.mir.net';


CREATE COMPUTE MODULE SOAP_COMPT_MSSG_FLOW_Compute
    CREATE FUNCTION Main() RETURNS BOOLEAN
    BEGIN
        -- CALL CopyMessageHeaders();
        -- CALL CopyEntireMessage();
       
        --DECLARE A INTEGER;
       
       
        --SET A=CAST(InputRoot.XMLNSC.ns:INPUT_AGEE.AGE AS INTEGER);
       
        --DECLARE B REFERENCE TO InputRoot.XMLNSC.ns:INPUT_AGEE;
SET OutputRoot.XMLNSC.ns:OUTPUT_FNAME.FNAME[]= PASSTHRU('SELECT FNAME FROM KING1 WHERE AGE = ?' TO Database.MBDB VALUES(CAST(InputRoot.XMLNSC.ns:INPUT_AGEE.AGE AS INTEGER)));

(OR)

SET A=CAST(InputRoot.XMLNSC.ns:INPUT_AGEE.AGE AS INTEGER);

SET OutputRoot.XMLNSC.ns:OUTPUT_FNAME.FNAME[]= PASSTHRU('SELECT FNAME FROM KING1 WHERE AGE = ?' TO Database.MBDB VALUES(A);

       
    --SET OutputRoot.XMLNSC.ns:OUTPUT_FNAME.FNAME= PASSTHRU('SELECT FNAME FROM KING1 WHERE AGE = 25');
       
        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;




No comments:

Post a Comment