Author: tcunning Date: Wed Jun 16 14:44:44 2010 New Revision: 955243 URL: http://svn.apache.org/viewvc?rev=955243&view=rev Log: SCOUT-99 Put the fault handling code before the unmarshalling code in RegistryImpl so that if both a fault and an unmarshalling error occurs, we get the base fault.
Modified: webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/RegistryImpl.java Modified: webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/RegistryImpl.java URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/RegistryImpl.java?rev=955243&r1=955242&r2=955243&view=diff ============================================================================== --- webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/RegistryImpl.java (original) +++ webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/RegistryImpl.java Wed Jun 16 14:44:44 2010 @@ -327,32 +327,8 @@ public class RegistryImpl implements IRe if (responseName == null) { throw new RegistryException("Unsupported response " + "from registry. A value was not present."); - } + } - // Let's now try to determine which UDDI response - // we received and unmarshal it appropriately or - // throw a RegistryException if it's unknown. - // Well, we have now determined that something was - // returned and it is "a something" that we know - // about so let's unmarshal it into a RegistryObject - // Next, let's make sure we didn't recieve a SOAP - // Fault. If it is a SOAP Fault then throw it - // immediately. - - JAXBElement<?> uddiResponse = null; - try { - String xml = XMLUtils.convertNodeToXMLString(response); - log.debug("Response is: " + xml); - - StringReader reader = new StringReader(xml); - uddiResponse = (JAXBElement<?>) unmarshaller.unmarshal(new StreamSource(reader)); - //It is probably faster not to go to a String, but JAXB has issues with this - //uddiResponse = (JAXBElement<?>) unmarshaller.unmarshal(response); - - } catch (JAXBException xmle) { - throw (new RegistryException(xmle)); - } - if (responseName.toLowerCase().equals("fault")) { NodeList nodeList = null; @@ -395,6 +371,30 @@ public class RegistryImpl implements IRe // Create RegistryException instance and return throw e; } + + // Let's now try to determine which UDDI response + // we received and unmarshal it appropriately or + // throw a RegistryException if it's unknown. + // Well, we have now determined that something was + // returned and it is "a something" that we know + // about so let's unmarshal it into a RegistryObject + // Next, let's make sure we didn't recieve a SOAP + // Fault. If it is a SOAP Fault then throw it + // immediately. + + JAXBElement<?> uddiResponse = null; + try { + String xml = XMLUtils.convertNodeToXMLString(response); + log.debug("Response is: " + xml); + + StringReader reader = new StringReader(xml); + uddiResponse = (JAXBElement<?>) unmarshaller.unmarshal(new StreamSource(reader)); + //It is probably faster not to go to a String, but JAXB has issues with this + //uddiResponse = (JAXBElement<?>) unmarshaller.unmarshal(response); + + } catch (JAXBException xmle) { + throw (new RegistryException(xmle)); + } return uddiResponse; } --------------------------------------------------------------------- To unsubscribe, e-mail: scout-dev-unsubscr...@ws.apache.org For additional commands, e-mail: scout-dev-h...@ws.apache.org