Skip to main content
gokul1242
Inspiring
Oct 30, 2013 5:27 PM UTC
Answered

Handle mulitple exceptions from xml in Coldfusion

Hi All

How to handle the multiple exceptions in the SOAP Response block as shown below

currently i can the handle the description of the first exception by

['soapenv:Envelope']['soapEnv:Body']['maintainUserResponse']['exception']['description']['XmlText']

How to access both the exception description in the same manner ??

This topic is closed to new replies. Start a new post to keep the conversation going.
Upen1
Upen1Correct answer
Inspiring
Nov 1, 2013 4:22 PM UTC

@gokul,

If you dump ['soapenv:Envelope']['soapEnv:Body']['maintainUserResponse']['exception'] . You will find an array object. So simply looping over the array object you can get your attribute values.

Example:

['soapenv:Envelope']['soapEnv:Body']['maintainUserResponse']['exception'][1]

['soapenv:Envelope']['soapEnv:Body']['maintainUserResponse']['exception'][2]

Will give you first and second exception object.

2 replies

Upen1
Upen1Correct answer
Inspiring
Nov 1, 2013 4:22 PM UTC

@gokul,

If you dump ['soapenv:Envelope']['soapEnv:Body']['maintainUserResponse']['exception'] . You will find an array object. So simply looping over the array object you can get your attribute values.

Example:

['soapenv:Envelope']['soapEnv:Body']['maintainUserResponse']['exception'][1]

['soapenv:Envelope']['soapEnv:Body']['maintainUserResponse']['exception'][2]

Will give you first and second exception object.

Translate
Legend
Oct 31, 2013 10:45 AM UTC

You should be able to loop through the structure when using XMLSearch() to access the parent object, only processing the "exception" items. Can you post the entire XML fragment?

Translate