Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Conditional Check for Incoming Request and Custom Response

Is it possible to set up a responder to respond multiple ways based on the incoming request format?

Example: A SOAP based request sent yields type "A" response, and a REST based request yields type "B" response. The response is from the same responder

If this is possible, can it be detailed as to how to do this?

Comments

  • OmarR
    OmarR Posts: 233 admin

    Hello,
    Is there a particular reason why you need the response to be from the same responder?

    It will be easier and much cleaner to have two responders: SOAP Responder and JSON Responder.
    You can configure the SOAP Responder to have correlation based on a transport header or an XML field. You could do the same with the JSON Responder and have its correlation based on a different transport header or JSON field.
    Example:

  • VirtEyes
    VirtEyes Posts: 62

    Thank you Omar,

    We are trying to recreate something similar we have in another tool. We want to have some sort of logic where the user can detect what is the format of the incoming request, and based on that will send a SOAP or REST based response, both of which could be very similar but just in two different formats.

    You are saying that we can just set it to where the Responder Correlation detects if a particular header (such as text/xml or application/json) is detected, and based off that, it then will hit the appropriate responder?

  • OmarR
    OmarR Posts: 233 admin

    You are saying that we can just set it to where the Responder Correlation detects if a particular header (such as text/xml or application/json) is detected, and based off that, it then will hit the appropriate responder?

    Yes, exactly. Give it a shot and let us know if you have any questions.