Verification using SOAP Response using external java class

LegacyForumLegacyForum Posts: 1,669 ✭✭
edited December 2016 in SOAtest

I have requirent where I have to use a SOAP Response parameter say id and use a external JAVA program which takes this id as a parameter and should return PASS or Fail if a SQL query passes using that id parameter .

Not getting exactly how to pass a soap reponse value to a external Java Program.
Standalone Java program is running fine .

Tried XML Assertor but not getting only the response and Java program is not getting invoked .

Can you guys help.
Thanks in advance



  • LegacyForumLegacyForum Posts: 1,669 ✭✭
    edited December 2016
    Hi Vishakha,

    I believe you could accomplish this in a number of ways depending on what you need to do with the "Pass" or "Fail" information returned from the External Java Program. For example:

    Step 1: Chain an XML Data Bank to your SOAP Response and store the "id" value you're interested in.

    Step 2: Use a DB Tool to make the SQL query that's being made by the External Java Tool currently using the "id" value you extracted from the XML.
    You can use an Extension Tool to obtain the stored "id" value, build the string value for the actual query and store the string query to a Test Suite variable using the context.setValue() method

    For example, a sample Jython Script to use in the Extension Tool might look like this:

    <begin code>

    from soaptest.api import *
    from com.parasoft.api import *

    # Gets a value from an XML data bank, builds a SQL Query string,
    # and stores the Query string in a Test Suite Variable.

    def buildSQLQuery(input, context):
    id = context.getValue("Generated Data Source", "<ID_VARIABLE_NAME>")
    queryStart = "<SQL_QUERY_STRING_BEFORE_ID>"
    queryEnd = "<SQL_QUERY_STRING_AFTER_ID>"
    query = queryStart + str(id) + querryEnd
    context.setValue("query", str(query));

    <end code>

    Now you can parameterize the DB Tool to use the Test Suite variable "query" as the SQL Query and if you want the DB Tool to fail when a SQL exception is thrown, set the "Fail on SQL exception" setting on the Options tab of the DB Tool.

    Please let me know if you have any additional questions.

    Thank you and regards,

Sign In or Register to comment.