axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ngalla...@apache.org
Subject svn commit: r471998 - in /webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller: ./ impl/
Date Tue, 07 Nov 2006 06:00:51 GMT
Author: ngallardo
Date: Mon Nov  6 22:00:51 2006
New Revision: 471998

URL: http://svn.apache.org/viewvc?view=rev&rev=471998
Log:
AXIS2-1603

Starting the cleanup of the MethodMarshaller APIs.  Changing the APIs to only throw either 
MarhsalException or UnmarshalException depending on which flow it's in, rather than throwing
seven different types of exceptions.

Added:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/MarshalException.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/UnmarshalException.java
Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/MethodMarshaller.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/DocLitBareMethodMarshallerImpl.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/DocLitWrappedMethodMarshallerImpl.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/MethodMarshallerImpl.java

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/MarshalException.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/MarshalException.java?view=auto&rev=471998
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/MarshalException.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/MarshalException.java Mon Nov  6 22:00:51 2006
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *      
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.marshaller;
+
+public class MarshalException extends Exception {
+    
+    public MarshalException(String message) {
+        super(message);
+    }
+    
+    public MarshalException(Throwable t) {
+        super(t);
+    }
+    
+    public MarshalException(String message, Throwable t) {
+        super(message, t);
+    }
+}

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/MethodMarshaller.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/MethodMarshaller.java?view=diff&rev=471998&r1=471997&r2=471998
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/MethodMarshaller.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/MethodMarshaller.java Mon Nov  6 22:00:51 2006
@@ -1,34 +1,29 @@
 /*
- * Copyright 2004,2005 The Apache Software Foundation.
- * Copyright 2006 International Business Machines Corp.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
  *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ *      
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
  */
 package org.apache.axis2.jaxws.marshaller;
 
-import java.lang.reflect.InvocationTargetException;
-
-import javax.xml.bind.JAXBException;
-import javax.xml.stream.XMLStreamException;
-
 import org.apache.axis2.jaxws.message.Message;
-import org.apache.axis2.jaxws.message.MessageException;
-import org.apache.axis2.jaxws.wrapper.impl.JAXBWrapperException;
-/*
+
+/**
  * This is a helper class that converts org.apache.axis2.jaxws.message.Message to java Objects
  * or JAXBObject. It also converts java objects or JAXBObject to org.apache.axis2.jaxws.message.Message.
  */
-
 public interface MethodMarshaller {
 	
 	/**
@@ -47,7 +42,7 @@
 	 * @param object
 	 * @return
 	 */
-	public Message marshalRequest(Object[] object) throws IllegalAccessException, InstantiationException, ClassNotFoundException, JAXBWrapperException, JAXBException, MessageException, javax.xml.stream.XMLStreamException;
+	public Message marshalRequest(Object[] object) throws MarshalException; 
 	
 	/**
 	 * This method creates Message from a returnObject and input parameters of holder type. This is a case where we have method with return
@@ -55,7 +50,7 @@
 	 * @param jaxbObject
 	 * @return
 	 */
-	public Message marshalResponse(Object returnObject, Object[] holderObjects)throws ClassNotFoundException, JAXBException, MessageException, JAXBWrapperException, XMLStreamException, InstantiationException, IllegalAccessException;
+	public Message marshalResponse(Object returnObject, Object[] holderObjects)throws MarshalException;
 	
 	/**
 	 * This method creates Fault Message from a Throbale input parameter. 
@@ -63,14 +58,14 @@
 	 * @param jaxbObject
 	 * @return
 	 */
-	public Message marshalFaultResponse(Throwable throwable) throws IllegalAccessException, InvocationTargetException, JAXBException, ClassNotFoundException, NoSuchMethodException, MessageException, XMLStreamException;
+	public Message marshalFaultResponse(Throwable throwable) throws MarshalException;
 	/**
 	 * This method converts Message to java objects. Used on Server Side to this extract method input parameters from message and invokes method on service
 	 * with found input parameters on ServiceEndpoint.
 	 * @param message
 	 * @return
 	 */
-	public Object[] demarshalRequest(Message message)throws ClassNotFoundException, JAXBException, MessageException, JAXBWrapperException, XMLStreamException, InstantiationException, IllegalAccessException;
+	public Object[] demarshalRequest(Message message)throws UnmarshalException;
 	
 	/**
 	 * This method converts Message to Object. Used on Client side when converting response message from Server to ResponseWrapper/return type of method that
@@ -88,13 +83,14 @@
 	 * @param message
 	 * @return
 	 */
-	public Object demarshalResponse(Message message, Object[] inputArgs) throws IllegalAccessException, InstantiationException, InvocationTargetException, ClassNotFoundException, JAXBWrapperException, JAXBException, XMLStreamException, MessageException;
-	/**
+	public Object demarshalResponse(Message message, Object[] inputArgs) throws UnmarshalException;
+	
+    /**
 	 * This method converts Fault Message to fault java objects. Used on Client Side to extract Fault Object expected by client from message.
 	 * @param message
 	 * @return
 	 */
-	public Object demarshalFaultResponse(Message message);
+	public Object demarshalFaultResponse(Message message) throws UnmarshalException;
 	
 	
 }

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/UnmarshalException.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/UnmarshalException.java?view=auto&rev=471998
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/UnmarshalException.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/UnmarshalException.java Mon Nov  6 22:00:51 2006
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *      
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.marshaller;
+
+public class UnmarshalException extends Exception {
+
+    public UnmarshalException(String message) {
+        super(message);
+    }
+    
+    public UnmarshalException(Throwable t) {
+        super(t);
+    }
+    
+    public UnmarshalException(String message, Throwable t) {
+        super(message, t);
+    }
+}

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/DocLitBareMethodMarshallerImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/DocLitBareMethodMarshallerImpl.java?view=diff&rev=471998&r1=471997&r2=471998
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/DocLitBareMethodMarshallerImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/DocLitBareMethodMarshallerImpl.java Mon Nov  6 22:00:51 2006
@@ -1,28 +1,27 @@
 /*
- * Copyright 2004,2005 The Apache Software Foundation.
- * Copyright 2006 International Business Machines Corp.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
  *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ *      
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
  */
 package org.apache.axis2.jaxws.marshaller.impl;
 
 import java.util.ArrayList;
 
