Topic
  • 5 replies
  • Latest Post - ‏2014-06-11T11:37:27Z by HermannSW
abinya Balaji
abinya Balaji
86 Posts

Pinned topic How to log message which caused parser Exception

‏2014-05-05T11:18:05Z |

Hello All,

Is there a way in Datapower to store the message which caused parser exception?

Eg, An MPG is there, with Error Rule added. If an improperly formed XML is passed to this , error rule is getting invoked, and error message is getting formed.,

But not able to capture the original message which caused this exception. we face this issue in production and we want to have a proof that External party has sent a wrong message? Is there a way to capture that message.

 

 

  • HermannSW
    HermannSW
    4866 Posts

    Re: How to log message which caused parser Exception

    ‏2014-05-05T15:00:18Z  

    Hi,

    invalid XML does not even trigger rule execution, so no error rule can be used to log invalid input.

    Do you really need to log invalid XML, and if so, why?


    Hermann <myBlog/> <myTweets/> | <GraphvizFiddle/> | <xqib/> | <myCE/> <myFrameless/>

    Updated on 2014-05-05T15:00:29Z at 2014-05-05T15:00:29Z by HermannSW
  • abinya Balaji
    abinya Balaji
    86 Posts

    Re: How to log message which caused parser Exception

    ‏2014-05-23T05:56:02Z  
    • HermannSW
    • ‏2014-05-05T15:00:18Z

    Hi,

    invalid XML does not even trigger rule execution, so no error rule can be used to log invalid input.

    Do you really need to log invalid XML, and if so, why?


    Hermann <myBlog/> <myTweets/> | <GraphvizFiddle/> | <xqib/> | <myCE/> <myFrameless/>

    We are exposing services to our external clients, sometimes they send some Invalid or Incomplete XML, we want to log them and show that the reason for the failure is because of the input they sent? I am able to execute error rule in this and create a custom error message, but I am not able to log the incomplete XML.

  • HermannSW
    HermannSW
    4866 Posts

    Re: How to log message which caused parser Exception

    ‏2014-05-23T10:57:55Z  

    We are exposing services to our external clients, sometimes they send some Invalid or Incomplete XML, we want to log them and show that the reason for the failure is because of the input they sent? I am able to execute error rule in this and create a custom error message, but I am not able to log the incomplete XML.

    I was wrong, error rule does get triggered on incomlete markup.

     

    Why isn't returning the error message by
     

    <xsl:value-of select="dp:variable('var://service/error-message')"/>
    

     

    good enough? Will respond something like:

    <error-message>
    Incomplete markup or missing document element at offset 3 of http://dp2-l3:2054/err
    </error-message>

     

    Such failures should be found during testing of your clients against your test system.

    In that case you may use XML File Capture or Packet Capture to inspect the broken requests.


    Hermann <myBlog/> <myTweets/> | <GraphvizFiddle/> | <xqib/> | <myCE/> <myFrameless/>

     

  • abinya Balaji
    abinya Balaji
    86 Posts

    Re: How to log message which caused parser Exception

    ‏2014-06-11T05:36:43Z  
    • HermannSW
    • ‏2014-05-23T10:57:55Z

    I was wrong, error rule does get triggered on incomlete markup.

     

    Why isn't returning the error message by
     

    <pre class="javascript dw" data-editor-lang="js" data-pbcklang="javascript" dir="ltr"><xsl:value-of select="dp:variable('var://service/error-message')"/> </pre>

     

    good enough? Will respond something like:

    <error-message>
    Incomplete markup or missing document element at offset 3 of http://dp2-l3:2054/err
    </error-message>

     

    Such failures should be found during testing of your clients against your test system.

    In that case you may use XML File Capture or Packet Capture to inspect the broken requests.


    Hermann <myBlog/> <myTweets/> | <GraphvizFiddle/> | <xqib/> | <myCE/> <myFrameless/>

     

    Hi Hermann,

    As you have mentioned  I am able to get this message "Incomplete markup or missing document element at offset 3 of http://dp2-l3:2054/err
    " , But I am interested in capturing the XML, In our scenario, we use an MPG as a gateway, and different third parties send us input, in some rare cases we get invalid XML or incomplete XML , So that time we want to log the XML. IS that by anyway possible?

     

  • HermannSW
    HermannSW
    4866 Posts

    Re: How to log message which caused parser Exception

    ‏2014-06-11T11:37:27Z  

    Hi Hermann,

    As you have mentioned  I am able to get this message "Incomplete markup or missing document element at offset 3 of http://dp2-l3:2054/err
    " , But I am interested in capturing the XML, In our scenario, we use an MPG as a gateway, and different third parties send us input, in some rare cases we get invalid XML or incomplete XML , So that time we want to log the XML. IS that by anyway possible?

     

    > So that time we want to log the XML. IS that by anyway possible?
    >
    Not in a XML or SOAP request type service.

    Only option would be to chain your traffic through a Non-XML request&reponse type MPGW first with your real MPGW as its backend. Then you need to craf t a special response on the real MPGW. On the 1st MPGW you would store Non-XML inpt into a contex variable, and response rule would access that variable and log in case 2nd MPGW would flag to do so. Be aware that this has runtime/latency/memory implications and you may only enable this to track down issues but would disable the additional processing on default.


    Hermann <myBlog/> <myTweets/> | <GraphvizFiddle/> | <xqib/> | <myCE/> <myFrameless/>