AnsweredAssumed Answered

Throwing Exception modifies return documents response

Question asked by bbajwa802798 on Oct 23, 2017
Latest reply on Nov 1, 2017 by trey.yeager826393

When I send my Web Service down the Catch Branch of a Try Catch shape, I want to be able to return a custom response to the caller using Return Documents and then throw an exception after using an Exception Shape.

 

The process looks as such:

 

However, the Exception is causing the Document being returned to the caller to be surrounded in HTML tags instead of the JSON that I am using in Return Documents:

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>

<title>Error 500 Process terminating -- some documents reached an exception which is set to halt all documents: {

  "InternalId" : "1176-21645-1-35898868-37031479",

  "ExtendedMessages" : [

    "&lt;?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?&gt;&lt;Result&gt;&lt;id/&gt;&lt;success&gt;false&lt;/success&gt;&lt;errors&gt;&lt;error&gt;&lt;statusCode&gt;DUP_RCRD&lt;/statusCode&gt;&lt;message&gt;This record already exists&lt;/message&gt;&lt;type&gt;ERROR&lt;/type&gt;&lt;/error&gt;&lt;/errors&gt;&lt;/Result&gt;\n"

  ]

}

</title>

</head>

<body><h2>HTTP ERROR 500</h2>

<p>Problem accessing /ws/rest/development/cashSale/. Reason:

<pre>    Process terminating -- some documents reached an exception which is set to halt all documents: {

  "InternalId" : "1176-21645-1-35898868-37031479",

  "ExtendedMessages" : [

    "&lt;?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?&gt;&lt;Result&gt;&lt;id/&gt;&lt;success&gt;false&lt;/success&gt;&lt;errors&gt;&lt;error&gt;&lt;statusCode&gt;DUP_RCRD&lt;/statusCode&gt;&lt;message&gt;This record already exists&lt;/message&gt;&lt;type&gt;ERROR&lt;/type&gt;&lt;/error&gt;&lt;/errors&gt;&lt;/Result&gt;\n"

  ]

}

</pre></p>

</body>

</html>

 

If I remove the exception shape, it returns back in the valid JSON format of:

{    "InternalId" : "1176-21645-1-35898868-37031479",    "ExtendedMessages" : [      "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><Result><id/><success>false</success><errors><error><statusCode>DUP_RCRD</statusCode><message>This record already exists</message><type>ERROR</type></error></errors></Result>\n"    ]  }

 

Any ideas why?

Outcomes