extracting multiple XPath that uses the same variable name

 

Hope this makes sense, thanks for any help in advance!

Solved Solved
1 4 315
1 ACCEPTED SOLUTION

From your explanation, this is what I understand

  1. you are using a RaiseFault step to populate a message into the error variable, and to put the flow into fault state
  2. within a faultrule, you are using ExtractVariables to extract values from.... the request variable
  3. you're observing that your proxy configuration is not working as you expect. The extratvariables is not getting the data.

one thing I am not clear on. You wrote

But currently for my RF I can see the request being populated correctly, ...

Let's just clarify: RaiseFault does not populate the request variable. It populates the error variable. It does not modify or affect the request variable. You can see err.status.code in the Apigee trace. That is a part of the error message.

After that clarification, I have one doubt. You say:

it captures the request that I want the source to get later for extracting some values.

So are you intending to use ExtractVariables on the message that gets populated by RaiseFault? In that case I believe you need to use <Source>error</Source> in your EV policy. You have <Source>request</Source>, which will hold the request as it was received from the client.

One more thing. You may already know this but it bears repeating: ensure that your content-type is correct. If you insert into the Payload of a message, some text that looks like XML, but you do not set the content-type header, then ExtractVariables may do nothing. If you are using XMLPayload within ExtractVariables, the first thing the policy execution does is look for the content-type header. If it is not an XML content type (like application/xml or text/xml) then ExtractVariables will do nothing further.

View solution in original post

4 REPLIES 4

From your explanation, this is what I understand

  1. you are using a RaiseFault step to populate a message into the error variable, and to put the flow into fault state
  2. within a faultrule, you are using ExtractVariables to extract values from.... the request variable
  3. you're observing that your proxy configuration is not working as you expect. The extratvariables is not getting the data.

one thing I am not clear on. You wrote

But currently for my RF I can see the request being populated correctly, ...

Let's just clarify: RaiseFault does not populate the request variable. It populates the error variable. It does not modify or affect the request variable. You can see err.status.code in the Apigee trace. That is a part of the error message.

After that clarification, I have one doubt. You say:

it captures the request that I want the source to get later for extracting some values.

So are you intending to use ExtractVariables on the message that gets populated by RaiseFault? In that case I believe you need to use <Source>error</Source> in your EV policy. You have <Source>request</Source>, which will hold the request as it was received from the client.

One more thing. You may already know this but it bears repeating: ensure that your content-type is correct. If you insert into the Payload of a message, some text that looks like XML, but you do not set the content-type header, then ExtractVariables may do nothing. If you are using XMLPayload within ExtractVariables, the first thing the policy execution does is look for the content-type header. If it is not an XML content type (like application/xml or text/xml) then ExtractVariables will do nothing further.

Hi! thanks for your fast response, I appreciate it. And thanks for providing that information with Regards the RaiseFault, I am now able to get the information from the error source, and use the variable for the final structure of the response, however, there's one thing I'm currently having problem -- as to why it doesn't populate the correct description and summary for the corresponding error status code. 

 

 

Hi! thanks for your fast response, I appreciate it.

Hi, I'm glad my assistance and suggestions are helpful. Glad to help you out.

The problem here is that, the description and summary for errors 415 and 406 uses the resourceNotFoundDescription and resourceNotFoundSummary that was retrieved from a KVM, when in fact, it should use the one I set.

I'm sorry, but...I do not understand the problem you're describing, there's a KVM and different status codes and JavaScript code and... ???  I'm not clear on any of that.  and also... I'm confident that you can sort through this one. You know your code best.

Good luck!

Thanks! @dchiesa1 appreciate your help always. 😁

And to answer my question above, it was definitely how I structure the condition, since upon checking today it now works!