You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by pr...@apache.org on 2007/12/01 15:43:54 UTC
svn commit: r600141 [6/10] - in
/webservices/axis2/branches/java/jaxws21/modules: adb-codegen/
adb-codegen/src/org/apache/axis2/schema/
adb-codegen/src/org/apache/axis2/schema/template/
adb-codegen/src/org/apache/axis2/schema/util/ adb-codegen/src/org/...
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java Sat Dec 1 06:43:28 2007
@@ -485,7 +485,6 @@
* of performance.
*/
private void setupProperties(MessageContext mc) {//, Options ops) {
- Map<String, Object> properties = mc.getProperties();
// Enable MTOM
Message msg = mc.getMessage();
@@ -500,16 +499,16 @@
// Check to see if BASIC_AUTH is enabled. If so, make sure
// the properties are setup correctly.
- if (properties.containsKey(BindingProvider.USERNAME_PROPERTY) &&
- properties.containsKey(BindingProvider.PASSWORD_PROPERTY)) {
+ if (mc.containsKey(BindingProvider.USERNAME_PROPERTY) &&
+ mc.containsKey(BindingProvider.PASSWORD_PROPERTY)) {
- String userId = (String)properties.get(BindingProvider.USERNAME_PROPERTY);
+ String userId = (String)mc.getProperty(BindingProvider.USERNAME_PROPERTY);
if (userId == null || userId == "") {
throw ExceptionFactory
.makeWebServiceException(Messages.getMessage("checkUserName"));
}
- String password = (String)properties.get(BindingProvider.PASSWORD_PROPERTY);
+ String password = (String)mc.getProperty(BindingProvider.PASSWORD_PROPERTY);
if (password == null || password == "") {
throw ExceptionFactory
.makeWebServiceException(Messages.getMessage("checkPassword"));
@@ -517,8 +516,8 @@
URL url = null;
try {
- url = new URL((String)mc.getProperties()
- .get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY));
+ url = new URL((String)mc
+ .getProperty(BindingProvider.ENDPOINT_ADDRESS_PROPERTY));
}
catch (MalformedURLException e) {
throw ExceptionFactory.makeWebServiceException(e);
@@ -533,10 +532,10 @@
basicAuthentication.setPreemptiveAuthentication(true);
mc.setProperty(HTTPConstants.AUTHENTICATE, basicAuthentication);
- } else if ((!properties.containsKey(BindingProvider.USERNAME_PROPERTY) &&
- properties.containsKey(BindingProvider.PASSWORD_PROPERTY)) ||
- (properties.containsKey(BindingProvider.USERNAME_PROPERTY) &&
- !properties.containsKey(BindingProvider.PASSWORD_PROPERTY))) {
+ } else if ((!mc.containsKey(BindingProvider.USERNAME_PROPERTY) &&
+ mc.containsKey(BindingProvider.PASSWORD_PROPERTY)) ||
+ (mc.containsKey(BindingProvider.USERNAME_PROPERTY) &&
+ !mc.containsKey(BindingProvider.PASSWORD_PROPERTY))) {
throw ExceptionFactory
.makeWebServiceException(Messages.getMessage("checkUsernameAndPassword"));
}
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/InvocationController.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/InvocationController.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/InvocationController.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/InvocationController.java Sat Dec 1 06:43:28 2007
@@ -306,9 +306,8 @@
// response object
// back to the client app without calling
// AsyncResponse.processResponse or processFault
-
- throw ExceptionFactory
- .makeWebServiceException("A client outbound handler cause a message flow direction reversal. This case is not yet implemented.");
+
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("invokeAsyncErr"));
// throw new AxisFault(request.getMessage());
}
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerChainProcessor.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerChainProcessor.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerChainProcessor.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerChainProcessor.java Sat Dec 1 06:43:28 2007
@@ -122,15 +122,11 @@
// instanceof ProtocolHandler
protocolHandlers.add((SOAPHandler) handler);
else if (Handler.class.isAssignableFrom(handler.getClass())) {
- // TODO: NLS better error message
throw ExceptionFactory.makeWebServiceException(Messages
- .getMessage("handlerChainErr1", handler
- .getClass().getName()));
+ .getMessage("handlerChainErr1", handler.getClass().getName()));
} else {
- // TODO: NLS better error message
throw ExceptionFactory.makeWebServiceException(Messages
- .getMessage("handlerChainErr2", handler
- .getClass().getName()));
+ .getMessage("handlerChainErr2", handler.getClass().getName()));
}
}
@@ -543,7 +539,7 @@
mepCtx.setMessage(msg);
} else {
- throw ExceptionFactory.makeWebServiceException("We only support SOAP11 and SOAP12 for JAXWS handlers");
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("cFaultMsgErr"));
}
} catch (Exception ex) {
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerResolverImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerResolverImpl.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerResolverImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerResolverImpl.java Sat Dec 1 06:43:28 2007
@@ -18,8 +18,6 @@
*/
package org.apache.axis2.jaxws.handler;
-import org.apache.axis2.client.OperationClient;
-import org.apache.axis2.java.security.AccessController;
import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.core.MessageContext;
import org.apache.axis2.jaxws.description.EndpointDescription;
@@ -31,28 +29,21 @@
import org.apache.axis2.jaxws.handler.lifecycle.factory.HandlerLifecycleManagerFactory;
import org.apache.axis2.jaxws.i18n.Messages;
import org.apache.axis2.jaxws.registry.FactoryRegistry;
-import org.apache.axis2.jaxws.runtime.description.injection.ResourceInjectionServiceRuntimeDescription;
-import org.apache.axis2.jaxws.runtime.description.injection.impl.ResourceInjectionServiceRuntimeDescriptionBuilder;
+import org.apache.axis2.jaxws.spi.handler.BaseHandlerResolver;
+import org.apache.axis2.util.LoggingControl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import javax.xml.namespace.QName;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.handler.Handler;
-import javax.xml.ws.handler.HandlerResolver;
import javax.xml.ws.handler.LogicalHandler;
import javax.xml.ws.handler.PortInfo;
import javax.xml.ws.handler.soap.SOAPHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
+
/*
* This class should be created by the ServiceDelegate.
* HandlerResolverImpl.getHandlerChain(PortInfo) will be called by the
@@ -63,17 +54,8 @@
* starting each Handler's lifecycle according to JAX-WS spec 9.3.1
*/
-public class HandlerResolverImpl implements HandlerResolver {
+public class HandlerResolverImpl extends BaseHandlerResolver {
- // TODO should probably use constants defined elsewhere
- static final Map<String, String> protocolBindingsMap = new HashMap<String, String>(5);
- static {
- protocolBindingsMap.put("##SOAP11_HTTP", "http://schemas.xmlsoap.org/wsdl/soap/http");
- protocolBindingsMap.put("##SOAP11_HTTP_MTOM", "http://schemas.xmlsoap.org/wsdl/soap/http?mtom=true");
- protocolBindingsMap.put("##SOAP12_HTTP", "http://www.w3.org/2003/05/soap/bindings/HTTP/");
- protocolBindingsMap.put("##SOAP12_HTTP_MTOM", "http://www.w3.org/2003/05/soap/bindings/HTTP/?mtom=true");
- protocolBindingsMap.put("##XML_HTTP", "http://www.w3.org/2004/08/wsdl/http");
- }
private static Log log = LogFactory.getLog(HandlerResolverImpl.class);
/*
* TODO: is there any value/reason in caching the list we collect from the
@@ -91,7 +73,7 @@
this.serviceDesc = sd;
}
- public ArrayList<Handler> getHandlerChain(PortInfo portinfo) {
+ public List<Handler> getHandlerChain(PortInfo portinfo) {
// TODO: would check and/or build cache here if implemented later
return resolveHandlers(portinfo);
}
@@ -154,7 +136,7 @@
* with the PortInfo object before we add it to the chain.
*/
- HandlerChainsType handlerCT = serviceDesc.getHandlerChain();
+ handlerChainsType = serviceDesc.getHandlerChain();
// if there's a handlerChain on the serviceDesc, it means the WSDL defined an import for a HandlerChain.
// the spec indicates that if a handlerchain also appears on the SEI on the client.
EndpointDescription ed = null;
@@ -164,12 +146,12 @@
if (ed != null) {
HandlerChainsType handlerCT_fromEndpointDesc = ed.getHandlerChain();
- if (handlerCT == null) {
- handlerCT = handlerCT_fromEndpointDesc;
+ if (handlerChainsType == null) {
+ handlerChainsType = handlerCT_fromEndpointDesc;
}
}
- Iterator it = handlerCT == null ? null : handlerCT.getHandlerChain().iterator();
+ Iterator it = handlerChainsType == null ? null : handlerChainsType.getHandlerChain().iterator();
while ((it != null) && (it.hasNext())) {
HandlerChainType handlerChainType = ((HandlerChainType)it.next());
@@ -205,6 +187,11 @@
// TODO: NLS log and throw
throw ExceptionFactory.makeWebServiceException(e);
}
+
+ //TODO NLS
+ if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled())
+ log.debug("Successfully instantiated the class: " + handler.getClass());
+
// 9.2.1.2 sort them by Logical, then SOAP
if (LogicalHandler.class.isAssignableFrom(handler.getClass()))
handlers.add((LogicalHandler) handler);
@@ -233,143 +220,4 @@
.getFactory(HandlerLifecycleManagerFactory.class);
return elmf.createHandlerLifecycleManager();
}
-
- private static Class loadClass(String clazz) throws ClassNotFoundException {
- try {
- return forName(clazz, true, getContextClassLoader());
- } catch (ClassNotFoundException e) {
- throw e;
- }
- }
-
- /**
- * Return the class for this name
- *
- * @return Class
- */
- private static Class forName(final String className, final boolean initialize,
- final ClassLoader classLoader) throws ClassNotFoundException {
- // NOTE: This method must remain protected because it uses AccessController
- Class cl = null;
- try {
- cl = (Class)AccessController.doPrivileged(
- new PrivilegedExceptionAction() {
- public Object run() throws ClassNotFoundException {
- try{
- if (log.isDebugEnabled()) {
- log.debug("HandlerResolverImpl attempting to load Class: "+className);
- }
- return Class.forName(className, initialize, classLoader);
- } catch (Throwable e) {
- // TODO Should the exception be swallowed ?
- if (log.isDebugEnabled()) {
- log.debug("HandlerResolverImpl cannot load the following class Throwable Exception Occured: " + className);
- }
- throw new ClassNotFoundException("HandlerResolverImpl cannot load the following class Throwable Exception Occured:" + className);
- }
- }
- }
- );
- } catch (PrivilegedActionException e) {
- if (log.isDebugEnabled()) {
- log.debug("Exception thrown from AccessController: " + e);
- }
- throw (ClassNotFoundException)e.getException();
- }
-
- return cl;
- }
-
-
- /** @return ClassLoader */
- private static ClassLoader getContextClassLoader() {
- // NOTE: This method must remain private because it uses AccessController
- ClassLoader cl = null;
- try {
- cl = (ClassLoader)AccessController.doPrivileged(
- new PrivilegedExceptionAction() {
- public Object run() throws ClassNotFoundException {
- return Thread.currentThread().getContextClassLoader();
- }
- }
- );
- } catch (PrivilegedActionException e) {
- if (log.isDebugEnabled()) {
- log.debug("Exception thrown from AccessController: " + e);
- }
- throw ExceptionFactory.makeWebServiceException(e.getException());
- }
-
- return cl;
- }
-
-
- private static boolean chainResolvesToPort(HandlerChainType handlerChainType, PortInfo portinfo) {
-
- List<String> protocolBindings = handlerChainType.getProtocolBindings();
- if (protocolBindings != null) {
- boolean match = true;
- for (Iterator<String> it = protocolBindings.iterator() ; it.hasNext();) {
- match = false; // default to false in the protocol bindings until we find a match
- String protocolBinding = it.next();
- protocolBinding = protocolBinding.startsWith("##") ? protocolBindingsMap.get(protocolBinding) : protocolBinding;
- // if the protocolBindingsMap returns null, it would mean someone has some nonsense ##binding
- if ((protocolBinding != null) && (protocolBinding.equals(portinfo.getBindingID()))) {
- match = true;
- break;
- }
- }
- if (match == false) {
- // we've checked all the protocolBindings, but didn't find a match, no need to continue
- return match;
- }
- }
-
- /*
- * need to figure out how to get the namespace declaration out of the port-name-pattern and service-name-pattern
- */
-
- if (!doesPatternMatch(portinfo.getPortName(), handlerChainType.getPortNamePattern())) {
- // we've checked the port-name-pattern, and didn't find a match, no need to continue
- return false;
- }
-
- if (!doesPatternMatch(portinfo.getServiceName(), handlerChainType.getServiceNamePattern())) {
- // we've checked the service-name-pattern, and didn't find a match, no need to continue
- return false;
- }
-
- return true;
- }
-
- /*
- * A comparison routing to check service-name-pattern and port-name-pattern. These patterns may be of
- * the form:
- *
- * 1) namespace:localpart
- * 2) namespace:localpart*
- * 3) namespace:* (not sure about this one)
- * 4) * (which is equivalent to not specifying a pattern, therefore always matching)
- *
- * I've not seen any examples where the wildcard may be placed mid-string or on the namespace, such as:
- *
- * namespace:local*part
- * *:localpart
- *
- */
- private static boolean doesPatternMatch(QName portInfoQName, QName pattern) {
- if (pattern == null)
- return true;
- String portInfoString = portInfoQName.toString();
- String patternString = pattern.toString();
- if (patternString.equals("*"))
- return true;
- if (patternString.contains("*")) {
- patternString = patternString.substring(0, patternString.length() - 1);
- return portInfoString.startsWith(patternString);
- }
- return portInfoString.equals(patternString);
-
- }
-
}
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/handler/MEPContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/handler/MEPContext.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/handler/MEPContext.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/handler/MEPContext.java Sat Dec 1 06:43:28 2007
@@ -160,13 +160,13 @@
return getApplicationScopedProperties().containsKey(key);
}
if (responseMC != null) {
- boolean containsKey = responseMC.getProperties().containsKey(key) || requestMC.getProperties().containsKey(key);
+ boolean containsKey = responseMC.containsKey(key) || requestMC.containsKey(key);
if ((getScope((String)key) == Scope.APPLICATION) || (!isApplicationAccessLocked())) {
return containsKey;
}
}
if ((getScope((String)key) == Scope.APPLICATION) || (!isApplicationAccessLocked())) {
- return requestMC.getProperties().containsKey(key);
+ return requestMC.containsKey(key);
}
return false;
}
@@ -239,7 +239,7 @@
if (scopes.get(key) == null) { // check the scopes object directly, not through getScope()!!
setScope(key, Scope.HANDLER);
}
- if (requestMC.getProperties().containsKey(key)) {
+ if (requestMC.containsKey(key)) {
return requestMC.setProperty(key, value);
}
if (responseMC != null) {
@@ -273,6 +273,7 @@
}
// yes, remove from both and return the right object
+ // TODO This won't work because getProperties returns a temporary map
Object retVal = null;
if (responseMC != null) {
retVal = responseMC.getProperties().remove(key);
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/handler/SoapMessageContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/handler/SoapMessageContext.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/handler/SoapMessageContext.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/handler/SoapMessageContext.java Sat Dec 1 06:43:28 2007
@@ -18,6 +18,7 @@
*/
package org.apache.axis2.jaxws.handler;
+import org.apache.axiom.soap.RolePlayer;
import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.core.MessageContext;
import org.apache.axis2.jaxws.i18n.Messages;
@@ -39,6 +40,7 @@
import java.util.ArrayList;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -54,7 +56,7 @@
super(messageCtx);
}
- public Object[] getHeaders(QName qname, JAXBContext jaxbcontext, boolean flag) {
+ public Object[] getHeaders(QName qname, JAXBContext jaxbcontext, boolean allRoles) {
if(log.isDebugEnabled()){
log.debug("Getting all Headers for Qname: "+qname);
}
@@ -72,28 +74,43 @@
throw ExceptionFactory.makeWebServiceException(Messages.getMessage("SOAPMessageContextErr2"));
}
- if(flag == false){
- //TODO: Implement, In this case we need to only return headers targetted at roles
- // currently played by this SOAPNode.
-
- }
+ // The header information is returned as a list of jaxb objects
List<Object> list = new ArrayList<Object>();
String namespace = qname.getNamespaceURI();
String localPart = qname.getLocalPart();
- BlockFactory blockFactory = (JAXBBlockFactory)FactoryRegistry.getFactory(JAXBBlockFactory.class);
+ BlockFactory blockFactory = (JAXBBlockFactory)
+ FactoryRegistry.getFactory(JAXBBlockFactory.class);
Message m = messageCtx.getMessage();
JAXBBlockContext jbc = new JAXBBlockContext(jaxbcontext);
+
+ // If allRoles is not specified, pass in a set of roles.
+ // The headers must support that role.
+ RolePlayer rolePlayer = null;
+ if (allRoles == false) {
+ rolePlayer = getRolePlayer();
+ }
+
if(m.getNumHeaderBlocks()>0){
- Block hb = m.getHeaderBlock(namespace, localPart, jbc, blockFactory);
- if(hb!=null){
+ // Get the list of JAXB Blocks
+ List<Block> blockList = m.getHeaderBlocks(namespace,
+ localPart,
+ jbc,
+ blockFactory,
+ rolePlayer);
+
+ // Create list of JAXB objects
+ if(blockList!=null && blockList.size() > 0){
try{
-
- Object bo = hb.getBusinessObject(false);
- if(bo!=null){
- if(log.isDebugEnabled()){
- log.debug("Extracted BO from Header Block");
+ Iterator it = blockList.iterator();
+ while (it.hasNext()) {
+ Block block = (Block) it.next();
+ Object bo = block.getBusinessObject(false);
+ if(bo!=null){
+ if(log.isDebugEnabled()){
+ log.debug("Extracted BO from Header Block");
+ }
+ list.add(bo);
}
- list.add(bo);
}
}catch(XMLStreamException e){
@@ -144,6 +161,25 @@
messageCtx.getMEPContext().setMessage(msg);
} catch (XMLStreamException e) {
// TODO log it, and throw something?
+ }
+ }
+
+ private RolePlayer getRolePlayer() {
+ List roles = new ArrayList(getRoles());
+ return new SMCRolePlayer(roles);
+ }
+
+ class SMCRolePlayer implements RolePlayer {
+ private List roles;
+ SMCRolePlayer(List roles) {
+ this.roles = roles;
+ }
+
+ public List getRoles() {
+ return roles;
+ }
+ public boolean isUltimateDestination() {
+ return true;
}
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/handler/TransportHeadersAdapter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/handler/TransportHeadersAdapter.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/handler/TransportHeadersAdapter.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/handler/TransportHeadersAdapter.java Sat Dec 1 06:43:28 2007
@@ -18,6 +18,7 @@
*/
package org.apache.axis2.jaxws.handler;
+import org.apache.axis2.i18n.Messages;
import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.core.MessageContext;
import org.apache.axis2.transport.http.HTTPConstants;
@@ -143,8 +144,8 @@
l.add(o);
return l;
} else {
- throw ExceptionFactory.makeWebServiceException("Cannot convert from " + o.getClass()
- + " to List<String>");
+ throw ExceptionFactory.makeWebServiceException(
+ Messages.getMessage("inputConvertionErr",o.getClass().toString()));
}
}
@@ -162,8 +163,8 @@
return (String) l.get(0);
}
}
- throw ExceptionFactory.makeWebServiceException("Cannot convert from " + o.getClass()
- + " to String");
+ throw ExceptionFactory.makeWebServiceException(
+ Messages.getMessage("inputConvertionErr1",o.getClass().toString()));
}
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/factory/MethodMarshallerFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/factory/MethodMarshallerFactory.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/factory/MethodMarshallerFactory.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/factory/MethodMarshallerFactory.java Sat Dec 1 06:43:28 2007
@@ -22,6 +22,7 @@
import org.apache.axis2.jaxws.description.OperationDescription;
import org.apache.axis2.jaxws.description.ParameterDescription;
import org.apache.axis2.jaxws.description.ServiceDescription;
+import org.apache.axis2.jaxws.handler.HandlerResolverImpl;
import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitBareMethodMarshaller;
import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitBareMinimalMethodMarshaller;
@@ -32,6 +33,8 @@
import org.apache.axis2.jaxws.message.databinding.JAXBUtils;
import org.apache.axis2.jaxws.runtime.description.marshal.MarshalServiceRuntimeDescription;
import org.apache.axis2.jaxws.runtime.description.marshal.MarshalServiceRuntimeDescriptionFactory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.JAXBContext;
@@ -43,8 +46,9 @@
* SOAPBinding information
*/
public class MethodMarshallerFactory {
-
-
+
+ private static Log log = LogFactory.getLog(MethodMarshallerFactory.class);
+
private enum SUBTYPE {
NORMAL, PLUS, MINIMAL }
@@ -243,13 +247,18 @@
MarshalServiceRuntimeDescriptionFactory.get(serviceDesc);
String requestWrapper = marshalDesc.getRequestWrapperClassName(op);
if (!exists(requestWrapper)) {
- // TODO DEBUG
+ if(log.isDebugEnabled()){
+ log.debug("Request wrapper class name is NULL.");
+ }
return true;
}
- String responseWrapper = marshalDesc.getRequestWrapperClassName(op);
+ //String responseWrapper = marshalDesc.getRequestWrapperClassName(op);
+ String responseWrapper = marshalDesc.getResponseWrapperClassName(op);
if (!exists(responseWrapper)) {
- // TODO DEBUG
+ if(log.isDebugEnabled()){
+ log.debug("Response wrapper class name is NULL.");
+ }
return true;
}
// TODO Do the same for the fault beans
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMinimalMethodMarshaller.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMinimalMethodMarshaller.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMinimalMethodMarshaller.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMinimalMethodMarshaller.java Sat Dec 1 06:43:28 2007
@@ -90,16 +90,14 @@
//to a method then an implementation MUST throw WebServiceException.
if (pds.length > 0) {
if (signatureArguments == null) {
- throw ExceptionFactory.makeWebServiceException(Messages.getMessage(
- "NullParamErr1", "Input", operationDesc.getJavaMethodName(),
- "doc/lit"));
+ throw ExceptionFactory.makeWebServiceException(
+ Messages.getMessage("NullParamErr1",operationDesc.getJavaMethodName()));
}
if (signatureArguments != null) {
for (Object argument : signatureArguments) {
if (argument == null) {
- throw ExceptionFactory.makeWebServiceException(Messages.getMessage(
- "NullParamErr1", "Input", operationDesc.getJavaMethodName(),
- "doc/lit"));
+ throw ExceptionFactory.makeWebServiceException(
+ Messages.getMessage("NullParamErr1",operationDesc.getJavaMethodName()));
}
}
}
@@ -207,10 +205,8 @@
if (sigArguments != null) {
for (Object argument : sigArguments) {
if (argument == null) {
- throw ExceptionFactory.makeWebServiceException(Messages.getMessage(
- "NullParamErr1", "Input", operationDesc.getJavaMethodName(),
- "rpc/lit"));
-
+ throw ExceptionFactory.makeWebServiceException(
+ Messages.getMessage("NullParamErr2",operationDesc.getJavaMethodName()));
}
}
}
@@ -292,9 +288,8 @@
//As per JAXWS Specification section 3.6.2.3 if a null value is passes as an argument
//to a method then an implementation MUST throw WebServiceException.
if (returnObject == null) {
- throw ExceptionFactory.makeWebServiceException(Messages.getMessage(
- "NullParamErr1", "Return", operationDesc.getJavaMethodName(),
- "rpc/lit"));
+ throw ExceptionFactory.makeWebServiceException(
+ Messages.getMessage("NullParamErr3",operationDesc.getJavaMethodName()));
}
Element returnElement = null;
@@ -414,9 +409,8 @@
//As per JAXWS Specification section 3.6.2.3 if a null value is passes as an argument
//to a method then an implementation MUST throw WebServiceException.
if (returnValue == null) {
- throw ExceptionFactory.makeWebServiceException(Messages.getMessage(
- "NullParamErr1", "Return", operationDesc.getJavaMethodName(),
- "rpc/lit"));
+ throw ExceptionFactory.makeWebServiceException(
+ Messages.getMessage("NullParamErr3",operationDesc.getJavaMethodName()));
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/Element.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/Element.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/Element.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/Element.java Sat Dec 1 06:43:28 2007
@@ -22,12 +22,16 @@
import javax.xml.namespace.QName;
/**
- * Characteristics of the "Element" value. * The Element value is ready for marshalling or is the
- * result of unmarshalling. * The Element value represents the element rendering. Thus it is either
- * a JAXBElement or has the @XmlRootElement annotation. (i.e. it is never a java.lang.String) * The
- * Element value is not a JAX-WS object. (i.e. it is not a holder or exception) Characteristis of
- * the "Type" value * It is the type value associated with the element value. (Thus it is either
- * the element value or it is value of the JAXBElement * The type value is usually the object needed
+ * Characteristics of the "Element" value.
+ * The Element value is ready for marshalling or is the
+ * result of unmarshalling.
+ * The Element value represents the element rendering. Thus it is either
+ * a JAXBElement or has the @XmlRootElement annotation. (i.e. it is never a java.lang.String)
+ * The Element value is not a JAX-WS object. (i.e. it is not a holder or exception)
+ * Characteristics of the "Type" value
+ * It is the type value associated with the element value. (Thus it is either
+ * the element value or it is value of the JAXBElement
+ * The type value is usually the object needed
* for the method signature (i.e. String)
* <p/>
* Here is an example for illustration: <element name='e1'> <complexType>...</complexType>
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/LegacyExceptionUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/LegacyExceptionUtil.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/LegacyExceptionUtil.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/LegacyExceptionUtil.java Sat Dec 1 06:43:28 2007
@@ -150,14 +150,8 @@
log.debug("Completed creation of the fault bean.");
}
} else {
- //if (log.isErrorEnabled()) {
- // log.debug("The fault bean could not be loaded...Fallback to using the fault exception: " + t.getClass());
- //}
- //return t;
- throw ExceptionFactory
- .makeWebServiceException(Messages.getMessage("faultProcessingNotSupported",
- "the @WebFault faultbean is missing for " +
- t.getClass()));
+ throw ExceptionFactory.makeWebServiceException(
+ Messages.getMessage("faultProcessingNotSupported",t.getClass().getName()));
}
} catch (Exception e) {
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java Sat Dec 1 06:43:28 2007
@@ -225,10 +225,7 @@
null,
attachment);
} else {
- // TODO NLS and clean this up
- throw ExceptionFactory.
- makeWebServiceException("SWAREF and MTOM attachment parameters are not " +
- "supported in this style/use.");
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("pdElementErr"));
}
return pde;
}
@@ -344,10 +341,7 @@
pdeList.add(pde);
swaIndex++;
} else {
- // TODO NLS and clean this up
- throw ExceptionFactory.makeWebServiceException("SWAREF and MTOM " +
- "attachment parameters are not supported " +
- "in this style/use.");
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("pdElementErr"));
}
}
}
@@ -555,10 +549,7 @@
attachment.getContentID());
message.setDoingSWA(true);
} else {
- // TODO NLS and cleanup
- throw ExceptionFactory.
- makeWebServiceException("SWAREF and MTOM attachment parameters " +
- "are not supported in this style/use.");
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("pdElementErr"));
}
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/RPCLitMethodMarshaller.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/RPCLitMethodMarshaller.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/RPCLitMethodMarshaller.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/RPCLitMethodMarshaller.java Sat Dec 1 06:43:28 2007
@@ -90,16 +90,14 @@
//to a method then an implementation MUST throw WebServiceException.
if (pds.length > 0) {
if (signatureArguments == null) {
- throw ExceptionFactory.makeWebServiceException(Messages.getMessage(
- "NullParamErr1", "Input", operationDesc.getJavaMethodName(),
- "rpc/lit"));
+ throw ExceptionFactory.makeWebServiceException(
+ Messages.getMessage("NullParamErr2",operationDesc.getJavaMethodName()));
}
if (signatureArguments != null) {
for (Object argument : signatureArguments) {
if (argument == null) {
- throw ExceptionFactory.makeWebServiceException(Messages.getMessage(
- "NullParamErr1", "Input", operationDesc.getJavaMethodName(),
- "rpc/lit"));
+ throw ExceptionFactory.makeWebServiceException(
+ Messages.getMessage("NullParamErr2",operationDesc.getJavaMethodName()));
}
}
}
@@ -212,9 +210,8 @@
if (sigArguments != null) {
for (Object argument : sigArguments) {
if (argument == null) {
- throw ExceptionFactory.makeWebServiceException(Messages.getMessage(
- "NullParamErr1", "Input", operationDesc.getJavaMethodName(),
- "rpc/lit"));
+ throw ExceptionFactory.makeWebServiceException(
+ Messages.getMessage("NullParamErr2",operationDesc.getJavaMethodName()));
}
}
@@ -301,9 +298,8 @@
//As per JAXWS Specification section 3.6.2.3 if a null value is passes as an argument
//to a method then an implementation MUST throw WebServiceException.
if (returnObject == null) {
- throw ExceptionFactory.makeWebServiceException(Messages.getMessage(
- "NullParamErr1", "Return", operationDesc.getJavaMethodName(),
- "rpc/lit"));
+ throw ExceptionFactory.makeWebServiceException(
+ Messages.getMessage("NullParamErr3",operationDesc.getJavaMethodName()));
}
Element returnElement = null;
@@ -428,9 +424,8 @@
//As per JAXWS Specification section 3.6.2.3 if a null value is passes as an argument
//to a method then an implementation MUST throw WebServiceException.
if (returnValue == null) {
- throw ExceptionFactory.makeWebServiceException(Messages.getMessage(
- "NullParamErr1", "Return", operationDesc.getJavaMethodName(),
- "rpc/lit"));
+ throw ExceptionFactory.makeWebServiceException(
+ Messages.getMessage("NullParamErr3",operationDesc.getJavaMethodName()));
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/XMLPart.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/XMLPart.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/XMLPart.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/XMLPart.java Sat Dec 1 06:43:28 2007
@@ -19,6 +19,7 @@
package org.apache.axis2.jaxws.message;
import org.apache.axiom.om.OMElement;
+import org.apache.axiom.soap.RolePlayer;
import org.apache.axis2.jaxws.message.factory.BlockFactory;
import javax.jws.soap.SOAPBinding.Style;
@@ -29,6 +30,9 @@
import javax.xml.stream.XMLStreamWriter;
import javax.xml.ws.WebServiceException;
+import java.util.List;
+
+
/**
* XMLPart
*
@@ -260,7 +264,9 @@
public int getNumHeaderBlocks() throws WebServiceException;
/**
- * getHeaderBlock Get the header block with the specified name The BlockFactory and object context
+ * getHeaderBlock
+ * Get the firstheader block with the specified name.
+ * The BlockFactory and object context
* are passed in to help create the proper kind of block.
*
* @param namespace
@@ -273,6 +279,26 @@
public Block getHeaderBlock(String namespace, String localPart,
Object context,
BlockFactory blockFactory)
+ throws WebServiceException;
+
+ /**
+ * getHeaderBlock
+ * Get the header blocks with the specified name
+ * The BlockFactory and object context
+ * are passed in to help create the proper kind of block.
+ *
+ * @param namespace uri of header
+ * @param localPart local name of header
+ * @param context context for blockFactory
+ * @param blockFactory kind of factory (i.e. JAXB)
+ * @param RolePlayer determines acceptable roles (or null)
+ * @return List<Block>
+ * @throws WebServiceException
+ */
+ public List<Block> getHeaderBlocks(String namespace, String localPart,
+ Object context,
+ BlockFactory blockFactory,
+ RolePlayer rolePlayer)
throws WebServiceException;
/**
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SourceBlockImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SourceBlockImpl.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SourceBlockImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SourceBlockImpl.java Sat Dec 1 06:43:28 2007
@@ -136,6 +136,9 @@
throws XMLStreamException {
// Best solution is to use a StAXSource
+ // However StAXSource is not widely accepted.
+ // For now, a StreamSource is always returned
+ /*
if (staxSource != null) {
try {
// TODO Constructor should be statically cached for performance
@@ -145,6 +148,7 @@
} catch (Exception e) {
}
}
+ */
// TODO StreamSource is not performant...work is needed here to make this faster
Reader2Writer r2w = new Reader2Writer(reader);
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/BlockImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/BlockImpl.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/BlockImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/BlockImpl.java Sat Dec 1 06:43:28 2007
@@ -46,6 +46,7 @@
import java.io.StringReader;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
+import java.util.HashMap;
/**
* BlockImpl Abstract Base class for various Block Implementations.
@@ -73,6 +74,8 @@
protected BlockFactory factory;
protected boolean consumed = false;
protected Message parent;
+
+ private HashMap map = null; // OMDataSourceExt properties
/**
* A Block has the following components
@@ -493,4 +496,24 @@
XMLStreamWriter writer)
throws XMLStreamException, WebServiceException;
+ public Object getProperty(String key) {
+ if (map == null) {
+ return null;
+ }
+ return map.get(key);
+ }
+
+ public Object setProperty(String key, Object value) {
+ if (map == null) {
+ map = new HashMap();
+ }
+ return map.put(key, value);
+ }
+
+ public boolean hasProperty(String key) {
+ if (map == null) {
+ return false;
+ }
+ return map.containsKey(key);
+ }
}
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/MessageImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/MessageImpl.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/MessageImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/MessageImpl.java Sat Dec 1 06:43:28 2007
@@ -21,6 +21,7 @@
import org.apache.axiom.attachments.Attachments;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.RolePlayer;
import org.apache.axis2.Constants.Configuration;
import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.core.MessageContext;
@@ -412,6 +413,12 @@
return xmlPart.getHeaderBlock(namespace, localPart, context, blockFactory);
}
+ public List<Block> getHeaderBlocks(String namespace, String localPart,
+ Object context, BlockFactory blockFactory,
+ RolePlayer rolePlayer) throws WebServiceException {
+ return xmlPart.getHeaderBlocks(namespace, localPart, context, blockFactory, rolePlayer);
+ }
+
public int getNumBodyBlocks() throws WebServiceException {
return xmlPart.getNumBodyBlocks();
}
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLPartBase.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLPartBase.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLPartBase.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLPartBase.java Sat Dec 1 06:43:28 2007
@@ -21,6 +21,7 @@
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMXMLParserWrapper;
import org.apache.axiom.om.impl.builder.StAXBuilder;
+import org.apache.axiom.soap.RolePlayer;
import org.apache.axiom.soap.SOAP11Constants;
import org.apache.axiom.soap.SOAP12Constants;
import org.apache.axis2.jaxws.ExceptionFactory;
@@ -48,6 +49,8 @@
import javax.xml.stream.XMLStreamWriter;
import javax.xml.ws.WebServiceException;
import java.util.Iterator;
+import java.util.List;
+
/**
* XMLPartBase class for an XMLPart An XMLPart is an abstraction of the xml portion of the message.
@@ -149,7 +152,8 @@
// Okay
} else
if (qName.getNamespaceURI().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
- throw ExceptionFactory.makeWebServiceException("UNEXPECTED"); // TODO NLS
+ throw ExceptionFactory.
+ makeWebServiceException(Messages.getMessage("restWithSOAPErr"));
} else {
content = _createSpine(Protocol.rest, Style.DOCUMENT, 0, root);
contentType = SPINE;
@@ -516,7 +520,8 @@
}
/* (non-Javadoc)
- * @see org.apache.axis2.jaxws.message.XMLPart#getHeaderBlock(java.lang.String, java.lang.String, java.lang.Object, org.apache.axis2.jaxws.message.factory.BlockFactory)
+ * @see org.apache.axis2.jaxws.message.XMLPart#getHeaderBlock(java.lang.String,
+ * java.lang.String, java.lang.Object, org.apache.axis2.jaxws.message.factory.BlockFactory)
*/
public Block getHeaderBlock(String namespace, String localPart, Object context,
BlockFactory blockFactory) throws WebServiceException {
@@ -526,6 +531,22 @@
block.setParent(getParent());
}
return block;
+ }
+
+
+
+ public List<Block> getHeaderBlocks(String namespace, String localPart,
+ Object context, BlockFactory blockFactory,
+ RolePlayer rolePlayer) throws WebServiceException {
+ List<Block> blocks =
+ getContentAsXMLSpine().getHeaderBlocks(namespace, localPart,
+ context, blockFactory, rolePlayer);
+ for(Block block:blocks) {
+ if (block != null) {
+ block.setParent(getParent());
+ }
+ }
+ return blocks;
}
/* (non-Javadoc)
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLSpine.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLSpine.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLSpine.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLSpine.java Sat Dec 1 06:43:28 2007
@@ -19,6 +19,7 @@
package org.apache.axis2.jaxws.message.impl;
import org.apache.axiom.om.OMElement;
+import org.apache.axiom.soap.RolePlayer;
import org.apache.axis2.jaxws.message.Block;
import org.apache.axis2.jaxws.message.Message;
import org.apache.axis2.jaxws.message.Protocol;
@@ -32,6 +33,8 @@
import javax.xml.stream.XMLStreamWriter;
import javax.xml.ws.WebServiceException;
+import java.util.List;
+
/**
* XMLSpine
* <p/>
@@ -196,7 +199,8 @@
public int getNumHeaderBlocks() throws WebServiceException;
/**
- * getHeaderBlock Get the header block with the specified name The BlockFactory and object
+ * getHeaderBlock Get the first header block with the specified name.
+ * The BlockFactory and object
* context are passed in to help create the proper kind of block.
*
* @param namespace
@@ -209,6 +213,27 @@
public Block getHeaderBlock(String namespace, String localPart,
Object context,
BlockFactory blockFactory)
+ throws WebServiceException;
+
+ /**
+ * getHeaderBlock
+ * Get the header blocks with the specified name.
+ * The BlockFactory and object
+ * context are passed in to help create the proper kind of block.
+ *
+ * @param namespace
+ * @param localPart
+ * @param context
+ * @param blockFactory
+ * @param rolePlayer(if set) indicates the Roles that should be considered
+ * @return Block
+ * @throws WebServiceException
+ */
+ public List<Block> getHeaderBlocks(String namespace,
+ String localPart,
+ Object context,
+ BlockFactory blockFactory,
+ RolePlayer rolePlayer)
throws WebServiceException;
/**
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLSpineImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLSpineImpl.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLSpineImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLSpineImpl.java Sat Dec 1 06:43:28 2007
@@ -24,7 +24,7 @@
import org.apache.axiom.om.OMNode;
import org.apache.axiom.om.impl.OMContainerEx;
import org.apache.axiom.om.impl.llom.OMElementImpl;
-import org.apache.axiom.om.impl.llom.OMSourcedElementImpl;
+import org.apache.axiom.soap.RolePlayer;
import org.apache.axiom.soap.SOAP11Constants;
import org.apache.axiom.soap.SOAP12Constants;
import org.apache.axiom.soap.SOAPBody;
@@ -33,6 +33,7 @@
import org.apache.axiom.soap.SOAPFault;
import org.apache.axiom.soap.SOAPFaultDetail;
import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axiom.soap.SOAPHeaderBlock;
import org.apache.axiom.soap.impl.llom.soap11.SOAP11Factory;
import org.apache.axiom.soap.impl.llom.soap12.SOAP12Factory;
import org.apache.axis2.jaxws.ExceptionFactory;
@@ -58,7 +59,11 @@
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
import javax.xml.ws.WebServiceException;
+
+import java.util.ArrayList;
import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
/**
* XMLSpineImpl
@@ -340,8 +345,11 @@
// The block is supposed to represent a single element.
// But if it does not represent an element , the following will fail.
QName qName = block.getQName();
+ OMNamespace ns = soapFactory.createOMNamespace(qName.getNamespaceURI(),
+ qName.getPrefix());
- OMElement newOM = _createOMElementFromBlock(qName, block, soapFactory);
+ OMElement newOM = _createOMElementFromBlock(qName.getLocalPart(), ns, block,
+ soapFactory, false);
if (om == null) {
bElement.addChild(newOM);
} else {
@@ -372,16 +380,22 @@
// The block is supposed to represent a single element.
// But if it does not represent an element , the following will fail.
QName qName = block.getQName();
+ OMNamespace ns = soapFactory.createOMNamespace(qName.getNamespaceURI(),
+ qName.getPrefix());
- OMElement newOM = _createOMElementFromBlock(qName, block, soapFactory);
+ OMElement newOM = _createOMElementFromBlock(qName.getLocalPart(), ns,
+ block, soapFactory, false);
bElement.addChild(newOM);
} else {
// This needs to be fixed, but for now we will require that there must be an
// element...otherwise no block is added
try {
QName qName = block.getQName();
+ OMNamespace ns = soapFactory.createOMNamespace(qName.getNamespaceURI(),
+ qName.getPrefix());
- OMElement newOM = _createOMElementFromBlock(qName, block, soapFactory);
+ OMElement newOM = _createOMElementFromBlock(qName.getLocalPart(), ns,
+ block, soapFactory, false);
bElement.addChild(newOM);
} catch (Throwable t) {
if (log.isDebugEnabled()) {
@@ -416,11 +430,45 @@
return this._getBlockFromOMElement(om, context, blockFactory, false);
}
+ public List<Block> getHeaderBlocks(String namespace,
+ String localPart,
+ Object context,
+ BlockFactory blockFactory,
+ RolePlayer rolePlayer) throws WebServiceException {
+ List<Block> blocks = new ArrayList<Block>();
+
+ // Get the list of OMElements that have the same header name
+ SOAPHeader header = root.getHeader();
+ if (header == null) {
+ return blocks;
+ }
+
+ // Get an iterator over the headers that have a acceptable role
+ Iterator it = null;
+ if (rolePlayer == null) {
+ it = header.getChildElements();
+ } else {
+ it = header.getHeadersToProcess(rolePlayer);
+ }
+ while (it.hasNext()) {
+ OMElement om = (OMElement) it.next();
+ // Create a block out of each header that matches
+ // the requested namespace/localPart
+ if (om.getNamespace().getNamespaceURI().equals(namespace) &&
+ om.getLocalName().equals(localPart)) {
+ Block block = _getBlockFromOMElement(om, context, blockFactory, false);
+ blocks.add(block);
+ }
+ }
+ return blocks;
+ }
+
public void setHeaderBlock(String namespace, String localPart, Block block)
throws WebServiceException {
block.setParent(getParent());
+ OMNamespace ns = soapFactory.createOMNamespace(namespace, null);
OMElement newOM =
- _createOMElementFromBlock(new QName(namespace, localPart), block, soapFactory);
+ _createOMElementFromBlock(localPart, ns, block, soapFactory, true);
OMElement om = this._getChildOMElement(root.getHeader(), namespace, localPart);
if (om == null) {
if (root.getHeader() == null) {
@@ -481,6 +529,15 @@
boolean setComplete) throws WebServiceException {
try {
QName qName = om.getQName();
+ OMNamespace ns = om.getNamespace();
+
+ // Save the ROLE
+ // TODO Need to do the same for RELAY and MUSTUNDERSTAND
+ String role = null;
+ if (om instanceof SOAPHeaderBlock) {
+ role = ((SOAPHeaderBlock)om).getRole();
+ }
+
/* TODO We could gain performance if OMSourcedElement exposed a getDataSource method
if (om instanceof OMSourcedElementImpl &&
((OMSourcedElementImpl) om).getDataSource() instanceof Block) {
@@ -500,12 +557,16 @@
// Create the block
Block block = blockFactory.createFrom(om, context, qName);
block.setParent(getParent());
+ if (om instanceof SOAPHeaderBlock) {
+ block.setProperty(SOAPHeaderBlock.ROLE_PROPERTY, role);
+ }
// Get the business object to force a parse
block.getBusinessObject(false);
// Replace the OMElement with the OMSourcedElement that delegates to the block
- OMElement newOM = _createOMElementFromBlock(qName, block, soapFactory);
+ OMElement newOM = _createOMElementFromBlock(qName.getLocalPart(), ns, block, soapFactory,
+ (om.getParent() instanceof SOAPHeader));
om.insertSiblingBefore(newOM);
// We want to set the om element and its parents to complete to
@@ -556,9 +617,14 @@
}
}
- private static OMElement _createOMElementFromBlock(QName qName, Block b,
- SOAPFactory soapFactory) {
- return new OMSourcedElementImpl(qName, soapFactory, b);
+ private static OMElement _createOMElementFromBlock(String localName, OMNamespace ns, Block b,
+ SOAPFactory soapFactory, boolean isHeaderBlock) {
+ if (isHeaderBlock) {
+ return soapFactory.createSOAPHeaderBlock(localName, ns, b);
+ } else {
+ return soapFactory.createOMElement(b, localName, ns);
+ }
+
}
/**
@@ -673,7 +739,8 @@
* Get the child om at the indicated index
*
* @param om
- * @param index
+ * @param namespace,
+ * @param localPart
* @return child om or null
*/
private static OMElement _getChildOMElement(OMElement om, String namespace,
@@ -688,5 +755,4 @@
}
return null;
}
-
}
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/util/MessageUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/util/MessageUtils.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/util/MessageUtils.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/util/MessageUtils.java Sat Dec 1 06:43:28 2007
@@ -40,6 +40,7 @@
import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.handler.AttachmentsAdapter;
import org.apache.axis2.jaxws.handler.TransportHeadersAdapter;
+import org.apache.axis2.jaxws.i18n.Messages;
import org.apache.axis2.jaxws.message.Message;
import org.apache.axis2.jaxws.message.Protocol;
import org.apache.axis2.jaxws.message.attachments.AttachmentUtils;
@@ -154,7 +155,8 @@
Protocol protocol = msgContext.isDoingREST() ? Protocol.rest : null;
message = msgFactory.createFrom(soapEnv, protocol);
} catch (Exception e) {
- throw ExceptionFactory.makeWebServiceException("Could not create new Message");
+ throw ExceptionFactory.makeWebServiceException(
+ Messages.getMessage("msgFromMsgErr"), e);
}
Object property = msgContext.getProperty(Constants.Configuration.ENABLE_MTOM);
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/injection/impl/ResourceInjectionServiceRuntimeDescriptionBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/injection/impl/ResourceInjectionServiceRuntimeDescriptionBuilder.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/injection/impl/ResourceInjectionServiceRuntimeDescriptionBuilder.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/injection/impl/ResourceInjectionServiceRuntimeDescriptionBuilder.java Sat Dec 1 06:43:28 2007
@@ -25,6 +25,9 @@
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.annotation.Resource;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.security.PrivilegedAction;
@@ -73,13 +76,13 @@
// Getting this information is expensive, but fortunately is cached.
List<Field> fields = getFields(implClass);
for (Field field : fields) {
- if (field.getAnnotation(Resource.class) != null) {
+ if (getAnnotation(field,Resource.class) != null) {
return true;
}
}
List<Method> methods = getMethods(implClass);
for (Method method : methods) {
- if (method.getAnnotation(Resource.class) != null) {
+ if (getAnnotation(method,Resource.class) != null) {
return true;
}
}
@@ -90,7 +93,7 @@
static private Method getPostConstructMethod(Class implClass) {
List<Method> methods = getMethods(implClass);
for (Method method : methods) {
- if (method.getAnnotation(PostConstruct.class) != null) {
+ if (getAnnotation(method,PostConstruct.class) != null) {
return method;
}
}
@@ -100,7 +103,7 @@
static private Method getPreDestroyMethod(Class implClass) {
List<Method> methods = getMethods(implClass);
for (Method method : methods) {
- if (method.getAnnotation(PreDestroy.class) != null) {
+ if (getAnnotation(method,PreDestroy.class) != null) {
return method;
}
}
@@ -163,5 +166,19 @@
);
return methods;
+ }
+
+ /**
+ * Get an annotation. This is wrappered to avoid a Java2Security violation.
+ * @param cls Class that contains annotation
+ * @param annotation Class of requrested Annotation
+ * @return annotation or null
+ */
+ private static Annotation getAnnotation(final AnnotatedElement element, final Class annotation) {
+ return (Annotation) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return element.getAnnotation(annotation);
+ }
+ });
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/EndpointController.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/EndpointController.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/EndpointController.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/EndpointController.java Sat Dec 1 06:43:28 2007
@@ -99,7 +99,7 @@
eic.setResponseMessageContext(response);
}
else {
- throw ExceptionFactory.makeWebServiceException("No dispatcher found.");
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("invokeErr"));
}
} catch (Exception e) {
throw ExceptionFactory.makeWebServiceException(e);
@@ -131,7 +131,7 @@
dispatcher.invokeAsync(request, eic.getCallback());
}
else {
- throw ExceptionFactory.makeWebServiceException("No dispatcher found.");
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("invokeErr"));
}
} catch (Exception e) {
throw ExceptionFactory.makeWebServiceException(e);
@@ -162,7 +162,7 @@
dispatcher.invokeOneWay(request);
}
else {
- throw ExceptionFactory.makeWebServiceException("No dispatcher found.");
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("invokeErr"));
}
} catch (Exception e) {
throw ExceptionFactory.makeWebServiceException(e);
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaBeanDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaBeanDispatcher.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaBeanDispatcher.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaBeanDispatcher.java Sat Dec 1 06:43:28 2007
@@ -248,8 +248,7 @@
OperationDescription opDesc = mc.getOperationDescription();
if (opDesc == null) {
- // TODO: NLS
- throw ExceptionFactory.makeWebServiceException("Operation Description was not set");
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("proxyErr3"));
}
Method returnMethod = opDesc.getMethodFromServiceImpl(serviceImplClass);
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java Sat Dec 1 06:43:28 2007
@@ -533,8 +533,7 @@
if (interfaceName == javax.xml.ws.Provider.class) {
if (paramType.getActualTypeArguments().length > 1) {
- //TODO NLS
- throw ExceptionFactory.makeWebServiceException("Provider cannot have more than one Generic Types defined as Per JAX-WS Specification");
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("pTypeErr"));
}
providerType = (Class)paramType.getActualTypeArguments()[0];
}
@@ -588,8 +587,8 @@
_blockFactory = (SOAPEnvelopeBlockFactory)FactoryRegistry.getFactory(
SOAPEnvelopeBlockFactory.class);
} else {
- throw ExceptionFactory.makeWebServiceException("Unable to find BlockFactory " +
- "for type: " + type.getClass().getName());
+ throw ExceptionFactory.makeWebServiceException(
+ Messages.getMessage("bFactoryErr",type.getClass().getName()));
}
return _blockFactory;
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/EndpointImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/EndpointImpl.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/EndpointImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/EndpointImpl.java Sat Dec 1 06:43:28 2007
@@ -28,6 +28,7 @@
import org.apache.axis2.jaxws.description.EndpointDescription;
import org.apache.axis2.jaxws.description.ServiceDescription;
import org.apache.axis2.jaxws.description.ServiceDescriptionWSDL;
+import org.apache.axis2.jaxws.i18n.Messages;
import org.apache.axis2.transport.http.HTTPWorkerFactory;
import org.apache.axis2.transport.http.server.SimpleHttpServer;
import org.apache.axis2.transport.http.server.WorkerFactory;
@@ -66,7 +67,8 @@
private void initialize() {
if (implementor == null) {
- throw ExceptionFactory.makeWebServiceException("The implementor object cannot be null");
+
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("initErr"));
}
// If we don't have the necessary metadata, let's go ahead and
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/Utils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/Utils.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/Utils.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/Utils.java Sat Dec 1 06:43:28 2007
@@ -27,6 +27,7 @@
import org.apache.axis2.jaxws.description.EndpointInterfaceDescription;
import org.apache.axis2.jaxws.description.OperationDescription;
import org.apache.axis2.jaxws.description.ServiceDescription;
+import org.apache.axis2.jaxws.i18n.Messages;
import org.apache.axis2.jaxws.message.Message;
import org.apache.axis2.jaxws.message.Protocol;
import org.apache.axis2.jaxws.message.XMLFault;
@@ -171,14 +172,12 @@
// That means that overloading of wsdl operations is not supported (although that's not supported in
// WSDL 1.1 anyway).
if (ops == null || ops.length == 0) {
- // TODO: RAS & NLS
- throw ExceptionFactory.makeWebServiceException("No operation found. WSDL Operation name: "
- + mc.getOperationName());
+ throw ExceptionFactory.makeWebServiceException(
+ Messages.getMessage("oprDescrErr",mc.getOperationName().toString()));
}
if (ops.length > 1) {
- // TODO: RAS & NLS
- throw ExceptionFactory.makeWebServiceException("More than one operation found. Overloaded WSDL operations are not supported. WSDL Operation name: "
- + mc.getOperationName());
+ throw ExceptionFactory.makeWebServiceException(
+ Messages.getMessage("oprDescrErr1",mc.getOperationName().toString()));
}
op = ops[0];
if (log.isDebugEnabled()) {
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/injection/impl/WebServiceContextInjectorImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/injection/impl/WebServiceContextInjectorImpl.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/injection/impl/WebServiceContextInjectorImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/endpoint/injection/impl/WebServiceContextInjectorImpl.java Sat Dec 1 06:43:28 2007
@@ -126,8 +126,7 @@
*/
public void injectOnClass(Object resource, Object instance, Class clazz)
throws ResourceInjectionException {
- throw new UnsupportedOperationException(
- "WebServiceContext Injeciton on Class not yet supported");
+ throw new UnsupportedOperationException(Messages.getMessage("injectOnClsErr"));
}
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java Sat Dec 1 06:43:28 2007
@@ -382,9 +382,8 @@
DescriptionFactory.updateEndpoint(serviceDescription, sei, portName,
DescriptionFactory.UpdateType.GET_PORT);
if (endpointDesc == null) {
- // TODO: NLS
throw ExceptionFactory.makeWebServiceException(
- "Unable to getPort for port QName " + portName);
+ Messages.getMessage("portErr",portName.toString()));
}
String[] interfacesNames =
@@ -403,8 +402,7 @@
try {
interfaces = loadClasses(classLoader, interfacesNames);
} catch (ClassNotFoundException e2) {
- // TODO: NLS
- throw ExceptionFactory.makeWebServiceException("Unable to load proxy classes", e2);
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("portErr1"), e2);
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/spi/migrator/ApplicationContextMigratorUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/spi/migrator/ApplicationContextMigratorUtil.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/spi/migrator/ApplicationContextMigratorUtil.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/spi/migrator/ApplicationContextMigratorUtil.java Sat Dec 1 06:43:28 2007
@@ -23,6 +23,7 @@
import org.apache.axis2.jaxws.core.MessageContext;
import org.apache.axis2.jaxws.description.ServiceDescription;
import org.apache.axis2.jaxws.handler.MEPContext;
+import org.apache.axis2.jaxws.i18n.Messages;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -91,7 +92,8 @@
Map<String, Object> requestContext,
MessageContext messageContext) {
if (messageContext == null) {
- throw ExceptionFactory.makeWebServiceException("Null MessageContext");
+
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("nullMsgCtxErr"));
}
ServiceDescription sd = messageContext.getEndpointDescription().getServiceDescription();
@@ -133,7 +135,7 @@
Map<String, Object> responseContext,
MessageContext messageContext) {
if (messageContext == null) {
- throw ExceptionFactory.makeWebServiceException("Null MessageContext");
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("nullMsgCtxErr"));
}
ServiceDescription sd = messageContext.getEndpointDescription().getServiceDescription();
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/utility/ClassUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/utility/ClassUtils.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/utility/ClassUtils.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/utility/ClassUtils.java Sat Dec 1 06:43:28 2007
@@ -18,6 +18,7 @@
*/
package org.apache.axis2.jaxws.utility;
+import org.apache.axis2.java.security.AccessController;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -27,8 +28,12 @@
import javax.xml.ws.WebFault;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceProvider;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
+import java.security.PrivilegedAction;
import java.util.HashMap;
/** Contains static Class utility methods related to method parameter/argument marshalling. */
@@ -245,25 +250,26 @@
// Or the class is in the jaxws.xml.ws package
// Check for Impl
- WebService wsAnn = (WebService)cls.getAnnotation(WebService.class);
+ WebService wsAnn = (WebService)getAnnotation(cls,WebService.class);
if (wsAnn != null) {
return true;
}
// Check for service
- WebServiceClient wscAnn = (WebServiceClient)cls.getAnnotation(WebServiceClient.class);
+ WebServiceClient wscAnn = (WebServiceClient)getAnnotation(cls,WebServiceClient.class);
if (wscAnn != null) {
return true;
}
// Check for provider
- WebServiceProvider wspAnn = (WebServiceProvider)cls.getAnnotation(WebServiceProvider.class);
+ WebServiceProvider wspAnn = (WebServiceProvider)
+ getAnnotation(cls,WebServiceProvider.class);
if (wspAnn != null) {
return true;
}
// Check for Exception
- WebFault wfAnn = (WebFault)cls.getAnnotation(WebFault.class);
+ WebFault wfAnn = (WebFault)getAnnotation(cls,WebFault.class);
if (wfAnn != null) {
return true;
}
@@ -283,6 +289,18 @@
}
return false;
}
-
+ /**
+ * Get an annotation. This is wrappered to avoid a Java2Security violation.
+ * @param cls Class that contains annotation
+ * @param annotation Class of requrested Annotation
+ * @return annotation or null
+ */
+ private static Annotation getAnnotation(final AnnotatedElement element, final Class annotation) {
+ return (Annotation) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return element.getAnnotation(annotation);
+ }
+ });
+ }
}
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/utility/PropertyDescriptorPlus.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/utility/PropertyDescriptorPlus.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/utility/PropertyDescriptorPlus.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/utility/PropertyDescriptorPlus.java Sat Dec 1 06:43:28 2007
@@ -91,10 +91,7 @@
*/
public Object get(Object targetBean) throws InvocationTargetException, IllegalAccessException {
if(descriptor == null){
- if(log.isDebugEnabled()){
- log.debug("Null Descriptor");
- }
- throw new RuntimeException("PropertyDescriptor not found");
+ throw new RuntimeException(Messages.getMessage("pDescrErr"));
}
Method method = descriptor.getReadMethod();
if(method == null && descriptor.getPropertyType() == Boolean.class){
@@ -110,16 +107,13 @@
method = targetBean.getClass().getMethod(methodName, null);
}catch(NoSuchMethodException e){
if(log.isDebugEnabled()){
- log.debug("Mehtod not found" + methodName);
+ log.debug("Method not found" + methodName);
}
}
}
}
if(method == null){
- if(log.isDebugEnabled()){
- log.debug("No read Method found to read propertyvalue");
- }
- throw new RuntimeException("No read Method found to read property Value from jaxbObject: "+targetBean.getClass().getName());
+ throw new RuntimeException(Messages.getMessage("pDescrErr2",targetBean.getClass().getName()));
}
return method.invoke(targetBean, null);
}
@@ -184,7 +178,6 @@
if(paramTypes !=null && paramTypes.length ==1){
Class paramType = paramTypes[0];
if(paramType.isPrimitive() && propValue == null){
- // TODO NLS
//Ignoring null value for primitive type, this could potentially be the way of a customer indicating to set
//default values defined in JAXBObject/xmlSchema.
if(DEBUG_ENABLED){
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org