Skip to Content
avatar image
Former Member

Capturing field value from Web Service and passing to SQL Transformation

Hi All,

I'm working on the following scenario in Data Services (v4.2).

Web Service (Request) -> DS (expose RT job as service) -> SQL Query -> Response to Web Service

Web service is sending single field - like Vendor #. Now, the issue is that I need to capture this field and pass this to the SQL Transformation.

The hard-requirement is that I need to use specific SQL Query to get the values (it is nested actually). So, I need to find a way to capture the input field from Web Service and pass this to the SQL Transform query.

I believe there are two ways of doing it:

1. Using the script to declare a Global Variable

2. Using custom function to capture input field and assign it to GV

Unfortunately, I've not been able to get this to work. Need help to fix this issue.

Regards,

Guru

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Nov 18, 2016 at 09:27 AM

    You would split your data flow into several steps (understand that RT jobs are not limited to a single Dataflow)

    1. A data flow to read the message and output the value to a temporary file or a table

    2. A script to read the value from the file/table into a variable

    3. A data flow with an SQL query using a parameter which is passed from the variable.

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 28, 2016 at 07:35 PM

    If I understand correct you send a web service request that contains a field like vendor # to a RT service.

    The RT service has a RT job running in background that can retrieve and consume that field and return response back.

    Where is sql query - are you referring to query transform \ SQL transform and is it in that RT job? When RT service receives the request, it receives the input field that you can unnest and retrieve its value from input request inside the job. Post your dataflow.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 02, 2016 at 08:54 AM

    Hi Aasavari,

    Here are some answers to your queries:

    - You're right. RT service is going to be consumed by an external entity, which will post a Vendor# in the form of XML message

    - RT service has a RT job running in the background, which will take that Vendor# and return the response back

    - The core of RT job lies in querying an Oracle DB to fetch some payment related details based on the Vendor# received from the RT service

    - I am using the SQL transformation step in my data flow to execute the SQL query (nested query) on the Oracle DB (which I have already added as a datastore)

    - If I hard-code the Vendor# in my SQL query, I am getting the detailed response back in the RT service

    - The help required is to pass the Vendor# dynamically to the SQL query, captured during the RT service consumption by external entity

    Here are the details of the RT Job/DataFlow:

    Regards,

    Guru

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 01, 2016 at 06:50 AM

    Thanks Andrey.

    One follow-up question: Is it possible to read the value from the XML input (when consumer is passing the XML field to invoke the service) into variable directly, without having to temporarily store it in a file/table. This will avoid the issue of correlations when multiple files are passed at the same time.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Unfortunately, you cannot output a variable value from a dataflow directly.

      However, remember that in order to pass multiple input messages at the same time you would have to configure multiple service instances in your RT service, as each instance will process messages sequentially. So to avoid correlation issues you just assign unique file names (or row ids) per each job instance so that they are not shared. Or you can use Memory datastore which is also not shared between job instances.