-import javax.naming.OperationNotSupportedException;
-import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBException;
 import javax.xml.stream.XMLStreamException;
-import javax.xml.ws.Holder;
 
 import org.apache.axis2.jaxws.ExceptionFactory;
 import org.apache.axis2.jaxws.description.EndpointDescription;
@@ -31,19 +30,21 @@
 import org.apache.axis2.jaxws.description.ServiceDescription;
 import org.apache.axis2.jaxws.i18n.Messages;
 import org.apache.axis2.jaxws.marshaller.DocLitBareMethodMarshaller;
+import org.apache.axis2.jaxws.marshaller.MarshalException;
 import org.apache.axis2.jaxws.marshaller.MethodParameter;
+import org.apache.axis2.jaxws.marshaller.UnmarshalException;
 import org.apache.axis2.jaxws.message.Message;
 import org.apache.axis2.jaxws.message.MessageException;
 import org.apache.axis2.jaxws.message.Protocol;
-import org.apache.axis2.jaxws.wrapper.impl.JAXBWrapperException;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-public class DocLitBareMethodMarshallerImpl extends MethodMarshallerImpl
-		implements DocLitBareMethodMarshaller {
+public class DocLitBareMethodMarshallerImpl extends MethodMarshallerImpl implements DocLitBareMethodMarshaller {
+    
 	private static int SIZE = 1;
 	private static Log log = LogFactory.getLog(DocLitBareMethodMarshallerImpl.class);
-	/**
+	
+    /**
 	 * @param serviceDesc
 	 * @param endpointDesc
 	 * @param operationDesc
@@ -51,72 +52,104 @@
 	public DocLitBareMethodMarshallerImpl(ServiceDescription serviceDesc,
 			EndpointDescription endpointDesc, OperationDescription operationDesc, Protocol protocol) {
 		super(serviceDesc, endpointDesc, operationDesc, protocol);
-		// TODO Auto-generated constructor stub
 	}
 
 	/* (non-Javadoc)
 	 * @see org.apache.axis2.jaxws.convertor.impl.MessageConvertorImpl#toJAXBObject(org.apache.axis2.jaxws.message.Message)
 	 */
 	@Override
-	public Object demarshalResponse(Message message, Object[] inputArgs) throws IllegalAccessException, InstantiationException, ClassNotFoundException, JAXBWrapperException, JAXBException, XMLStreamException, MessageException{
-		
+	public Object demarshalResponse(Message message, Object[] inputArgs) throws UnmarshalException {
 		Class returnType = getReturnType();
-		ArrayList<Object> holderArgs = new ArrayList<Object>();
-		ArrayList<MethodParameter> mps = new ArrayList<MethodParameter>();
-		mps = extractHolderParameters(inputArgs);
-		ArrayList<MethodParameter> holdermps = new ArrayList<MethodParameter>(mps);
-		int index =0;
-		//Remove everything except holders from input arguments.
-		for(Object inputArg: inputArgs){
+		
+        ArrayList<Object> holderArgs = null;
+        ArrayList<MethodParameter> mps = null;
+        ArrayList<MethodParameter> holdermps = null;
+        try {
+            holderArgs = new ArrayList<Object>();
+            mps = new ArrayList<MethodParameter>();
+            mps = extractHolderParameters(inputArgs);
+            holdermps = new ArrayList<MethodParameter>(mps);
+        } catch (IllegalAccessException e) {
+            throw new UnmarshalException("Unable to get holder method parameters", e);
+        } catch (InstantiationException e) {
+            throw new UnmarshalException("Unable to get holder method parameters", e);
+        } catch (ClassNotFoundException e) {
+            throw new UnmarshalException("Unable to get holder method parameters", e);
+        }
+
+        // Remove everything except holders from input arguments.
+        int index = 0;
+        for(Object inputArg: inputArgs){
 			if(inputArg !=null && isHolder(inputArg)){
 				holderArgs.add(inputArg);
 			}
 			index++;
 		}
-		mps = null;
-		if(holdermps.size() == 0 && returnType.getName().equals("void")){
-			//No holders and return type void example --> public void someMethod() I will return null for this case.
-			//doNothing as there is nothing to return.
-			
-			return null;
 		
-		}
-		else if(holdermps.size() == 0 && !returnType.getName().equals("void")){
-			//No holders but a return type example --> public ReturnType someMethod()
-			Object bo = createBusinessObject(returnType, message);
-			return bo;
-			
-		}
-		else if(holdermps.size()>0 && returnType.getName().equals("void")){
-			//Holders found and no return type example --> public void someMethod(Holder<AHolder>)	
-			assignHolderValues(holdermps, holderArgs, message);
-			
-		}
-		else{
-			//Holders found and return type example --> public ReturnType someMethod(Holder<AHolder>)
-			//Note that SEI implementation will wrap return type in a holder if method has a return type and input param as holder.
-			//WSGen and WsImport Generate Holders with return type as one of the Holder JAXBObject property, if wsdl schema forces a holder and a return type.
-			assignHolderValues(holdermps, holderArgs, message);
-			Object bo = createBusinessObject(returnType, message);
-			return bo;
-		}
-		return null;
+        try {
+            if(holdermps.size() == 0 && returnType.getName().equals("void")){
+            	// No holders and return type void example --> public void someMethod() 
+                // I will return null for this case.
+            	// doNothing as there is nothing to return.
+            	return null;
+            }
+            else if(holdermps.size() == 0 && !returnType.getName().equals("void")){
+            	// No holders but a return type example --> public ReturnType someMethod()
+            	Object bo = createBusinessObject(returnType, message);
+            	return bo;
+            }
+            else if(holdermps.size()>0 && returnType.getName().equals("void")){
+            	// Holders found and no return type example --> public void someMethod(Holder<AHolder>)	
+            	assignHolderValues(holdermps, holderArgs, message);
+            }
+            else{
+            	// Holders found and return type example --> public ReturnType someMethod(Holder<AHolder>)
+            	// Note that SEI implementation will wrap return type in a holder if method has a return 
+                // type and input param as holder.
+            	// WSGen and WsImport Generate Holders with return type as one of the Holder JAXBObject 
+                // property, if wsdl schema forces a holder and a return type.
+            	assignHolderValues(holdermps, holderArgs, message);
+            	Object bo = createBusinessObject(returnType, message);
+            	return bo;
+            }
+        } catch (JAXBException e) {
+            throw new UnmarshalException("Unable to demarshal response", e);
+        } catch (MessageException e) {
+            throw new UnmarshalException("Unable to demarshal response", e);
+        } catch (XMLStreamException e) {
+            throw new UnmarshalException("Unable to demarshal response", e);
+        }
+
+        return null;
 	}
 
 	/* (non-Javadoc)
 	 * @see org.apache.axis2.jaxws.convertor.impl.MessageConvertorImpl#toObjects(org.apache.axis2.jaxws.message.Message)
 	 */
 	@Override
-	public Object[] demarshalRequest(Message message)throws ClassNotFoundException, JAXBException, MessageException, JAXBWrapperException, XMLStreamException, InstantiationException, IllegalAccessException{
+	public Object[] demarshalRequest(Message message) throws UnmarshalException {
+	    if (log.isDebugEnabled()) {
+	        log.debug("Attempting to demarshal a document/literal request.");
+        }
+        
+        ArrayList<Class> inputParams = getInputTypes();
 		
-		ArrayList<Class> inputParams = getInputTypes();
-		//Method has no input parameters
+        // If the method has no input parameters, then we're done.
 		if(inputParams.size() == 0){
 			return null;
 		}
-		ArrayList<Object> objectList = new ArrayList<Object>();
-		int index =0;
-		ArrayList<MethodParameter> mps = createParameterForSEIMethod(message);
+        
+        ArrayList<MethodParameter> mps;
+        try {
+            mps = createParameterForSEIMethod(message);
+        } catch (Exception e) {
+            if (log.isDebugEnabled()) {
+                log.debug("An error occured while demarshalling the request" + e.getMessage());
+            }
+            throw new UnmarshalException("Unable to demarshal the request message.", e);
+        }
+        
+        ArrayList<Object> objectList = new ArrayList<Object>();
 		if (log.isDebugEnabled()) {
             log.debug("reading input method parameters");
         }
@@ -133,64 +166,92 @@
        return objectList.toArray();		
 	}
 
-	/* (non-Javadoc)
+	/* 
+     * (non-Javadoc)
 	 * @see org.apache.axis2.jaxws.convertor.impl.MessageConvertorImpl#fromJAXBObject(java.lang.Object)
 	 */
 	@Override
-	public Message marshalResponse(Object returnObject, Object[] holderObjects) throws ClassNotFoundException, JAXBException, MessageException, JAXBWrapperException, XMLStreamException, InstantiationException, IllegalAccessException{
-		// Response wrapper is basically the return type. so the return object is a jaxbObject. If there is a holder objects then that is the responsewrapper.
+	public Message marshalResponse(Object returnObject, Object[] holderObjects) throws MarshalException {
+		// Response wrapper is basically the return type. So the return object 
+        // is a JAXB object. If there is a holder objects then that is the 
+        // responsewrapper.
 		Class wrapperClazz = getReturnType();
 		String wrapperClazzName = operationDesc.getResultName();
-		if(wrapperClazzName == null || wrapperClazzName.trim().length() == 0){
+		if (wrapperClazzName == null || wrapperClazzName.trim().length() == 0) {
 			wrapperClazzName = wrapperClazz.getName();
 		}
 		String wrapperTNS = operationDesc.getResultTargetNamespace();
 		
-		ArrayList<MethodParameter> holdersNreturnObject = extractHolderParameters(holderObjects);
-		Message message = null;
-		
-		if(holdersNreturnObject.size() == 0 && wrapperClazz.getName().equals("void")){
-			//No holders and return type void example --> public void someMethod() I will return empty ResponseWrapper in message body for this case.
-			//doNothing as there is nothing to wrap
-			
-			message = createEmptyMessage();
+		ArrayList<MethodParameter> holdersNreturnObject;
+        try {
+            holdersNreturnObject = extractHolderParameters(holderObjects);
+        } catch (IllegalAccessException e) {
+            throw new MarshalException("Unable to extract holder params", e);
+        } catch (InstantiationException e) {
+            throw new MarshalException("Unable to extract holder params", e);
+        } catch (ClassNotFoundException e) {
+            throw new MarshalException("Unable to extract holder params", e);
+        }
 		
-		}
-		else if(holdersNreturnObject.size() == 0 && !wrapperClazz.getName().equals("void")){
-			//No holders but a return type example --> public ReturnType someMethod()
-			MethodParameter mp = new MethodParameter(wrapperClazzName,wrapperTNS, wrapperClazz, returnObject);
-			holdersNreturnObject.add(mp);
-			message = createMessage(holdersNreturnObject);
-			
-		}
-		else if(holdersNreturnObject.size()>0 && wrapperClazz.getName().equals("void")){
-			//Holders found and no return type example --> public void someMethod(Holder<AHolder>)	
-			message = createMessage(holdersNreturnObject);
-			
-		}
-		else{
-			//Holders found and return type example --> public ReturnType someMethod(Holder<AHolder>)
-			//Note that SEI implementation will wrap return type in a holder if method has a return type and input param as holder.
-			//WSGen and WsImport Generate Holders with return type as one of the Holder JAXBObject property, if wsdl schema forces a holder and a return type.
-			
-			MethodParameter mp = new MethodParameter(wrapperClazzName,wrapperTNS, wrapperClazz, returnObject);
-			holdersNreturnObject.add(mp);
-			message = createMessage(holdersNreturnObject);
-			
-		}
+        Message message = null;
+		try {
+            if(holdersNreturnObject.size() == 0 && wrapperClazz.getName().equals("void")){
+            	//No holders and return type void example --> public void someMethod() I will return empty ResponseWrapper in message body for this case.
+            	//doNothing as there is nothing to wrap
+            	message = createEmptyMessage();
+            }
+            else if(holdersNreturnObject.size() == 0 && !wrapperClazz.getName().equals("void")){
+            	//No holders but a return type example --> public ReturnType someMethod()
+            	MethodParameter mp = new MethodParameter(wrapperClazzName,wrapperTNS, wrapperClazz, returnObject);
+            	holdersNreturnObject.add(mp);
+            	message = createMessage(holdersNreturnObject);
+            }
+            else if(holdersNreturnObject.size()>0 && wrapperClazz.getName().equals("void")){
+            	//Holders found and no return type example --> public void someMethod(Holder<AHolder>)	
+            	message = createMessage(holdersNreturnObject);
+            }
+            else{
+            	//Holders found and return type example --> public ReturnType someMethod(Holder<AHolder>)
+            	//Note that SEI implementation will wrap return type in a holder if method has a return type and input param as holder.
+            	//WSGen and WsImport Generate Holders with return type as one of the Holder JAXBObject property, if wsdl schema forces a holder and a return type.
+            	MethodParameter mp = new MethodParameter(wrapperClazzName,wrapperTNS, wrapperClazz, returnObject);
+            	holdersNreturnObject.add(mp);
+            	message = createMessage(holdersNreturnObject);
+            }
+        } catch (JAXBException e) {
+            throw new MarshalException("An error occured while marshalling the response message.", e);
+        } catch (MessageException e) {
+            throw new MarshalException("An error occured while marshalling the response message.", e);
+        } catch (XMLStreamException e) {
+            throw new MarshalException("An error occured while marshalling the response message.", e);
+        }
 		
 		return message;
-		
 	}
 
-	/* (non-Javadoc)
+	/* 
+     * (non-Javadoc)
 	 * @see org.apache.axis2.jaxws.convertor.impl.MessageConvertorImpl#fromObjects(java.lang.Object[])
 	 */
 	@Override
-	public Message marshalRequest(Object[] objects) throws IllegalAccessException, InstantiationException, ClassNotFoundException, JAXBWrapperException, JAXBException, MessageException, javax.xml.stream.XMLStreamException{
+	public Message marshalRequest(Object[] objects) throws MarshalException {
+		if (log.isDebugEnabled()) {
+		    log.debug("Attempting to marshal document/literal request");
+        }
+        
+        ArrayList<MethodParameter> mps = null;
+        try {
+            mps = createRequestWrapperParameters(objects);
+        } catch (IllegalAccessException e) {
+            throw new MarshalException("Unable to create request wrapper parameters", e);
+        } catch (InstantiationException e) {
+            throw new MarshalException("Unable to create request wrapper parameters", e);
+        } catch (ClassNotFoundException e) {
+            throw new MarshalException("Unable to create request wrapper parameters", e);
+        }
 		
-		ArrayList<MethodParameter> mps = createRequestWrapperParameters(objects);
-		//WSDL wrapped and running wsImport with non-wrap binding or wsdl un-Wrapped and running wsImport with no binding, EITHER WAYS 
+        
+        //WSDL wrapped and running wsImport with non-wrap binding or wsdl un-Wrapped and running wsImport with no binding, EITHER WAYS 
 		//there can be only 0 or 1 Body parts as per WS-I. 
 		if(mps.size()> SIZE){
 			int numberOfBodyPart =0;
@@ -211,13 +272,21 @@
 		//Lets handle case where there is one message part or one input parameter
 		Message message = null;
 		
-		if(mps.size() !=0){
-			message = createMessage(mps);
-		}
-		//no message part case or no input parameter
-		if(mps.size() == 0){
-			message = createEmptyMessage();
-		}
+		try {
+            if (mps.size() !=0) {
+            	message = createMessage(mps);
+            }
+            //no message part case or no input parameter
+            if (mps.size() == 0) {
+            	message = createEmptyMessage();
+            }
+        } catch (JAXBException e) {
+            throw new MarshalException("An error occured while creating the request message", e);
+        } catch (MessageException e) {
+            throw new MarshalException("An error occured while creating the request message", e);
+        } catch (XMLStreamException e) {
+            throw new MarshalException("An error occured while creating the request message", e);
+        }
 		
 		return message;
 	}

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/DocLitWrappedMethodMarshallerImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/DocLitWrappedMethodMarshallerImpl.java?view=diff&rev=471998&r1=471997&r2=471998
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/DocLitWrappedMethodMarshallerImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/DocLitWrappedMethodMarshallerImpl.java Mon Nov  6 22:00:51 2006
@@ -1,18 +1,20 @@
 /*
- * Copyright 2004,2005 The Apache Software Foundation.
- * Copyright 2006 International Business Machines Corp.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
  *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ *      
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
  */
 package org.apache.axis2.jaxws.marshaller.impl;
 
@@ -27,16 +29,16 @@
 import org.apache.axis2.jaxws.description.ParameterDescription;
 import org.apache.axis2.jaxws.description.ServiceDescription;
 import org.apache.axis2.jaxws.marshaller.DocLitWrappedMethodMarshaller;
+import org.apache.axis2.jaxws.marshaller.MarshalException;
 import org.apache.axis2.jaxws.marshaller.MethodParameter;
+import org.apache.axis2.jaxws.marshaller.UnmarshalException;
 import org.apache.axis2.jaxws.message.Message;
 import org.apache.axis2.jaxws.message.MessageException;
 import org.apache.axis2.jaxws.message.Protocol;
 import org.apache.axis2.jaxws.wrapper.JAXBWrapperTool;
-import org.apache.axis2.jaxws.wrapper.impl.JAXBWrapperException;
 import org.apache.axis2.jaxws.wrapper.impl.JAXBWrapperToolImpl;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.xerces.xs.datatypes.ObjectList;
 
 public class DocLitWrappedMethodMarshallerImpl extends MethodMarshallerImpl
 		implements DocLitWrappedMethodMarshaller {
@@ -50,53 +52,71 @@
 	public DocLitWrappedMethodMarshallerImpl(ServiceDescription serviceDesc,
 			EndpointDescription endpointDesc, OperationDescription operationDesc, Protocol protocol) {
 		super(serviceDesc, endpointDesc, operationDesc, protocol);
-		// TODO Auto-generated constructor stub
 	}
 
 	/* (non-Javadoc)
 	 * @see org.apache.axis2.jaxws.convertor.impl.MessageConvertorImpl#toJAXBObject(org.apache.axis2.jaxws.message.Message)
 	 */
 	@Override
-	public Object demarshalResponse(Message message, Object[] inputArgs) throws IllegalAccessException, InstantiationException, ClassNotFoundException, JAXBWrapperException, JAXBException, javax.xml.stream.XMLStreamException, MessageException{
-		Class wrapperClazz = null;
+	public Object demarshalResponse(Message message, Object[] inputArgs) throws UnmarshalException {
+		if (log.isDebugEnabled()) {
+		    log.debug("Attempting to demarshal a document/literal wrapped response");
+        }
+        
 		String className = operationDesc.getResponseWrapperClassName();
-		//TODO Move this to Operation Description.
-		if(className == null || (className!=null && className.length()==0)){
-			wrapperClazz = getReturnType();
-		}
-		else{		
-			wrapperClazz = loadClass(className);
-		}
-		String resultName = operationDesc.getResultName();
-		Object bo = createBusinessObject(wrapperClazz, message);
-        assignHolderValues(bo, inputArgs, false);
-        // REVIEW: Is the the appropriate logic, to be checking for the existence of the annotation
-        //         as the decision point for getting into the property logic?  Note that even if the annotation
-        //         is not present, a default result name will be returned.
-		// If the WebResult annotation is present, then look up the result Name
-		if(((OperationDescriptionJava) operationDesc).isWebResultAnnotationSpecified()){
-		//if ReturnType is not of same type as JAXBBlock business Object then I will look for resultName in Business Object and return that.
-			Object resultObject = findProperty(resultName, bo);
-			return resultObject;
-		}
+        Object businessObject = null;
+        try {
+            //TODO Move this to Operation Description.
+            Class wrapperClazz = null;
+            if (className == null || (className != null && className.length() == 0)) {
+    			wrapperClazz = getReturnType();
+    		}
+    		else {		
+                wrapperClazz = loadClass(className);
+    		}
+    		
+            String resultName = operationDesc.getResultName();
+    		businessObject = createBusinessObject(wrapperClazz, message);
+            assignHolderValues(businessObject, inputArgs, false);
+            
+            // REVIEW: Is the the appropriate logic, to be checking for the existence of the annotation
+            //         as the decision point for getting into the property logic?  Note that even if the annotation
+            //         is not present, a default result name will be returned.
+            // If the WebResult annotation is present, then look up the result Name
+            if(((OperationDescriptionJava) operationDesc).isWebResultAnnotationSpecified()){
+                // If the return type is not of same type as the JAXBBlock business Object then 
+                // look for resultName in Business Object and return that.
+            	Object resultObject = findProperty(resultName, businessObject);
+            	return resultObject;
+            }
+        } catch (Exception e) {
+            throw new UnmarshalException(e);
+        }
         
-		return bo;
+		return businessObject;
 	}
 
 	/* (non-Javadoc)
 	 * @see org.apache.axis2.jaxws.convertor.impl.MessageConvertorImpl#toObjects(org.apache.axis2.jaxws.message.Message)
 	 */
 	@Override
-	public Object[] demarshalRequest(Message message)throws ClassNotFoundException, JAXBException, MessageException, JAXBWrapperException, XMLStreamException, InstantiationException, IllegalAccessException {
+	public Object[] demarshalRequest(Message message) throws UnmarshalException {
         String className = operationDesc.getRequestWrapperClassName();
-        Class requestWrapperClazz = loadClass(className);
-        Object jaxbObject = createBusinessObject(requestWrapperClazz, message);
-        
-        if (log.isDebugEnabled()) {
-            log.debug("reading input method parameters");
+
+        ArrayList<MethodParameter> mps;
+        try {
+            Class requestWrapperClazz = loadClass(className);
+            Object jaxbObject = createBusinessObject(requestWrapperClazz, message);
+            
+            if (log.isDebugEnabled()) {
+                log.debug("reading input method parameters");
+            }
+      
+            mps = createParameterForSEIMethod(jaxbObject);
+        } catch (Exception e) {
+            throw new UnmarshalException(e);
         }
-       
-        ArrayList<MethodParameter> mps = createParameterForSEIMethod(jaxbObject);
+        
         if (log.isDebugEnabled()) {
             log.debug("done reading input method parameters");
         }
@@ -118,25 +138,31 @@
 	 * @see org.apache.axis2.jaxws.convertor.impl.MessageConvertorImpl#fromJAXBObject(java.lang.Object)
 	 */
 	@Override
-	public Message marshalResponse(Object returnObject, Object[] holderObjects)throws ClassNotFoundException, JAXBException, MessageException, JAXBWrapperException, XMLStreamException, InstantiationException, IllegalAccessException {
+	public Message marshalResponse(Object returnObject, Object[] holderObjects) throws MarshalException {
 		Class wrapperClazz = null;
 		String wrapperClazzName = operationDesc.getResponseWrapperClassName();
         // TODO: (JLB) REVIEW: I changed this from getRequestWrapper to getRewponseWrapper...
 		String wrapperXMLElementName = operationDesc.getResponseWrapperLocalName();
 		String wrapperTNS = operationDesc.getResponseWrapperTargetNamespace();
 		String webResult = operationDesc.getResultName();
-		//TODO Move this to Operation Description.
-		if(wrapperClazzName == null || (wrapperClazzName!=null && wrapperClazzName.length()==0)){
-			wrapperClazz = getReturnType();
-			wrapperClazzName = wrapperClazz.getName();
-			if(log.isDebugEnabled()){
-				log.debug("No ResponseWrapper annotation found, using return type of method as response object");
-			}
-		}
-		else{		
-			wrapperClazz = loadClass(wrapperClazzName);
-		}
-		//create all holders list
+		
+        try {
+            //TODO Move this to Operation Description.
+            if (wrapperClazzName == null || (wrapperClazzName != null && wrapperClazzName.length() == 0)) {
+                if (log.isDebugEnabled()) {
+                    log.debug("No ResponseWrapper annotation found, using return type of method as response object");
+                }
+                wrapperClazz = getReturnType();
+            	wrapperClazzName = wrapperClazz.getName();
+            }
+            else {		
+                wrapperClazz = loadClass(wrapperClazzName);
+            }
+        } catch (ClassNotFoundException e) {
+            throw new MarshalException("Unable to load wrapper class", e);
+        }
+        
+		// Create all holders list
 		ParameterDescription[] paramDescs = operationDesc.getParameterDescriptions();
 		ArrayList<Object> objectList = new ArrayList<Object>();
 		int index =0;
@@ -147,27 +173,41 @@
 			}
 			index++;
 		}
-		//No Holders found 
-		ArrayList<MethodParameter> mps = new ArrayList<MethodParameter>();
-		if(objectList.size() == 0 && wrapperClazz.getName().equals("void")){
-			//No holders and return type void example --> public void someMethod() I will return empty ResponseWrapper in message body for this case.
-			//doNothing as there is nothing to wrap
-		}
-		if(objectList.size() == 0 && !wrapperClazz.getName().equals("void")){
-			//No holders but a return type example --> public ReturnType someMethod()
-			mps = createResponseWrapperParameter(returnObject);
-		}
-		else{
-			//Holders found and return type or no return type. example --> public ReturnType someMethod(Holder<String>) or public void someMethod(Holder<String>)
-			mps = createResponseWrapperParameter(returnObject, objectList.toArray());
-		}
+
+        // No Holders found 
+        ArrayList<MethodParameter> mps = null;
+        try {
+            mps = new ArrayList<MethodParameter>();
+            if(objectList.size() == 0 && wrapperClazz.getName().equals("void")){
+            	//No holders and return type void example --> public void someMethod() I will return empty ResponseWrapper in message body for this case.
+            	//doNothing as there is nothing to wrap
+            }
+            if(objectList.size() == 0 && !wrapperClazz.getName().equals("void")){
+            	//No holders but a return type example --> public ReturnType someMethod()
+            	mps = createResponseWrapperParameter(returnObject);
+            }
+            else{
+            	//Holders found and return type or no return type. example --> public ReturnType someMethod(Holder<String>) or public void someMethod(Holder<String>)
+            	mps = createResponseWrapperParameter(returnObject, objectList.toArray());
+            }
+        } catch (IllegalAccessException e) {
+            throw new MarshalException("Unable to create method parameters list", e);
+        } catch (InstantiationException e) {
+            throw new MarshalException("Unable to create method parameters list", e);
+        } catch (ClassNotFoundException e) {
+            throw new MarshalException("Unable to create method parameters list", e);
+        }
 		
-        JAXBWrapperTool wrapperTool = new JAXBWrapperToolImpl();
-        Object wrapper = wrapperTool.wrap(wrapperClazz, 
-        		wrapperClazzName, mps);
-        
-		Message message = createMessage(wrapper, wrapperClazz, wrapperXMLElementName, wrapperTNS);
-		return message;
+        Message message;
+        try {
+            JAXBWrapperTool wrapperTool = new JAXBWrapperToolImpl();
+            Object wrapper = wrapperTool.wrap(wrapperClazz, wrapperClazzName, mps);
+            message = createMessage(wrapper, wrapperClazz, wrapperXMLElementName, wrapperTNS);
+        } catch (Exception e) {
+            throw new MarshalException(e);
+        }
+		
+        return message;
 		
 	}
 
@@ -175,33 +215,57 @@
 	 * @see org.apache.axis2.jaxws.convertor.impl.MessageConvertorImpl#fromObjects(java.lang.Object[])
 	 */
 	@Override
-	public Message marshalRequest(Object[] objects) throws IllegalAccessException, InstantiationException, ClassNotFoundException, JAXBWrapperException, JAXBException, MessageException, javax.xml.stream.XMLStreamException {
-		
+	public Message marshalRequest(Object[] objects) throws MarshalException {
 		String className = operationDesc.getRequestWrapperClassName();
-		Class wrapperClazz = loadClass(className);
-		String localName = operationDesc.getRequestWrapperLocalName();
-		String wrapperTNS = operationDesc.getRequestWrapperTargetNamespace();
+        String localName = operationDesc.getRequestWrapperLocalName();
+        String wrapperTNS = operationDesc.getRequestWrapperTargetNamespace();
+        
+        Class wrapperClazz = null;
+        try {
+            wrapperClazz = loadClass(className);
+        }
+        catch (ClassNotFoundException e) {
+            throw new MarshalException("Unable to load wrapper class.", e);
+        }
 		
 		//Get Name Value pair for input parameter Objects, skip AsyncHandler and identify Holders.
-		
-		ArrayList<MethodParameter> methodParameters = createRequestWrapperParameters(objects);
-		JAXBWrapperTool wrapTool = new JAXBWrapperToolImpl();
-		if (log.isDebugEnabled()) {
-            log.debug("JAXBWrapperTool attempting to wrap propertes in WrapperClass :" + wrapperClazz);
-        }
-	
-		Object jaxbObject = wrapTool.wrap(wrapperClazz, localName, methodParameters);
-		if (log.isDebugEnabled()) {
-            log.debug("JAXBWrapperTool wrapped following propertes :");
+		Object jaxbObject = null;
+        try {
+            ArrayList<MethodParameter> methodParameters = createRequestWrapperParameters(objects);
+            JAXBWrapperTool wrapTool = new JAXBWrapperToolImpl();
+            if (log.isDebugEnabled()) {
+                log.debug("JAXBWrapperTool attempting to wrap propertes in WrapperClass :" + wrapperClazz);
+            }
+
+            jaxbObject = wrapTool.wrap(wrapperClazz, localName, methodParameters);
+            if (log.isDebugEnabled()) {
+                log.debug("JAXBWrapperTool wrapped following propertes :");
+            }
+        } catch (Exception e) {
+            throw new MarshalException(e);
         }
 		
-		Message message = createMessage(jaxbObject, wrapperClazz, localName, wrapperTNS);
-		return message;
+		Message message = null;
+        try {
+            message = createMessage(jaxbObject, wrapperClazz, localName, wrapperTNS);
+        } catch (JAXBException e) {
+            throw new MarshalException(e);
+        } catch (MessageException e) {
+            throw new MarshalException(e);
+        } catch (XMLStreamException e) {
+            throw new MarshalException(e);
+        }
+        
+        return message;
 	}
 
-	private Class loadClass(String className)throws ClassNotFoundException{
+    // FIXME: This is wrong.  We first need to get the ClassLoader from the 
+    // AxisService if there is one on there.  Then, if that does not exist
+    // we can grab the thread's context ClassLoader.
+	private Class loadClass(String className) throws ClassNotFoundException {
 		// TODO J2W AccessController Needed
 		// Don't make this public, its a security exposure
-		return Class.forName(className, true, Thread.currentThread().getContextClassLoader());
+        Class c = Class.forName(className, true, Thread.currentThread().getContextClassLoader());
+		return c;
 	}
 }

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/MethodMarshallerImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/MethodMarshallerImpl.java?view=diff&rev=471998&r1=471997&r2=471998
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/MethodMarshallerImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/MethodMarshallerImpl.java Mon Nov  6 22:00:51 2006
@@ -1,24 +1,23 @@
 /*
- * Copyright 2004,2005 The Apache Software Foundation.
- * Copyright 2006 International Business Machines Corp.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
  *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ *      
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
  */
 package org.apache.axis2.jaxws.marshaller.impl;
 
-import java.io.ByteArrayInputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -29,22 +28,17 @@
 import java.util.concurrent.Future;
 
 import javax.jws.WebParam.Mode;
-import javax.management.openmbean.SimpleType;
 import javax.xml.bind.JAXBElement;
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.JAXBIntrospector;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
 import javax.xml.ws.AsyncHandler;
 import javax.xml.ws.Holder;
 import javax.xml.ws.Response;
 
 import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.util.StAXUtils;
 import org.apache.axis2.jaxws.ExceptionFactory;
 import org.apache.axis2.jaxws.description.EndpointDescription;
 import org.apache.axis2.jaxws.description.FaultDescription;
@@ -53,8 +47,10 @@
 import org.apache.axis2.jaxws.description.ServiceDescription;
 import org.apache.axis2.jaxws.i18n.Messages;
 import org.apache.axis2.jaxws.marshaller.ClassUtils;
+import org.apache.axis2.jaxws.marshaller.MarshalException;
 import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
 import org.apache.axis2.jaxws.marshaller.MethodParameter;
+import org.apache.axis2.jaxws.marshaller.UnmarshalException;
 import org.apache.axis2.jaxws.message.Block;
 import org.apache.axis2.jaxws.message.Message;
 import org.apache.axis2.jaxws.message.MessageException;
@@ -70,10 +66,8 @@
 import org.apache.axis2.jaxws.wrapper.JAXBWrapperTool;
 import org.apache.axis2.jaxws.wrapper.impl.JAXBWrapperException;
 import org.apache.axis2.jaxws.wrapper.impl.JAXBWrapperToolImpl;
-import org.apache.axis2.util.XMLUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.xerces.xs.datatypes.ObjectList;
 
 public abstract class MethodMarshallerImpl implements MethodMarshaller {
 	private static QName SOAPENV_QNAME = new QName("http://schemas.xmlsoap.org/soap/envelope/", "Envelope");
@@ -93,27 +87,27 @@
 	/* (non-Javadoc)
 	 * @see org.apache.axis2.jaxws.helper.XMLMessageConvertor#toJAXBObject(org.apache.axis2.jaxws.message.Message)
 	 */
-	public abstract Object demarshalResponse(Message message, Object[] inputArgs) throws IllegalAccessException, InstantiationException, ClassNotFoundException, JAXBWrapperException, JAXBException, XMLStreamException, MessageException; 
+	public abstract Object demarshalResponse(Message message, Object[] inputArgs) throws UnmarshalException; 
 
 	/* (non-Javadoc)
 	 * @see org.apache.axis2.jaxws.helper.XMLMessageConvertor#toObjects(org.apache.axis2.jaxws.message.Message)
 	 */
-	public abstract Object[] demarshalRequest(Message message) throws ClassNotFoundException, JAXBException, MessageException, JAXBWrapperException, XMLStreamException, InstantiationException, IllegalAccessException;
+	public abstract Object[] demarshalRequest(Message message) throws UnmarshalException;
 
 	/* (non-Javadoc)
 	 * @see org.apache.axis2.jaxws.helper.XMLMessageConvertor#fromJAXBObject(java.lang.Object)
 	 */
-	public abstract Message marshalResponse(Object returnObject, Object[] holderObjects)throws ClassNotFoundException, JAXBException, MessageException, JAXBWrapperException, XMLStreamException, InstantiationException, IllegalAccessException; 
+	public abstract Message marshalResponse(Object returnObject, Object[] holderObjects)throws MarshalException; 
 	
 	/* (non-Javadoc)
 	 * @see org.apache.axis2.jaxws.helper.XMLMessageConvertor#fromObjects(java.lang.Object[])
 	 */
-	public abstract Message marshalRequest(Object[] object)throws IllegalAccessException, InstantiationException, ClassNotFoundException, JAXBWrapperException, JAXBException, MessageException, XMLStreamException; 
+	public abstract Message marshalRequest(Object[] object)throws MarshalException; 
 	
 	/* (non-Javadoc)
 	 * @see org.apache.axis2.jaxws.marshaller.MethodMarshaller#demarshalFaultResponse(org.apache.axis2.jaxws.message.Message)
 	 */
-	public Object demarshalFaultResponse(Message message) {
+	public Object demarshalFaultResponse(Message message) throws UnmarshalException {
 		
 		Exception exception = null;
         
@@ -152,7 +146,7 @@
 	/* (non-Javadoc)
 	 * @see org.apache.axis2.jaxws.marshaller.MethodMarshaller#marshalFaultResponse(java.lang.Throwable)
 	 */
-	public Message marshalFaultResponse(Throwable throwable) throws IllegalAccessException, InvocationTargetException, JAXBException, ClassNotFoundException, NoSuchMethodException, MessageException, XMLStreamException {
+	public Message marshalFaultResponse(Throwable throwable) throws MarshalException {
 		Throwable t = ClassUtils.getRootCause(throwable);
 		
         FaultDescription fd = operationDesc.resolveFaultByExceptionName(t.getClass().getName());
@@ -161,25 +155,29 @@
 		XMLFault xmlfault = null;
         ArrayList<Block> detailBlocks = new ArrayList<Block>();
         
-        String text = null;
-		if (fd != null) {
-			Method getFaultInfo = t.getClass().getMethod("getFaultInfo", null);
-			Object faultBean = getFaultInfo.invoke(t, null);
-			Class faultClazz = loadClass(fd.getBeanName());
-			JAXBBlockContext context = createJAXBBlockContext(faultClazz);
-			detailBlocks.add(createJAXBBlock(faultBean, context));
-            text = t.getMessage();
-        } else {
-            // TODO probably want to set text to the stacktrace
-            text = t.toString();
+        Message message = null;
+        try {
+            String text = null;
+            if (fd != null) {
+            	Method getFaultInfo = t.getClass().getMethod("getFaultInfo", null);
+            	Object faultBean = getFaultInfo.invoke(t, null);
+            	Class faultClazz = loadClass(fd.getBeanName());
+            	JAXBBlockContext context = createJAXBBlockContext(faultClazz);
+            	detailBlocks.add(createJAXBBlock(faultBean, context));
+                text = t.getMessage();
+            } else {
+                // TODO probably want to set text to the stacktrace
+                text = t.toString();
+            }
+            xmlfault = new XMLFault(null, // Use the default XMLFaultCode
+                        new XMLFaultReason(text),  // Assumes text is the language supported by the current Locale
+                        detailBlocks.toArray(new Block[0]));
+            		
+            message = createEmptyMessage();
+            message.setXMLFault(xmlfault);
+        } catch (Exception e) {
+            throw new MarshalException(e);
         }
-		xmlfault = new XMLFault(null, // Use the default XMLFaultCode
-                    new XMLFaultReason(text),  // Assumes text is the language supported by the current Locale
-                    detailBlocks.toArray(new Block[0]));
-				
-		Message message = null;
-		message = createEmptyMessage();
-		message.setXMLFault(xmlfault);
 		
 		return message;
 		
@@ -191,8 +189,7 @@
 	 * and creates a name value pair.
 	 * Also handles situation where ResponseWrapper is a holder.
 	 */
-	
-	protected ArrayList<MethodParameter> createResponseWrapperParameter(Object webResultValue){
+	protected ArrayList<MethodParameter> createResponseWrapperParameter(Object webResultValue) {
 		ArrayList<MethodParameter> mps = new ArrayList<MethodParameter>();
 		if(webResultValue == null){
 			return mps;
@@ -208,7 +205,8 @@
 		return mps;
 	}
 	
-    protected ArrayList<MethodParameter> createResponseWrapperParameter(Object webResultObject, Object[] holderObjects)throws IllegalAccessException, InstantiationException, ClassNotFoundException{
+    protected ArrayList<MethodParameter> createResponseWrapperParameter(Object webResultObject, Object[] holderObjects)
+        throws IllegalAccessException, InstantiationException, ClassNotFoundException {
 		ParameterDescription[] paramDescs = operationDesc.getParameterDescriptions();
 		ArrayList<ParameterDescription> pds = new ArrayList<ParameterDescription>();
 		pds = toArrayList(paramDescs);
@@ -516,10 +514,8 @@
 	}
 	
 	
-	private ArrayList<MethodParameter> createMethodParameters(
-			ParameterDescription[] paramDescs, ArrayList<Object> paramValues)
-			throws IllegalAccessException, InstantiationException,
-			ClassNotFoundException {
+	private ArrayList<MethodParameter> createMethodParameters(ParameterDescription[] paramDescs, ArrayList<Object> paramValues)
+        throws InstantiationException, ClassNotFoundException, IllegalAccessException {
 		ArrayList<MethodParameter> mps = new ArrayList<MethodParameter>();
 		int index = 0;
 		for (Object paramValue : paramValues) {
@@ -541,8 +537,7 @@
 					// will mostly be called during server side call
 					else if (paramValue != null && !isHolder(paramValue)
 							&& isHolderType) {
-						Holder<Object> holder = createHolder(paramType,
-								paramValue);
+						Holder<Object> holder = createHolder(paramType, paramValue);
 						mp = new MethodParameter(paramDesc, holder);
 					} 
 				    // Identify Holders and get Holder Values, this if condition
@@ -650,7 +645,7 @@
 		
 	}
 
-	protected Block createEmptyBodyBlock()throws MessageException{
+	protected Block createEmptyBodyBlock() throws MessageException {
 		String emptyBody = "";
 		XMLStringBlockFactory stringFactory = (XMLStringBlockFactory) FactoryRegistry.getFactory(XMLStringBlockFactory.class);
 		return stringFactory.createFrom(emptyBody, null, SOAPENV_QNAME);
@@ -708,8 +703,6 @@
 		return returnType;	
 	}
 	
-	
-	
 	private boolean isParamAsyncHandler(String name, Object value){
 		if(value!=null && value instanceof AsyncHandler){
 			if(log.isDebugEnabled()){
@@ -734,7 +727,8 @@
 	protected boolean isHolder(Class type){
 		return type!=null && Holder.class.isAssignableFrom(type);
 	}
-	protected Object getHolderValue(Mode mode, Object value){
+
+    protected Object getHolderValue(Mode mode, Object value){
 		if(!Holder.class.isAssignableFrom(value.getClass())){
 			if(log.isDebugEnabled()){
 				log.debug("Object Not a Holder type");
@@ -853,7 +847,7 @@
 		return mf.createFrom(element);
 	}
 	
-	protected Message createEmptyMessage()throws JAXBException, MessageException, XMLStreamException{
+	protected Message createEmptyMessage() throws JAXBException, MessageException, XMLStreamException {
 		Block emptyBodyBlock = createEmptyBodyBlock();
 		MessageFactory mf = (MessageFactory)FactoryRegistry.getFactory(MessageFactory.class);
 		Message m = mf.create(protocol);



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message