bearded_devil
bearded_devil

Reputation: 262

DataPower MPG: Responding with a custom message for schema validation error avoiding backend Server?

I have a working solution for the requirement as stated below. However, I am NOT convinced that it is cleanly implemented. There are a lot of configuration options in DataPower that I am fuzzy on and though the response comes back, I am not confident about it. Can I get some help on how this should be implemented to avoid any quirky behavior.

Requirement When a SOAP client sends a request that fails schema validation rule in the inbound client->server policy (before going to backend server), our system needs to respond with custom SOAP Fault message and skip backside processing.

Current Solution

My MPG has the following rule configuration:

enter image description here

Client to Server. . .

matches all->sets on-error to call error rule->Validation Action-> . . .

Error rule . . .

matches validation error->sets skip-backside to true->transformation building custom SOAPFault message->results action->sets Content Type header

Any help on this or suggestions for a better way to do this would be helpful. I would like to do the schema validation inside the MPG and not a separate WS Firewall.

Upvotes: 0

Views: 1705

Answers (3)

toy
toy

Reputation: 1

<xsl:variable name="error" select="dp:variable('var://context/scratch/Response')"/> //invoke to another file as a working backend failed

    <error_message>
            <code><xsl:value-of select="$error/result/responsecode"/></code>
            //this type you can configure other responses
    </error_message>

Upvotes: 0

Anders
Anders

Reputation: 3412

Just add a validation action for the XSD in the MPGW Processing Policy. You don't need the skip-backside or on-error actions. Backside will be skipped on Request error and Error rule will always be triggered anyway. Apart from that your solution is solid.

Upvotes: 1

Joe
Joe

Reputation: 48

Once error rule is triggered it will not go for backend. I think Skip backend is not required.

match function-->transformation action with custom message---> Results action

Upvotes: 1

Related Questions