{ Community }
  • Academy
  • Docs
  • Developers
  • Resources
    • Community Articles
    • Apigee on GitHub
    • Code Samples
    • Videos & eBooks
    • Accelerator Methodology
  • Support
  • Ask a Question
  • Spaces
    • Product Announcements
    • General
    • Edge/API Management
    • Developer Portal (Drupal-based)
    • Developer Portal (Integrated)
    • API Design
    • APIM on Istio
    • Extensions
    • Business of APIs
    • Academy/Certification
    • Analytics
    • Events
    • Hybrid
    • Integration (AWS, PCF, Etc.)
    • Microgateway
    • Monetization
    • Private Cloud Deployment
    • Insights
    • IoT Apigee Link
    • BaaS/Usergrid
    • BaaS Transition/Migration
    • Apigee-127
    • New Customers
    • Topics
    • Questions
    • Articles
    • Ideas
    • Leaderboard
    • Badges
  • Log in
  • Sign up

Get answers, ideas, and support from the Apigee Community

  • Home /
  • Edge/API Management /
avatar image
1
Question by Rick Decker · May 24, 2018 at 04:38 PM · 38 Views raise fault

XSL Transformation in Raise Fault

Is there anyway possible to use a XSL Transformation step within a RaiseFault policy. If so is there any documentation on how this can be handled.

Comment
Add comment
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Close

1 Answer

  • Sort: 
avatar image
0

Answer by Dino-at-Google   · May 24, 2018 at 11:26 PM

Nope.

In Apigee Edge, XSL and RaiseFault are two distinct policies.

If you want to Raise a fault, then ... (surprise!) use the RaiseFault policy.

If you want to transform some XML, then use the XSL policy.

In the case that you want to Raise a Fault and transmit some XML there, and that XML needs to be the result of a transform of some OTHER XML. . . . . then what I would do is use the same condition to wrap the XSL, and then the Raise Fault.

Let's look at an example. Suppose your design calls for raising a fault explicitly, if the value of a specific query parameter does not match a specific regular expression pattern. Suppose the pattern is AMG-XXXXX , where the XXXXX is replaced with decimal digits. Not everyone speaks Regular Expressions, so I'll just say: the regex for that pattern is

^AMG-[0-9]{5}$

A condition checking for a match of that is:

request.queryparam.id ~~ "^AMG-[0-9]{5}$"

But we want to raise a fault when that match is NOT found. So we need to negate that condition. Therefore the steps and conditions might look like this:

  <Step>
    <Condition>NOT (request.queryparam.id ~~ "^AMG-[0-9]{5}$")</Condition>
    <Name>XSL-TransformMyXml</Name> 
  </Step>
  <Step> 
    <Condition>NOT (request.queryparam.id ~~ "^AMG-[0-9]{5}$")</Condition>
    <Name>RaiseFault-InvalidValue</Name> 
  </Step>

And presumably the RaiseFault-InvalidValue will reference the output of the XSL step.

Maybe like this:

<RaiseFault name='RaiseFault-InvalidValue'>
  <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
  <FaultResponse>
    <Set>
      <Payload contentType='application/xml'>{xml_document}</Payload>
      <StatusCode>400</StatusCode>
      <ReasonPhrase>Bad Request</ReasonPhrase>
    </Set>
  </FaultResponse>
</RaiseFault>

Does this make sense?

Comment
Add comment · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Follow this Question

Answers Answers and Comments

59 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

What is the value flow variable fault.name when error is explicitly generated by Raisefault policy? I see it every time as RaiseFault. 4 Answers

When client views an internal error message in a prod project. What is the first thing that you are going to do? 1 Answer

How to intimate error occurred without using the raise fault policy? 3 Answers

Raise Fault copy function does not work anymore 1 Answer

  • Products
    • Edge - APIs
    • Insights - Big Data
    • Plans
  • Developers
    • Overview
    • Documentation
  • Resources
    • Overview
    • Blog
    • Apigee Institute
    • Academy
    • Documentation
  • Company
    • Overview
    • Press
    • Customers
    • Partners
    • Team
    • Events
    • Careers
    • Contact Us
  • Support
    • Support Overview
    • Documentation
    • Status
    • Edge Support Portal
    • Privacy Policy
    • Terms & Conditions
© 2019 Apigee Corp. All rights reserved. - Apigee Community Terms of Use - Powered by AnswerHub
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Create an article
  • Post an idea
  • Spaces
  • Product Announcements
  • General
  • Edge/API Management
  • Developer Portal (Drupal-based)
  • Developer Portal (Integrated)
  • API Design
  • APIM on Istio
  • Extensions
  • Business of APIs
  • Academy/Certification
  • Analytics
  • Events
  • Hybrid
  • Integration (AWS, PCF, Etc.)
  • Microgateway
  • Monetization
  • Private Cloud Deployment
  • Insights
  • IoT Apigee Link
  • BaaS/Usergrid
  • BaaS Transition/Migration
  • Apigee-127
  • New Customers
  • Explore
  • Topics
  • Questions
  • Articles
  • Ideas
  • Members
  • Badges