From 6ef3a489ca517939794415e21258e91a7b7c7239 Mon Sep 17 00:00:00 2001 From: nash Date: Mon, 27 Sep 2010 12:03:37 +0000 Subject: TUSCANY-3690: Improve eror handling and fix problems with local WSDL git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1001690 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/java/bigbank/AccountServiceImpl.java | 14 +++++- .../src/main/resources/BigBank.composite | 3 +- .../src/main/resources/wsdl/StockQuotes.wsdl | 57 +++++++++++++++++----- 3 files changed, 59 insertions(+), 15 deletions(-) (limited to 'sca-java-1.x/branches/sca-java-1.6.1/demos/xml-bigbank') diff --git a/sca-java-1.x/branches/sca-java-1.6.1/demos/xml-bigbank/src/main/java/bigbank/AccountServiceImpl.java b/sca-java-1.x/branches/sca-java-1.6.1/demos/xml-bigbank/src/main/java/bigbank/AccountServiceImpl.java index 46995de393..c2d0e8ab01 100644 --- a/sca-java-1.x/branches/sca-java-1.6.1/demos/xml-bigbank/src/main/java/bigbank/AccountServiceImpl.java +++ b/sca-java-1.x/branches/sca-java-1.6.1/demos/xml-bigbank/src/main/java/bigbank/AccountServiceImpl.java @@ -78,7 +78,17 @@ public class AccountServiceImpl implements AccountService { try { OMElement quotes = stockQuote.GetQuote(request); xml = quotes.getText(); + if (!xml.startsWith("<")) { + System.out.println("Server responded: " + xml); + throw new IllegalStateException("Unexpected response from server"); + } } catch (Exception e) { + if (e.getMessage().contains("Transport error: 503")) { + // server is down, use local historical data + } else { + // report any other errors + throw e; + } // restore the previous logging setting } finally { @@ -87,8 +97,8 @@ public class AccountServiceImpl implements AccountService { // if the web service invocation was successful, process the response XMLStreamReader qts = null; - if (xml != null && xml.startsWith("<")) { - System.out.println(xml); + if (xml != null) { + System.out.println("Server responded: " + xml); qts = factory.createXMLStreamReader(new StringReader(xml)); // if the web service isn't responding, continue with the demo using historical data diff --git a/sca-java-1.x/branches/sca-java-1.6.1/demos/xml-bigbank/src/main/resources/BigBank.composite b/sca-java-1.x/branches/sca-java-1.6.1/demos/xml-bigbank/src/main/resources/BigBank.composite index 18f848fdcb..8afde4bf80 100644 --- a/sca-java-1.x/branches/sca-java-1.6.1/demos/xml-bigbank/src/main/resources/BigBank.composite +++ b/sca-java-1.x/branches/sca-java-1.6.1/demos/xml-bigbank/src/main/resources/BigBank.composite @@ -45,8 +45,7 @@ - - + diff --git a/sca-java-1.x/branches/sca-java-1.6.1/demos/xml-bigbank/src/main/resources/wsdl/StockQuotes.wsdl b/sca-java-1.x/branches/sca-java-1.6.1/demos/xml-bigbank/src/main/resources/wsdl/StockQuotes.wsdl index 26000e4480..7af2b6793b 100644 --- a/sca-java-1.x/branches/sca-java-1.6.1/demos/xml-bigbank/src/main/resources/wsdl/StockQuotes.wsdl +++ b/sca-java-1.x/branches/sca-java-1.6.1/demos/xml-bigbank/src/main/resources/wsdl/StockQuotes.wsdl @@ -1,31 +1,66 @@ - - + + + + + + + + + - - + - + - + - + @@ -45,8 +80,8 @@ - - + + -- cgit v1.2.3