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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:216994
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