Yup, catch needs to be the last thing here as well. Also the catch type is "Any" instead of "All"
Glad you got it going. -----Original Message----- From: Kevin Bridges [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 31, 2005 11:11 AM To: CF-Talk Subject: Re: Error Trapping for Webservice Ha ... that got it. I'll make sure and place those return lines where they are supposed to be! Thanks Bobby Hartsfield wrote: >Control enter is a killer... lets try that again... > > ><cfscript> >function authenticate( url, username, password ) >{ > returnDoc = ''; > > try > { > service = createObject( "webservice", >"http://example.com/example.asmx?WSDL" ); > xmlDoc = XmlParse( service.authenticate( url, username, >password) ); > selectedElements = XmlSearch(xmlDoc, >"/RequestContext/Messages/Message/"); > for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1) > { > if( selectedElements[i].MessageCode.XmlText EQ >'Sec_AuthFailed' ) > { > writeoutput(selectedElements[i].MessageCode.XmlText >& "<br>"); > } > } > returnDoc >=XmlParse(xmlDoc.RequestContext.ResponseDocument.xmlText); > return returnDoc; > } > catch("Any" except) > { > writeoutput('<h1>Connection Failure</h1>'); > } >} ></cfscript> > >-----Original Message----- >From: Kevin Bridges [mailto:[EMAIL PROTECTED] >Sent: Wednesday, August 31, 2005 9:55 AM >To: CF-Talk >Subject: Error Trapping for Webservice > >Hi ... I'm writing a function that calls a webservice. I have the calls >to the webservice contained in a try catch block and do not understand >why I am seeing an error message. > >function authenticate( url, username, password ) { > returnDoc = ''; > try { > service = createObject( "webservice", >"http://example.com/example.asmx?WSDL" ); > xmlDoc = XmlParse( service.authenticate( url, username, password >) ); > selectedElements = XmlSearch(xmlDoc, >"/RequestContext/Messages/Message/"); > for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1) { > if( selectedElements[i].MessageCode.XmlText EQ >'Sec_AuthFailed' ) { > writeoutput(selectedElements[i].MessageCode.XmlText & >"<br>"); > } > } > returnDoc = >XmlParse(xmlDoc.RequestContext.ResponseDocument.xmlText); > } catch("All" exception) { > writeoutput('<h1>Connection Failure</h1>'); > } > > return returnDoc; >} > >The error displayed is a standard "Error Occured While Processing >Request" instead of printing Connection Failure like I would expect. >What am I doing wrong? > >Thanks! > >Kevin Bridges > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:216998 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

