Author: ips
Date: Wed May 18 14:47:56 2005
New Revision: 170833
URL: http://svn.apache.org/viewcvs?rev=170833&view=rev
Log:
added optional validation of request XML
Modified:
incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/FaultException.java
incubator/apollo/trunk/src/java/org/apache/ws/resource/handler/ResourceHandler.java
incubator/apollo/trunk/src/java/org/apache/ws/resource/i18n/Keys.java
Modified:
incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/FaultException.java
URL:
http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/FaultException.java?rev=170833&r1=170832&r2=170833&view=diff
==============================================================================
---
incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/FaultException.java
(original)
+++
incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/FaultException.java
Wed May 18 14:47:56 2005
@@ -40,18 +40,18 @@
private Detail m_detail;
- protected FaultException( QName faultCode, String faultString, String
faultActor, Detail detail )
+ public FaultException( QName faultCode, String faultString, String
faultActor, Detail detail )
{
super( faultCode, faultString, faultActor, detail );
m_detail = detail;
}
- protected FaultException( QName faultCode, String faultString, String
faultActor )
+ public FaultException( QName faultCode, String faultString, String
faultActor )
{
this( faultCode, faultString, faultActor, createDetail() );
}
- protected FaultException( QName faultCode, String faultString )
+ public FaultException( QName faultCode, String faultString )
{
this( faultCode, faultString, null );
}
Modified:
incubator/apollo/trunk/src/java/org/apache/ws/resource/handler/ResourceHandler.java
URL:
http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/handler/ResourceHandler.java?rev=170833&r1=170832&r2=170833&view=diff
==============================================================================
---
incubator/apollo/trunk/src/java/org/apache/ws/resource/handler/ResourceHandler.java
(original)
+++
incubator/apollo/trunk/src/java/org/apache/ws/resource/handler/ResourceHandler.java
Wed May 18 14:47:56 2005
@@ -18,22 +18,23 @@
import org.apache.commons.lang.exception.ExceptionUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.ws.Soap1_1Constants;
import org.apache.ws.resource.ResourceContext;
import org.apache.ws.resource.ResourceContextException;
+import org.apache.ws.resource.faults.FaultException;
import org.apache.ws.resource.i18n.Keys;
import org.apache.ws.resource.i18n.MessagesImpl;
import org.apache.ws.util.XmlBeanUtils;
import org.apache.ws.util.i18n.Messages;
+import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlOptions;
-import org.apache.xmlbeans.XmlException;
-import org.xmlsoap.schemas.soap.envelope.Body;
-import org.xmlsoap.schemas.soap.envelope.Envelope;
import javax.xml.namespace.QName;
import javax.xml.rpc.JAXRPCException;
import javax.xml.rpc.handler.GenericHandler;
import javax.xml.rpc.handler.MessageContext;
+import javax.xml.rpc.handler.HandlerInfo;
import javax.xml.rpc.handler.soap.SOAPMessageContext;
import javax.xml.rpc.soap.SOAPFaultException;
import javax.xml.soap.MessageFactory;
@@ -48,6 +49,7 @@
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
/**
* LOG-DONE Base class for platform-specific providers; also is a JAX-RPC
Handler for more flexibility.
@@ -80,25 +82,19 @@
*/
public static final String SERVICE_OPT_SERVICE_CLASS_NAME =
"serviceClassName";
- /**
- * DOCUMENT_ME
- */
- public static final String SERVICE_OPT_RESOURCE_KEY_QNAME =
"resourceKeyQname";
+ public static final String HANDLER_OPT_VALIDATE_REQUEST_XML =
"validateRequestXml";
- /**
- * DOCUMENT_ME
- */
- public static final String SERVICE_OPT_RESOURCE_KEY_CLASS_NAME =
"resourceKeyClass";
+ static
+ {
+ ExceptionUtils.addCauseMethodName( "getLinkedCause" ); // for
JAXRPCException
+ }
- /**
- * DOCUMENT_ME
- */
- public static final String SERVICE_OPT_RESOURCE_HOME_CLASS_NAME =
"resourceHomeClass";
+ private Map m_handlerOptions;
- /**
- * DOCUMENT_ME
- */
- public static final String SOAP_ENVELOPE_XMLBEAN =
"apollo.soapEnvelopeXmlBean";
+ public void init( HandlerInfo handlerInfo )
+ {
+ m_handlerOptions = handlerInfo.getHandlerConfig();
+ }
/**
* DOCUMENT_ME
@@ -110,11 +106,6 @@
return new QName[0];
}
- static
- {
- ExceptionUtils.addCauseMethodName( "getLinkedCause" ); // for
JAXRPCException
- }
-
/**
* DOCUMENT_ME
*
@@ -126,201 +117,87 @@
{
try
{
- LOG.debug(MSG.getMessage(Keys.RECEIVED_REQUEST));
+ LOG.debug( MSG.getMessage( Keys.RECEIVED_REQUEST ) );
SOAPMessageContext soapMsgContext = (SOAPMessageContext)
msgContext;
SOAPEnvelope envelope =
soapMsgContext.getMessage().getSOAPPart().getEnvelope();
- org.apache.ws.util.soap.Body body = getSoapBody(envelope);
-
- if (LOG.isDebugEnabled())
+ if ( LOG.isDebugEnabled() )
{
- LOG.debug("The request envelope: \n" + envelope.toString());
+ LOG.debug( "The request envelope: \n" + envelope );
}
+ org.apache.ws.util.soap.Body body = getSoapBody( envelope );
- ResourceContext resourceContext =
createResourceContext(soapMsgContext);
+ ResourceContext resourceContext = createResourceContext(
soapMsgContext );
String addressingAction = resourceContext.getAddressingAction();
- SoapMethodNameMap methodnameMap = new
ServiceSoapMethodNameMap(resourceContext);
- String methodNameFromAction =
methodnameMap.getMethodNameFromAction(addressingAction);
+ SoapMethodNameMap methodnameMap = new ServiceSoapMethodNameMap(
resourceContext );
+ String methodNameFromAction =
methodnameMap.getMethodNameFromAction( addressingAction );
List responseBodyElems = new ArrayList();
- Class serviceClass = getServiceClassName(resourceContext);
- WsrfService service = createService(serviceClass, resourceContext);
- XmlObject[] childElements =
XmlBeanUtils.getChildElements(body.getXmlObject());
+ Class serviceClass = getServiceClassName( resourceContext );
+ WsrfService service = createService( serviceClass, resourceContext
);
+ XmlObject[] childElems = XmlBeanUtils.getChildElements(
body.getXmlObject() );
Method serviceMethod = null;
- if (childElements.length == 0)
+ if ( childElems.length > 1 )
{
- if (methodNameFromAction != null)
+ throw new FaultException( Soap1_1Constants.FAULT_CLIENT,
+ "SOAP Body contains more than one request element -
this service requires that the SOAP Body contain at most one request element."
);
+ }
+ if ( childElems.length == 0 ) // empty Body
+ {
+ if ( methodNameFromAction != null )
{
//try to find a method based on the action
- serviceMethod = getServiceMethod(service,
methodNameFromAction);
- LOG.debug(MSG.getMessage(Keys.INVOKE_RESOURCE_METHOD,
- serviceMethod.getName()));
- XmlObject responseXBean =
invokeServiceMethod(serviceMethod, service, null, serviceClass);
- if (responseXBean != null)
+ serviceMethod = getServiceMethod( service,
methodNameFromAction );
+ LOG.debug( MSG.getMessage( Keys.INVOKE_RESOURCE_METHOD,
+ serviceMethod.getName() ) );
+ XmlObject responseXBean = invokeServiceMethod(
serviceMethod, service, null, serviceClass );
+ if ( responseXBean != null )
{
- responseBodyElems.add(responseXBean);
+ responseBodyElems.add( responseXBean );
}
}
- else
+ else // empty Body and unmapped wsa:Action
{
- //else there was no body..so nothing to invoke...bad
request
- ///throw exception
- LOG.warn("No SOAP Body elements were defined and there was
no WS-Addressing Action determined. Unable to process request.");
- throw new IllegalArgumentException("No SOAP Body elements
were defined and there was no WS-Addressing Action determined. Unable to
process request.");
+ throw new FaultException( Soap1_1Constants.FAULT_CLIENT,
+ "No SOAP Body elements were defined, and the
WS-Addressing Action was not recognized. Unable to process request." );
}
}
-
- else //normal request
+ else // childElems.length == 1
{
- for (int i = 0; i < childElements.length; i++)
+ XmlObject requestXBean = toDocumentXmlBean( childElems[0] );
+ boolean validateRequestXml = Boolean.valueOf(
getHandlerOption( HANDLER_OPT_VALIDATE_REQUEST_XML, "true" ) ).booleanValue();
+ if ( validateRequestXml && !requestXBean.validate() )
{
- XmlObject requestXBean = childElements[i];
-
- //todo probably need to change method signatures to take
types instead of documents to avoid this,
- requestXBean =
XmlObject.Factory.parse(requestXBean.xmlText(new XmlOptions().setSaveOuter()));
- if (requestXBean != null)
- {
- if (methodNameFromAction != null)
- {
- serviceMethod = getServiceMethod(service,
methodNameFromAction, requestXBean); //get method based on Action
- }
- else
- {
- serviceMethod = getServiceMethod(service,
requestXBean); //get method based solely on request elem
- }
-
- LOG.debug(MSG.getMessage(Keys.INVOKE_RESOURCE_METHOD,
- serviceMethod.getName()));
- XmlObject responseXBean =
invokeServiceMethod(serviceMethod, service, requestXBean, serviceClass);
- if (responseXBean != null)
- {
- responseBodyElems.add(responseXBean);
- }
- }
+ throw new JAXRPCException( "validation failed!" ); // TODO
}
-
- }
- if (!responseBodyElems.isEmpty())
- {
- msgContext.setProperty(WSRF_RESPONSE_XMLOBJECT_LIST,
responseBodyElems);
- }
- }
- catch (Throwable t)
- {
- if (t instanceof SOAPFaultException)
- {
- throw (SOAPFaultException) t;
- }
- else
- {
- t.printStackTrace();
- throw new
JAXRPCException(MSG.getMessage(Keys.UNEXPECTED_ERROR_WITH_EXCEPTION, t));
- }
- }
- return false;
- }
-
- /**
- * Returns a facade-wrapped SOAPBody
- *
- * @param envelope
- * @return a facade-wrapped SOAPBody
- * @throws XmlException
- */
- private org.apache.ws.util.soap.Body getSoapBody(SOAPEnvelope envelope)
throws XmlException
- {
- org.apache.ws.util.soap.Envelope envelopeWrapper = null;
- XmlObject envelopeDocXmlBean =
XmlObject.Factory.parse(envelope.toString());
- if(envelopeDocXmlBean instanceof
org.w3.x2003.x05.soapEnvelope.EnvelopeDocument)
- {
- envelopeWrapper = new
org.apache.ws.util.soap.Envelope((org.w3.x2003.x05.soapEnvelope.EnvelopeDocument)envelopeDocXmlBean);
- }
- else if(envelopeDocXmlBean instanceof
org.xmlsoap.schemas.soap.envelope.EnvelopeDocument)
- {
- envelopeWrapper = new
org.apache.ws.util.soap.Envelope((org.xmlsoap.schemas.soap.envelope.EnvelopeDocument)envelopeDocXmlBean);
- }
- else
- {
- throw new IllegalArgumentException("Unknown version of
SOAPEnvelope: " + envelopeDocXmlBean.getClass().getName());
- }
-
- return envelopeWrapper.getBody();
- }
-
- /**
- * This method is used when there are no parameters to a method
- *
- * @param service The service to find the method on.
- * @param methodNameFromAction The method name we are looking for.
- * @return The Method object
- */
- private Method getServiceMethod(WsrfService service, String
methodNameFromAction)
- {
- Method serviceMethod = null;
- LOG.debug("Based on the request, looking for method named: " +
methodNameFromAction+ " in service " + service.getClass().getName()+ " with " +
0 + " param types");
- Method[] methods = service.getClass().getMethods();
- for ( int i = 0; i < methods.length; i++ )
- {
- Method method = methods[i];
- if ( method.getName().equals( methodNameFromAction ))
- {
- if( method.getParameterTypes().length == 0 )
+ if ( methodNameFromAction != null )
{
- serviceMethod = method;
- break;
+ serviceMethod = getServiceMethod( service,
methodNameFromAction, requestXBean ); //get method based on Action
}
else
{
- LOG.warn("Found method named: " + methodNameFromAction + "
in service " + service.getClass().getName()+ " with " +
method.getParameterTypes().length + " param types, expected 0 param type.");
+ serviceMethod = getServiceMethod( service, requestXBean );
//get method based solely on request elem
+ }
+ LOG.debug( MSG.getMessage( Keys.INVOKE_RESOURCE_METHOD,
+ serviceMethod.getName() ) );
+ XmlObject responseXBean = invokeServiceMethod( serviceMethod,
service, requestXBean, serviceClass );
+ if ( responseXBean != null )
+ {
+ responseBodyElems.add( responseXBean );
}
}
- }
-
- if ( serviceMethod == null )
- {
- throw new JAXRPCException( MSG.getMessage(
Keys.UNABLE_TO_FIND_METHOD_IN_SERVICE,
- methodNameFromAction,
- service.getClass().getName() ) );
- }
-
- LOG.debug( MSG.getMessage( Keys.FOUND_SERVICE_METHOD,
- serviceMethod.getName() ) );
- return serviceMethod;
- }
-
- private XmlObject invokeServiceMethod(Method serviceMethod, WsrfService
service, XmlObject requestXBean, Class serviceClass)
- throws Throwable
- {
- XmlObject responseXBean = null;
- try
- {
- if (requestXBean != null)
- {
- responseXBean = (XmlObject) serviceMethod.invoke( service,
- new Object[]
- {
- requestXBean
- } );
- }
- else
+ if ( !responseBodyElems.isEmpty() )
{
- responseXBean = (XmlObject) serviceMethod.invoke( service,
- new Object[0]);
+ msgContext.setProperty( WSRF_RESPONSE_XMLOBJECT_LIST,
responseBodyElems );
}
}
- catch ( InvocationTargetException ite )
+ catch ( Exception e )
{
- LOG.error( MSG.getMessage( Keys.ERROR_INVOKING_METHOD_ON_SERVICE,
- serviceMethod.getName(),
- serviceClass.getName(),
- ite.getCause() ) );
- throw ExceptionUtils.getRootCause( ite );
+ handleInternalServerError( e );
}
- return responseXBean;
+ return false; // short-circuit any remaining Handlers in chain
}
-
-
/**
* DOCUMENT_ME
*
@@ -330,45 +207,36 @@
*/
public boolean handleResponse( MessageContext messageContext )
{
- LOG.debug( MSG.getMessage( Keys.HANDLING_RESPONSE ) );
- SOAPEnvelope responseEnvelope = getResponseEnvelope(
(SOAPMessageContext) messageContext );
- List responseBodyElems = (List) messageContext.getProperty(
WSRF_RESPONSE_XMLOBJECT_LIST );
- LOG.debug( MSG.getMessage( Keys.FOUND_RESP_ELEMS, Integer.toString(
responseBodyElems.size() ) ) );
- if ( responseBodyElems != null )
+ try
{
- try
+ LOG.debug( MSG.getMessage( Keys.HANDLING_RESPONSE ) );
+ SOAPEnvelope responseEnvelope = getResponseEnvelope(
(SOAPMessageContext) messageContext );
+ List responseBodyElems = (List) messageContext.getProperty(
WSRF_RESPONSE_XMLOBJECT_LIST );
+ LOG.debug( MSG.getMessage( Keys.FOUND_RESP_ELEMS,
Integer.toString( responseBodyElems.size() ) ) );
+ if ( responseBodyElems != null )
{
- SOAPBody body = responseEnvelope.getBody();
+ SOAPBody responseBody = responseEnvelope.getBody();
for ( int i = 0; i < responseBodyElems.size(); i++ )
{
XmlObject responseBodyElem = (XmlObject)
responseBodyElems.get( i );
SOAPBodyElement[] soapBodyElements =
createSOAPBodyElements( responseBodyElem );
- for (int j = 0; j < soapBodyElements.length; j++)
+ for ( int j = 0; j < soapBodyElements.length; j++ )
{
SOAPBodyElement soapBodyElement = soapBodyElements[j];
- body.addChildElement( soapBodyElement );
- }
+ responseBody.addChildElement( soapBodyElement );
+ }
}
}
- catch ( Exception e )
+ if ( LOG.isDebugEnabled() )
{
- if ( e instanceof SOAPFaultException )
- {
- throw (SOAPFaultException) e;
- }
- else
- {
- e.printStackTrace();
- throw new JAXRPCException( MSG.getMessage(
Keys.UNEXPECTED_ERROR_WITH_EXCEPTION, e ) );
- }
+ LOG.debug( "The response envelope: \n" +
responseEnvelope.toString() );
}
}
-
- if(LOG.isDebugEnabled())
+ catch ( Exception e )
{
- LOG.debug("The response envelope: \n" +
responseEnvelope.toString());
+ handleInternalServerError( e );
}
- return true;
+ return false; // short-circuit any remaining Handlers in chain
}
/**
@@ -453,26 +321,164 @@
return ( soapMsg );
}
+ private void handleInternalServerError( Exception e )
+ {
+ if ( e instanceof SOAPFaultException )
+ {
+ throw (SOAPFaultException) e;
+ }
+ else
+ {
+ if ( LOG.isDebugEnabled() )
+ {
+ LOG.debug( MSG.getMessage( Keys.INTERNAL_SERVER_ERROR ) );
+ e.printStackTrace();
+ }
+ throw new FaultException( Soap1_1Constants.FAULT_SERVER,
MSG.getMessage( Keys.INTERNAL_SERVER_ERROR ) );
+ }
+ }
+
+ private XmlObject toDocumentXmlBean( XmlObject xBean )
+ throws XmlException
+ {
+ // TODO: probably should change method signatures to take types
instead of documents to avoid this
+ return XmlObject.Factory.parse( xBean.xmlText( new
XmlOptions().setSaveOuter() ) );
+ }
+
/**
- * @param soap_msg a SAAJ SOAP message
+ * Returns a facade-wrapped SOAPBody
*
- * @return
+ * @param envelope
+ *
+ * @return a facade-wrapped SOAPBody
+ *
+ * @throws XmlException
*/
- private SOAPEnvelope getEnvelope( SOAPMessage soap_msg )
+ private org.apache.ws.util.soap.Body getSoapBody( SOAPEnvelope envelope )
throws XmlException
{
- SOAPEnvelope soap_envelope = null;
+ org.apache.ws.util.soap.Envelope envelopeWrapper = null;
+ XmlObject envelopeDocXmlBean = XmlObject.Factory.parse(
envelope.toString() );
+ if ( envelopeDocXmlBean instanceof
org.w3.x2003.x05.soapEnvelope.EnvelopeDocument )
+ {
+ envelopeWrapper =
+ new org.apache.ws.util.soap.Envelope(
+ (org.w3.x2003.x05.soapEnvelope.EnvelopeDocument)
envelopeDocXmlBean );
+ }
+ else if ( envelopeDocXmlBean instanceof
org.xmlsoap.schemas.soap.envelope.EnvelopeDocument )
+ {
+ envelopeWrapper =
+ new org.apache.ws.util.soap.Envelope(
+
(org.xmlsoap.schemas.soap.envelope.EnvelopeDocument) envelopeDocXmlBean );
+ }
+ else
+ {
+ throw new IllegalArgumentException(
+ "Unknown version of SOAPEnvelope: " +
envelopeDocXmlBean.getClass().getName() );
+ }
+ return envelopeWrapper.getBody();
+ }
+
+ /**
+ * This method is used when there are no parameters to a method
+ *
+ * @param service The service to find the method on.
+ * @param methodNameFromAction The method name we are looking for.
+ *
+ * @return The Method object
+ */
+ private Method getServiceMethod( WsrfService service, String
methodNameFromAction )
+ {
+ Method serviceMethod = null;
+ LOG.debug( "Based on the request, looking for method named: " +
methodNameFromAction + " in service " +
+ service.getClass().getName() +
+ " with " +
+ 0 +
+ " param types" );
+ Method[] methods = service.getClass().getMethods();
+ for ( int i = 0; i < methods.length; i++ )
+ {
+ Method method = methods[i];
+ if ( method.getName().equals( methodNameFromAction ) )
+ {
+ if ( method.getParameterTypes().length == 0 )
+ {
+ serviceMethod = method;
+ break;
+ }
+ else
+ {
+ LOG.warn( "Found method named: " + methodNameFromAction +
" in service " +
+ service.getClass().getName() +
+ " with " +
+ method.getParameterTypes().length +
+ " param types, expected 0 param type." );
+ }
+ }
+ }
+
+ if ( serviceMethod == null )
+ {
+ throw new JAXRPCException( MSG.getMessage(
Keys.UNABLE_TO_FIND_METHOD_IN_SERVICE,
+ methodNameFromAction,
+ service.getClass().getName() ) );
+ }
+
+ LOG.debug( MSG.getMessage( Keys.FOUND_SERVICE_METHOD,
+ serviceMethod.getName() ) );
+ return serviceMethod;
+ }
+
+ private XmlObject invokeServiceMethod( Method serviceMethod, WsrfService
service, XmlObject requestXBean,
+ Class serviceClass )
+ throws Exception
+ {
+ XmlObject responseXBean = null;
try
{
- SOAPPart soap_part = soap_msg.getSOAPPart();
+ if ( requestXBean != null )
+ {
+ responseXBean = (XmlObject) serviceMethod.invoke( service,
+ new Object[]
+ {
+ requestXBean
+ } );
+ }
+ else
+ {
+ responseXBean = (XmlObject) serviceMethod.invoke( service,
+ new Object[0] );
+ }
+ }
+ catch ( InvocationTargetException ite )
+ {
+ LOG.error( MSG.getMessage( Keys.ERROR_INVOKING_METHOD_ON_SERVICE,
+ serviceMethod.getName(),
+ serviceClass.getName(),
+ ite.getCause() ) );
+ throw (Exception) ExceptionUtils.getRootCause( ite );
+ }
+ return responseXBean;
+ }
- soap_envelope = soap_part.getEnvelope();
+ /**
+ * @param soapMsg a SAAJ SOAP message
+ *
+ * @return
+ */
+ private SOAPEnvelope getEnvelope( SOAPMessage soapMsg )
+ {
+ SOAPEnvelope soapEnvelope;
+ try
+ {
+ SOAPPart soap_part = soapMsg.getSOAPPart();
+ soapEnvelope = soap_part.getEnvelope();
}
catch ( SOAPException soape )
{
+ throw new JAXRPCException( soape );
}
-
- return ( soap_envelope );
+ return ( soapEnvelope );
}
/**
@@ -480,6 +486,7 @@
*
* @param service
* @param requestXBean
+ *
* @return
*/
private Method getServiceMethod( WsrfService service,
@@ -494,7 +501,7 @@
Method serviceMethod = null;
String serviceMethodName =
service.getMethodNameMap().getMethodName(
XmlBeanUtils.getName( requestXBean ) );
- serviceMethod = getServiceMethod(service, serviceMethodName,
requestXBean);
+ serviceMethod = getServiceMethod( service, serviceMethodName,
requestXBean );
return serviceMethod;
}
@@ -505,22 +512,29 @@
* @param service
* @param serviceMethodName
* @param requestXBean
+ *
* @return
*/
- private Method getServiceMethod(WsrfService service, String
serviceMethodName, XmlObject requestXBean)
+ private Method getServiceMethod( WsrfService service, String
serviceMethodName, XmlObject requestXBean )
{
-
Method serviceMethod = null;
- LOG.debug("Based on the request, looking for method named: " +
serviceMethodName+ " in service " + service.getClass().getName()+ " with " + 1
+ " param type called: " + requestXBean == null ? "null" :
requestXBean.getClass().getName());
+ LOG.debug( "Based on the request, looking for method named: " +
serviceMethodName + " in service " +
+ service.getClass().getName() +
+ " with " +
+ 1 +
+ " param type called: " +
+ requestXBean ==
+ null ?
+ "null" : requestXBean.getClass().getName() );
Method[] methods = service.getClass().getMethods();
for ( int i = 0; i < methods.length; i++ )
{
Method method = methods[i];
- if ( method.getName().equals( serviceMethodName ))
+ if ( method.getName().equals( serviceMethodName ) )
{
- if( method.getParameterTypes().length == 1 )
+ if ( method.getParameterTypes().length == 1 )
{
- if( method.getParameterTypes()[0].isInstance( requestXBean
) ) //todo check if handles null
+ if ( method.getParameterTypes()[0].isInstance(
requestXBean ) ) //todo check if handles null
{
serviceMethod = method;
@@ -528,12 +542,23 @@
}
else
{
- LOG.warn("Found method named: " + serviceMethodName +
" in service " + service.getClass().getName()+ " with " + 1 + " param of type:
" + method.getParameterTypes()[0].getName() + " , however the request param
was: " + requestXBean.getClass().getName());
+ LOG.warn( "Found method named: " + serviceMethodName +
" in service " +
+ service.getClass().getName() +
+ " with " +
+ 1 +
+ " param of type: " +
+ method.getParameterTypes()[0].getName() +
+ " , however the request param was: " +
+ requestXBean.getClass().getName() );
}
}
else
{
- LOG.warn("Found method named: " + serviceMethodName + " in
service " + service.getClass().getName()+ " with " +
method.getParameterTypes().length + " param types, expected 1 param type.");
+ LOG.warn( "Found method named: " + serviceMethodName + "
in service " +
+ service.getClass().getName() +
+ " with " +
+ method.getParameterTypes().length +
+ " param types, expected 1 param type." );
}
}
}
@@ -579,5 +604,11 @@
resourceContext
} );
return service;
+ }
+
+ private String getHandlerOption( String optionName, String defaultValue )
+ {
+ Object value = m_handlerOptions.get( optionName );
+ return value != null ? value.toString() : defaultValue;
}
}
Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/i18n/Keys.java
URL:
http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/i18n/Keys.java?rev=170833&r1=170832&r2=170833&view=diff
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/i18n/Keys.java
(original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/i18n/Keys.java Wed
May 18 14:47:56 2005
@@ -167,9 +167,9 @@
String ERROR_INVOKING_METHOD_ON_SERVICE =
"ERROR_INVOKING_METHOD_ON_SERVICE";
/**
- * @msg Unexpected error. Cause: {0}
+ * @msg Internal server error occurred.
*/
- String UNEXPECTED_ERROR_WITH_EXCEPTION = "UNEXPECTED_ERROR_WITH_EXCEPTION";
+ String INTERNAL_SERVER_ERROR = "INTERNAL_SERVER_ERROR";
/**
* @msg Handling Response
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]