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/06/27 18:46:04 UTC
svn commit: r551228 [6/23] - in /webservices/axis2/branches/java/jaxws21: ./
etc/ modules/adb-codegen/src/org/apache/axis2/schema/
modules/adb-codegen/src/org/apache/axis2/schema/template/
modules/adb-codegen/src/org/apache/axis2/schema/writer/ modules...
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/async/AsyncUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/async/AsyncUtils.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/async/AsyncUtils.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/async/AsyncUtils.java Wed Jun 27 09:45:37 2007
@@ -48,6 +48,7 @@
// Create the JAX-WS response MessageContext from the Axis2 response
response = new MessageContext(mc);
+ // don't set the response.setMEPContext() here.
// REVIEW: Are we on the final thread of execution here or does this get handed off to the executor?
// TODO: Remove workaround for WS-Addressing running in thin client (non-server) environment
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/async/CallbackFuture.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/async/CallbackFuture.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/async/CallbackFuture.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/async/CallbackFuture.java Wed Jun 27 09:45:37 2007
@@ -98,6 +98,8 @@
try {
response = AsyncUtils.createJAXWSMessageContext(result);
response.setInvocationContext(invocationCtx);
+ // make sure request and response contexts share a single parent
+ response.setMEPContext(invocationCtx.getRequestMessageContext().getMEPContext());
} catch (WebServiceException e) {
cft.setError(e);
if (debug) {
@@ -125,8 +127,9 @@
try {
faultMessageContext = AsyncUtils.createJAXWSMessageContext(fault.getFaultMessageContext());
faultMessageContext.setInvocationContext(invocationCtx);
- }
- catch (WebServiceException wse) {
+ // make sure request and response contexts share a single parent
+ faultMessageContext.setMEPContext(invocationCtx.getRequestMessageContext().getMEPContext());
+ } catch (WebServiceException wse) {
cft.setError(wse);
}
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/async/PollingFuture.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/async/PollingFuture.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/async/PollingFuture.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/async/PollingFuture.java Wed Jun 27 09:45:37 2007
@@ -56,6 +56,8 @@
try {
responseMsgCtx = AsyncUtils.createJAXWSMessageContext(result);
responseMsgCtx.setInvocationContext(invocationCtx);
+ // make sure request and response contexts share a single parent
+ responseMsgCtx.setMEPContext(invocationCtx.getRequestMessageContext().getMEPContext());
} catch (WebServiceException e) {
response.onError(e, null);
if (debug) {
@@ -83,8 +85,9 @@
faultMessageContext =
AsyncUtils.createJAXWSMessageContext(fault.getFaultMessageContext());
faultMessageContext.setInvocationContext(invocationCtx);
- }
- catch (WebServiceException wse) {
+ // make sure request and response contexts share a single parent
+ faultMessageContext.setMEPContext(invocationCtx.getRequestMessageContext().getMEPContext());
+ } catch (WebServiceException wse) {
response.onError(wse, null);
}
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/BaseDispatch.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/BaseDispatch.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/BaseDispatch.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/BaseDispatch.java Wed Jun 27 09:45:37 2007
@@ -120,6 +120,20 @@
MessageContext requestMsgCtx = new MessageContext();
requestMsgCtx.setEndpointDescription(getEndpointDescription());
invocationContext.setRequestMessageContext(requestMsgCtx);
+
+ /*
+ * TODO: review: make sure the handlers are set on the InvocationContext
+ * This implementation of the JAXWS runtime does not use Endpoint, which
+ * would normally be the place to initialize and store the handler list.
+ * In lieu of that, we will have to intialize and store them on the
+ * InvocationContext. also see the InvocationContextFactory. On the client
+ * side, the binding is not yet set when we call into that factory, so the
+ * handler list doesn't get set on the InvocationContext object there. Thus
+ * we gotta do it here.
+ */
+
+ // be sure to use whatever handlerresolver is registered on the Service
+ invocationContext.setHandlers(getBinding().getHandlerChain());
Message requestMsg = null;
try {
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java Wed Jun 27 09:45:37 2007
@@ -184,9 +184,8 @@
*/
// be sure to use whatever handlerresolver is registered on the Service
- //HandlerResolver handlerResolver = serviceDelegate.getHandlerResolver();
- //bnd.setHandlerChain(handlerResolver.getHandlerChain(endpointDesc.getPortInfo()));
requestIC.setHandlers(getBinding().getHandlerChain());
+
requestIC.setRequestMessageContext(request);
requestIC.setServiceClient(serviceDelegate.getServiceClient(endpointDesc.getPortQName()));
@@ -389,7 +388,7 @@
opDesc = opDesc.getSyncOperation();
}
if (msg != null && msg.isFault()) {
- Object object = MethodMarshallerFactory.getMarshaller(opDesc, false)
+ Object object = MethodMarshallerFactory.getMarshaller(opDesc, true)
.demarshalFaultResponse(msg, opDesc);
if (log.isDebugEnabled() && object != null) {
log.debug("A fault was found and processed.");
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/context/factory/MessageContextFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/context/factory/MessageContextFactory.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/context/factory/MessageContextFactory.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/context/factory/MessageContextFactory.java Wed Jun 27 09:45:37 2007
@@ -20,8 +20,8 @@
import org.apache.axis2.jaxws.context.WebServiceContextImpl;
import org.apache.axis2.jaxws.core.MessageContext;
+import org.apache.axis2.jaxws.core.MEPContext;
import org.apache.axis2.jaxws.handler.LogicalMessageContext;
-import org.apache.axis2.jaxws.handler.ProtectedMessageContext;
import org.apache.axis2.jaxws.handler.SoapMessageContext;
import javax.xml.ws.WebServiceContext;
@@ -38,9 +38,9 @@
}
/**
- * Creates a SOAPMessageContext based on the input core MessageContext.
- *
- * @param jaxwsMessageContext
+ * Creates a SOAPMessageContext based on the input core MEPContext.
+ *
+ * @param mepCtx
* @return
*/
public static SoapMessageContext createSoapMessageContext(
@@ -49,21 +49,13 @@
}
/**
- * Creates a LogicalMessageContext based on the input core MessageContext.
+ * Creates a LogicalMessageContext based on the input core MEPContext.
*
- * @param mc
+ * @param mepCtx
* @return
*/
public static LogicalMessageContext createLogicalMessageContext(MessageContext mc) {
return new LogicalMessageContext(mc);
}
- /*
- * This method is deprecated as we will be removing the ProtectedMessageContext
- */
- @Deprecated
- public static javax.xml.ws.handler.MessageContext createProtectedMessageContext(
- org.apache.axis2.jaxws.core.MessageContext jaxwsMessageContext) {
- return new ProtectedMessageContext(jaxwsMessageContext);
- }
}
Copied: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/core/MEPContext.java (from r549993, webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/MEPContext.java)
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/core/MEPContext.java?view=diff&rev=551228&p1=webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/MEPContext.java&r1=549993&p2=webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/core/MEPContext.java&r2=551228
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/MEPContext.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/core/MEPContext.java Wed Jun 27 09:45:37 2007
@@ -16,7 +16,6 @@
*/
package org.apache.axis2.jaxws.core;
-import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.description.EndpointDescription;
import org.apache.axis2.jaxws.message.Message;
@@ -108,8 +107,10 @@
public Scope getScope(String s) {
if (scopes.get(s) == null) {
- // JAX-WS default 9.4.1
- return Scope.HANDLER;
+ // JAX-WS default 9.4.1. However, we try to set the scope for
+ // every incoming property to HANDLER. If a property is coming from
+ // the axis2 Options bag, we want those to be APPLICATION scoped.
+ return Scope.APPLICATION;
}
return scopes.get(s);
}
@@ -223,24 +224,32 @@
public Object put(String key, Object value) {
// TODO careful: endpoints may overwrite pre-existing key/value pairs.
// Those key/value pairs may already have a scope attached to them, which
- // means an endpoint could "put" a property and immediately do a "get" which
- // would return null.
+ // means an endpoint could "put" a property that is wrongly scoped
+ if (scopes.get(key) == null) { // check the scopes object directly, not through getScope()!!
+ setScope(key, Scope.HANDLER);
+ }
if (requestMC.getProperties().containsKey(key)) {
- return requestMC.getProperties().put(key, value);
+ return requestMC.setProperty(key, value);
}
if (responseMC != null) {
- return responseMC.getProperties().put(key, value);
+ return responseMC.setProperty(key, value);
}
- return requestMC.getProperties().put(key, value);
+ return requestMC.setProperty(key, value);
}
public void putAll(Map t) {
// TODO similar problem as "put"
+ for(Iterator it = t.entrySet().iterator(); it.hasNext();) {
+ Entry<String, Object> entry = (Entry)it.next();
+ if (getScope(entry.getKey()) == null) {
+ setScope(entry.getKey(), Scope.HANDLER);
+ }
+ }
if (responseMC != null) {
- responseMC.getProperties().putAll(t);
+ responseMC.setProperties(t);
}
else {
- requestMC.getProperties().putAll(t);
+ requestMC.setProperties(t);
}
}
@@ -330,7 +339,7 @@
*
* @return
*/
- private Map<String, Object> getApplicationScopedProperties() {
+ public Map<String, Object> getApplicationScopedProperties() {
Map<String, Object> tempMap = new HashMap<String, Object>();
// better performance:
if (!scopes.containsValue(Scope.APPLICATION)) {
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/core/MessageContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/core/MessageContext.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/core/MessageContext.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/core/MessageContext.java Wed Jun 27 09:45:37 2007
@@ -30,6 +30,10 @@
import javax.xml.ws.WebServiceException;
import java.util.HashMap;
import java.util.Map;
+import java.util.AbstractMap;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Set;
/**
* The <code>org.apache.axis2.jaxws.core.MessageContext</code> is an interface that extends the
@@ -52,6 +56,18 @@
private QName operationName; //FIXME: This should become the OperationDescription
private Message message;
private Mode mode;
+
+ // TODO: flag to set whether we delegate property setting up to the
+ // axis2 options objecct or keep it local
+ private boolean DELEGATE_TO_OPTIONS = true;
+
+ /*
+ * JAXWS runtime uses a request and response mc, but we need to know the pair.
+ * We will use this mepCtx as a wrapper to the request and response message contexts
+ * where the requestMC and responseMC have the same parent MEPContext to
+ * preserve the relationship.
+ */
+ private MEPContext mepCtx;
// If a local exception is thrown, the exception is placed on the message context.
// It is not converted into a Message.
@@ -59,12 +75,22 @@
public MessageContext() {
axisMsgCtx = new org.apache.axis2.context.MessageContext();
- properties = new HashMap<String, Object>();
+ if (!DELEGATE_TO_OPTIONS) {
+ properties = new HashMap<String, Object>();
+ }
+
}
-
public MessageContext(org.apache.axis2.context.MessageContext mc) throws WebServiceException {
- properties = new HashMap<String, Object>();
+ if (!DELEGATE_TO_OPTIONS) {
+ properties = new HashMap<String, Object>();
+ }
+ /*
+ * Instead of creating a member MEPContext object every time, we will
+ * rely on users of this MessageContext class to create a new
+ * MEPContext and call setMEPContext(MEPContext)
+ */
+
if (mc != null) {
axisMsgCtx = mc;
message = MessageUtils.getMessageFromMessageContext(mc);
@@ -85,8 +111,37 @@
}
public Map<String, Object> getProperties() {
+ if (DELEGATE_TO_OPTIONS) {
+ return new ReadOnlyProperties(axisMsgCtx.getOptions().getProperties());
+ }
return properties;
}
+
+ public void setProperties(Map<String, Object> _properties) {
+ if (DELEGATE_TO_OPTIONS) {
+ axisMsgCtx.getOptions().setProperties(_properties);
+ } else {
+ getProperties().putAll(_properties);
+ }
+ }
+
+ public Object getProperty(String key) {
+ if (DELEGATE_TO_OPTIONS) {
+ return axisMsgCtx.getOptions().getProperty(key);
+ }
+ return getProperties().get(key);
+ }
+
+ // acts like Map.put(key, value)
+ public Object setProperty(String key, Object value) {
+ if (DELEGATE_TO_OPTIONS) {
+ Object retval = axisMsgCtx.getOptions().getProperty(key);
+ axisMsgCtx.getOptions().setProperty(key, value);
+ return retval;
+ } else {
+ return getProperties().put(key, value);
+ }
+ }
public EndpointDescription getEndpointDescription() {
return endpointDesc;
@@ -151,7 +206,7 @@
public boolean isMaintainSession() {
boolean maintainSession = false;
- Boolean value = (Boolean)properties.get(BindingProvider.SESSION_MAINTAIN_PROPERTY);
+ Boolean value = (Boolean) getProperties().get(BindingProvider.SESSION_MAINTAIN_PROPERTY);
if (value != null && value.booleanValue()) {
maintainSession = true;
}
@@ -180,5 +235,218 @@
*/
public void setLocalException(Throwable t) {
localException = t;
+ }
+
+ /**
+ * Set the wrapper MEPContext. Internally, this method also sets
+ * the MEPContext's children so the pointer is bi-directional; you can
+ * get the MEPContext from the MessageContext and vice-versa.
+ *
+ * @param mepCtx
+ */
+ public void setMEPContext(MEPContext mepCtx) {
+ if (this.mepCtx == null) {
+ this.mepCtx = mepCtx;
+ // and set parent's child pointer
+ this.mepCtx.setResponseMessageContext(this);
+ }
+ }
+
+ public MEPContext getMEPContext() {
+ if (mepCtx == null) {
+ setMEPContext(new MEPContext(this));
+ }
+ return mepCtx;
+ }
+
+ private class ReadOnlyProperties extends AbstractMap<String, Object> {
+
+ private Map<String, Object> containedProps;
+
+ public ReadOnlyProperties(Map containedProps) {
+ this.containedProps = containedProps;
+ }
+
+ @Override
+ public Set<Entry<String, Object>> entrySet() {
+ return new ReadOnlySet(containedProps.entrySet());
+ }
+
+ @Override
+ public Set<String> keySet() {
+ return new ReadOnlySet(containedProps.keySet());
+ }
+
+ @Override
+ public Object put(String key, Object value) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void putAll(Map<? extends String, ? extends Object> t) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Object remove(Object key) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Collection<Object> values() {
+ return new ReadOnlyCollection(containedProps.values());
+ }
+
+ /*
+ * nested classes to be used to enforce read-only Collection, Set, and Iterator for MEPContext
+ */
+
+ class ReadOnlyCollection implements Collection {
+
+ private Collection containedCollection;
+
+ private ReadOnlyCollection(Collection containedCollection) {
+ this.containedCollection = containedCollection;
+ }
+
+ public boolean add(Object o) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean addAll(Collection c) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void clear() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean contains(Object o) {
+ return containedCollection.contains(o);
+ }
+
+ public boolean containsAll(Collection c) {
+ return containedCollection.containsAll(c);
+ }
+
+ public boolean isEmpty() {
+ return containedCollection.isEmpty();
+ }
+
+ public Iterator iterator() {
+ return new ReadOnlyIterator(containedCollection.iterator());
+ }
+
+ public boolean remove(Object o) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean removeAll(Collection c) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean retainAll(Collection c) {
+ throw new UnsupportedOperationException();
+ }
+
+ public int size() {
+ return containedCollection.size();
+ }
+
+ public Object[] toArray() {
+ return containedCollection.toArray();
+ }
+
+ public Object[] toArray(Object[] a) {
+ return containedCollection.toArray(a);
+ }
+
+ }
+
+ class ReadOnlyIterator implements Iterator {
+
+ private Iterator containedIterator;
+
+ private ReadOnlyIterator(Iterator containedIterator) {
+ this.containedIterator = containedIterator;
+ }
+
+ // override remove() to make this Iterator class read-only
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean hasNext() {
+ return containedIterator.hasNext();
+ }
+
+ public Object next() {
+ return containedIterator.next();
+ }
+ }
+
+ class ReadOnlySet implements Set {
+
+ private Set containedSet;
+
+ private ReadOnlySet(Set containedSet) {
+ this.containedSet = containedSet;
+ }
+
+ public boolean add(Object o) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean addAll(Collection c) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void clear() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean contains(Object o) {
+ return containedSet.contains(o);
+ }
+
+ public boolean containsAll(Collection c) {
+ return containedSet.containsAll(c);
+ }
+
+ public boolean isEmpty() {
+ return containedSet.isEmpty();
+ }
+
+ public Iterator iterator() {
+ return new ReadOnlyIterator(containedSet.iterator());
+ }
+
+ public boolean remove(Object o) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean removeAll(Collection c) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean retainAll(Collection c) {
+ throw new UnsupportedOperationException();
+ }
+
+ public int size() {
+ return containedSet.size();
+ }
+
+ public Object[] toArray() {
+ return containedSet.toArray();
+ }
+
+ public Object[] toArray(Object[] a) {
+ return containedSet.toArray(a);
+ }
+
+ }
+
}
}
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?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- 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 Wed Jun 27 09:45:37 2007
@@ -36,6 +36,7 @@
import org.apache.axis2.jaxws.client.async.CallbackFuture;
import org.apache.axis2.jaxws.client.async.PollingFuture;
import org.apache.axis2.jaxws.core.InvocationContext;
+import org.apache.axis2.jaxws.core.MEPContext;
import org.apache.axis2.jaxws.core.MessageContext;
import org.apache.axis2.jaxws.description.OperationDescription;
import org.apache.axis2.jaxws.i18n.Messages;
@@ -121,6 +122,7 @@
// Collect the response MessageContext and envelope
axisResponseMsgCtx = opClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
response = new MessageContext(axisResponseMsgCtx);
+ response.setMEPContext(request.getMEPContext());
// If the Message object is still null, then it's possible that a
// local AxisFault was thrown and we need to save it for later throwing
@@ -393,6 +395,13 @@
// Get the SOAP Action (if needed)
String soapAction = ClientUtils.findSOAPAction(requestMsgCtx);
options.setAction(soapAction);
+ // get the timeout from the request message context options as it may have been
+ // set by the user; if it was not set by the user we will just be setting the
+ // timeout on the operation client to the default so it will not have a negative
+ // effect; this logic is reliant on the fact the JAX-WS MessageContext is delegating
+ // to the Axis2 Options object and not storing its own property bag
+ long timeout = axisRequest.getOptions().getTimeOutInMilliSeconds();
+ options.setTimeOutInMilliSeconds(timeout);
// Use the OperationClient to send the request and put the contents
// of the response in the response MessageContext.
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?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- 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 Wed Jun 27 09:45:37 2007
@@ -87,16 +87,22 @@
MessageContext request = ic.getRequestMessageContext();
MessageContext response = null;
- request.getProperties().put(Constants.INVOCATION_PATTERN, InvocationPattern.SYNC);
+ request.setProperty(Constants.INVOCATION_PATTERN, InvocationPattern.SYNC);
// Invoke outbound handlers.
- boolean success = HandlerInvokerUtils.invokeOutboundHandlers(request, ic.getHandlers(),
- request.getEndpointDescription(), HandlerChainProcessor.MEP.REQUEST, false);
+ boolean success =
+ HandlerInvokerUtils.invokeOutboundHandlers(request.getMEPContext(),
+ ic.getHandlers(),
+ HandlerChainProcessor.MEP.REQUEST,
+ false);
if (success) {
prepareRequest(request);
response = doInvoke(request);
prepareResponse(response);
+
+ // make sure request and response contexts share a single parent
+ response.setMEPContext(request.getMEPContext());
/*
* TODO TODO TODO review
@@ -116,13 +122,16 @@
response.setEndpointDescription(request.getEndpointDescription());
// Invoke inbound handlers.
- HandlerInvokerUtils.invokeInboundHandlers(response, ic.getHandlers(), request
- .getEndpointDescription(), HandlerChainProcessor.MEP.RESPONSE, false);
+ HandlerInvokerUtils.invokeInboundHandlers(response.getMEPContext(),
+ ic.getHandlers(),
+ HandlerChainProcessor.MEP.RESPONSE,
+ false);
} else { // the outbound handler chain must have had a problem, and
// we've reversed directions
response = MessageContextUtils.createMinimalResponseMessageContext(request);
// since we've reversed directions, the message has "become a
- // response message" (section 9.3.2.1, footnote superscript 2)
+ // make sure request and response contexts share a single parent
+ response.setMEPContext(request.getMEPContext());
response.setMessage(request.getMessage());
}
ic.setResponseMessageContext(response);
@@ -154,10 +163,14 @@
}
MessageContext request = ic.getRequestMessageContext();
- request.getProperties().put(Constants.INVOCATION_PATTERN, InvocationPattern.ONEWAY);
+ request.setProperty(Constants.INVOCATION_PATTERN, InvocationPattern.ONEWAY);
// Invoke outbound handlers.
- boolean success = HandlerInvokerUtils.invokeOutboundHandlers(request, ic.getHandlers(), request.getEndpointDescription(), HandlerChainProcessor.MEP.REQUEST, false);
+ boolean success =
+ HandlerInvokerUtils.invokeOutboundHandlers(request.getMEPContext(),
+ ic.getHandlers(),
+ HandlerChainProcessor.MEP.REQUEST,
+ true);
if (success) {
prepareRequest(request);
@@ -192,13 +205,17 @@
}
MessageContext request = ic.getRequestMessageContext();
- request.getProperties().put(Constants.INVOCATION_PATTERN, InvocationPattern.ASYNC_POLLING);
+ request.setProperty(Constants.INVOCATION_PATTERN, InvocationPattern.ASYNC_POLLING);
Response resp = null;
// Invoke outbound handlers.
// TODO uncomment, and get the EndpointDescription from the request context, which should soon be available
- boolean success = HandlerInvokerUtils.invokeOutboundHandlers(request, ic.getHandlers(), request.getEndpointDescription(), HandlerChainProcessor.MEP.REQUEST, false);
+ boolean success =
+ HandlerInvokerUtils.invokeOutboundHandlers(request.getMEPContext(),
+ ic.getHandlers(),
+ HandlerChainProcessor.MEP.REQUEST,
+ false);
if (success) {
prepareRequest(request);
resp = doInvokeAsync(request);
@@ -250,13 +267,16 @@
}
MessageContext request = ic.getRequestMessageContext();
- request.getProperties().put(Constants.INVOCATION_PATTERN, InvocationPattern.ASYNC_CALLBACK);
+ request.setProperty(Constants.INVOCATION_PATTERN, InvocationPattern.ASYNC_CALLBACK);
Future<?> future = null;
// Invoke outbound handlers.
- boolean success = HandlerInvokerUtils.invokeOutboundHandlers(request, ic.getHandlers(),
- request.getEndpointDescription(), HandlerChainProcessor.MEP.REQUEST, false);
+ boolean success =
+ HandlerInvokerUtils.invokeOutboundHandlers(request.getMEPContext(),
+ ic.getHandlers(),
+ HandlerChainProcessor.MEP.REQUEST,
+ false);
if (success) {
prepareRequest(request);
future = doInvokeAsync(request, asyncHandler);
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/core/util/MessageContextUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/core/util/MessageContextUtils.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/core/util/MessageContextUtils.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/core/util/MessageContextUtils.java Wed Jun 27 09:45:37 2007
@@ -43,6 +43,7 @@
MessageContextBuilder.createOutMessageContext(sourceAxisMC);
MessageContext newMC = new MessageContext(newAxisMC);
+ newMC.setMEPContext(mc.getMEPContext());
newMC.setEndpointDescription(mc.getEndpointDescription());
newMC.setOperationDescription(mc.getOperationDescription());
return newMC;
@@ -60,6 +61,7 @@
public static MessageContext createMinimalResponseMessageContext(MessageContext mc) {
org.apache.axis2.context.MessageContext sourceAxisMC = mc.getAxisMessageContext();
MessageContext newMC = new MessageContext(sourceAxisMC);
+ newMC.setMEPContext(mc.getMEPContext());
newMC.setEndpointDescription(mc.getEndpointDescription());
newMC.setOperationDescription(mc.getOperationDescription());
return newMC;
@@ -71,12 +73,13 @@
* @param mc
* @return
*/
- public static MessageContext createFaultMessageContext(MessageContext mc, Throwable t) {
+ public static MessageContext createFaultMessageContext(MessageContext mc) {
try {
org.apache.axis2.context.MessageContext faultMC =
- MessageContextBuilder.createFaultMessageContext(
- mc.getAxisMessageContext(), t);
+ MessageContextBuilder.createFaultMessageContext(mc.getAxisMessageContext(),
+ null);
MessageContext jaxwsFaultMC = new MessageContext(faultMC);
+ jaxwsFaultMC.setMEPContext(mc.getMEPContext());
jaxwsFaultMC.setEndpointDescription(mc.getEndpointDescription());
jaxwsFaultMC.setOperationDescription(mc.getOperationDescription());
return jaxwsFaultMC;
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?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- 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 Wed Jun 27 09:45:37 2007
@@ -20,6 +20,7 @@
import java.util.ArrayList;
import java.util.Iterator;
+import org.apache.axis2.jaxws.core.MEPContext;
import java.util.List;
import javax.xml.soap.SOAPBody;
@@ -55,9 +56,11 @@
REQUEST, RESPONSE
};
- private javax.xml.ws.handler.MessageContext currentMC;
+ private javax.xml.ws.handler.MessageContext currentMC; // just a pointer
+ private LogicalMessageContext logicalMC = null;
+ private SoapMessageContext soapMC = null;
- private MessageContext mc;
+ private MEPContext mepCtx;
private List<Handler> handlers = null;
@@ -148,12 +151,13 @@
* 1. Has the MessageContext.MESSAGE_OUTBOUND_PROPERTY changed, indicating reversal of message direction
* 2. Has the message been converted to a fault message? (indicated by a flag in the message)
*/
- public boolean processChain(MessageContext mc, Direction direction, MEP mep, boolean expectResponse) {
+ public boolean processChain(MEPContext mepCtx, Direction direction, MEP mep,
+ boolean expectResponse) {
if (handlers.size() == 0)
return true;
- this.mc = mc;
+ this.mepCtx = mepCtx;
sortChain();
initContext(direction);
@@ -265,13 +269,18 @@
// it's a response, so we can safely assume that
// ALL the handlers were invoked on the request,
// so we need to close ALL of them
- if (direction.equals(Direction.IN))
+ if (direction.equals(Direction.IN)) {
callCloseHandlers(handlers.size() - 1, 0, direction);
- else
+ } else {
callCloseHandlers(0, handlers.size() - 1, direction);
+ }
+ if (savedException != null) {
+ // we have a saved exception, throw it (JAX-WS 9.3.2.1 "Throw any
+ // other runtime exception --> No response" case.
+ throw savedException;
+ }
}
}
-
}
/*
@@ -323,10 +332,9 @@
currentMC.put(javax.xml.ws.handler.MessageContext.MESSAGE_OUTBOUND_PROPERTY,
(direction != Direction.OUT));
if (ProtocolException.class.isAssignableFrom(re.getClass())) {
- convertToFaultMessage(mc, re, proto);
+ convertToFaultMessage(mepCtx, re, proto);
// just re-initialize the current handler message context since
// that will pick up the now-changed message
- reInitContext();
return PROTOCOL_EXCEPTION;
}
return OTHER_EXCEPTION;
@@ -378,13 +386,14 @@
* opposite direction as this call to callHandleFault, and thus
* should be closed.
*/
- public void processFault(MessageContext mc, Direction direction) {
+ public void processFault(MEPContext mepCtx, Direction direction) {
// direction.IN = client
// direction.OUT = server
if (handlers.size() == 0)
return;
- this.mc = mc;
+
+ this.mepCtx = mepCtx;
sortChain();
initContext(direction);
currentMC.put(javax.xml.ws.handler.MessageContext.MESSAGE_OUTBOUND_PROPERTY, (direction == Direction.OUT));
@@ -428,23 +437,23 @@
if (direction == Direction.OUT) {
for (; i <= end; i++) {
- if (((Handler) handlers.get(i)).handleFault(currentMC) == false) {
+ boolean success = ((Handler) handlers.get(i)).handleFault(currentMC);
+ if (!success)
break;
- }
- switchContext(direction, i+1);
+ switchContext(direction, i + 1);
}
} else { // IN case
for (; i >= end; i--) {
- if (((Handler) handlers.get(i)).handleFault(currentMC) == false) {
+ boolean success = ((Handler) handlers.get(i)).handleFault(currentMC);
+ if (!success)
break;
- }
- switchContext(direction, i-1);
+ switchContext(direction, i - 1);
}
}
}
- public static void convertToFaultMessage(MessageContext mc, Exception e, Protocol protocol) {
+ public static void convertToFaultMessage(MEPContext mepCtx, Exception e, Protocol protocol) {
// need to check if message is already a fault message or not,
// probably by way of a flag (isFault) in the MessageContext or Message
@@ -470,7 +479,7 @@
// TODO something is wrong here. The message should be a response message, not
// a request message. I don't see how to change that. (see the debugger...)
// TODO probably also need to turn on message.WRITE_XML_DECLARATION
- mc.setMessage(((MessageFactory)(FactoryRegistry.getFactory(MessageFactory.class))).createFrom(message));
+ mepCtx.setMessage(((MessageFactory) (FactoryRegistry.getFactory(MessageFactory.class))).createFrom(message));
} else {
throw ExceptionFactory.makeWebServiceException("We only support SOAP11 and SOAP12 for JAXWS handlers");
@@ -480,50 +489,39 @@
throw ExceptionFactory.makeWebServiceException(ex);
}
- }
-
- /*
- * utility method to re-initialize handlercontext so it picks up a changed
- * message under the org.apache.axis2.jaxws.core.MessageContext object
- *
- * TODO: hopefully we can fix this so the message under the handler message context
- * will grab it without us having to create new objects.
- */
- private void reInitContext() {
- if (currentMC.getClass().isAssignableFrom(LogicalMessageContext.class))
- currentMC = MessageContextFactory.createLogicalMessageContext(mc);
- else
- currentMC = MessageContextFactory.createSoapMessageContext(mc);
}
+
private void initContext(Direction direction) {
+ soapMC = MessageContextFactory.createSoapMessageContext(mepCtx.getMessageContext());
+ logicalMC = MessageContextFactory.createLogicalMessageContext(mepCtx.getMessageContext());
if (direction == Direction.OUT) {
// logical context, then SOAP
- if ((logicalLength == 0) && (handlers.size() > 0)) // we only have soap handlers
- currentMC = MessageContextFactory.createSoapMessageContext(mc);
+ if ((logicalLength == 0) && (handlers.size() > 0)) // we only have soap handlers
+ currentMC = soapMC; //MessageContextFactory.createSoapMessageContext(mepCtx.getMessageContext());
else
- currentMC = MessageContextFactory.createLogicalMessageContext(mc);
- }
- else {
+ currentMC = logicalMC; //MessageContextFactory.createLogicalMessageContext(mepCtx.getMessageContext());
+ } else {
// SOAP context, then logical
- if ((logicalLength == handlers.size()) && (handlers.size() > 0)) // we only have logical handlers
- currentMC = MessageContextFactory.createLogicalMessageContext(mc);
+ if ((logicalLength == handlers.size()) && (handlers.size() > 0)) // we only have logical handlers
+ currentMC = logicalMC; //MessageContextFactory.createLogicalMessageContext(mepCtx.getMessageContext());
else
- currentMC = MessageContextFactory.createSoapMessageContext(mc);
+ currentMC = soapMC; //MessageContextFactory.createSoapMessageContext(mepCtx.getMessageContext());
}
}
-
+
private void switchContext(Direction direction, int index) {
if ((logicalLength == handlers.size()) || (logicalLength == 0))
- return; // all handlers must be the same type, so no context switch
-
+ return; // all handlers must be the same type, so no context switch
+
if (((direction == Direction.OUT) && (index == logicalLength))
|| ((direction == Direction.IN) && (index == (logicalLength - 1)))) {
- if (currentMC.getClass().isAssignableFrom(LogicalMessageContext.class))
- currentMC = MessageContextFactory.createSoapMessageContext(mc);
+ //if (currentMC.getClass().isAssignableFrom(LogicalMessageContext.class))
+ if (currentMC == logicalMC) // object check, not .equals()
+ currentMC = soapMC; //MessageContextFactory.createSoapMessageContext(mepCtx.getMessageContext());
else
- currentMC = MessageContextFactory.createLogicalMessageContext(mc);
+ currentMC = logicalMC; //MessageContextFactory.createLogicalMessageContext(mepCtx.getMessageContext());
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerInvokerUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerInvokerUtils.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerInvokerUtils.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerInvokerUtils.java Wed Jun 27 09:45:37 2007
@@ -18,111 +18,111 @@
*/
package org.apache.axis2.jaxws.handler;
-import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.jaxws.ExceptionFactory;
-import org.apache.axis2.jaxws.context.factory.MessageContextFactory;
-import org.apache.axis2.jaxws.context.utils.ContextUtils;
+import org.apache.axis2.jaxws.core.MEPContext;
import org.apache.axis2.jaxws.core.MessageContext;
-import org.apache.axis2.jaxws.description.EndpointDescription;
-import org.apache.axis2.jaxws.message.Message;
import org.apache.axis2.jaxws.message.Protocol;
-import org.apache.axis2.jaxws.message.factory.MessageFactory;
-import org.apache.axis2.jaxws.registry.FactoryRegistry;
-import org.apache.axis2.jaxws.server.endpoint.lifecycle.impl.EndpointLifecycleManagerImpl;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.ws.WebServiceContext;
import javax.xml.ws.handler.Handler;
-import javax.xml.ws.handler.soap.SOAPMessageContext;
+
import java.util.List;
public class HandlerInvokerUtils {
/**
* Invoke Inbound Handlers
- *
* @param requestMsgCtx
*/
- public static boolean invokeInboundHandlers(MessageContext msgCtx,
- List<Handler> handlers, EndpointDescription endpointDesc, HandlerChainProcessor.MEP mep, boolean isOneWay) {
+ public static boolean invokeInboundHandlers(MEPContext mepMessageCtx, List<Handler> handlers,
+ HandlerChainProcessor.MEP mep, boolean isOneWay) {
String bindingProto = null;
- if (mep.equals(HandlerChainProcessor.MEP.REQUEST)) // inbound request; must be on the server
- bindingProto = endpointDesc.getBindingType();
- else // inbound response; must be on the client
- bindingProto = endpointDesc.getClientBindingID();
+ if (mep.equals(HandlerChainProcessor.MEP.REQUEST)) // inbound request; must be on the server
+ bindingProto = mepMessageCtx.getEndpointDesc().getBindingType();
+ else
+ // inbound response; must be on the client
+ bindingProto = mepMessageCtx.getEndpointDesc().getClientBindingID();
Protocol proto = Protocol.getProtocolForBinding(bindingProto);
+
HandlerChainProcessor processor = new HandlerChainProcessor(handlers, proto);
// if not one-way, expect a response
boolean success = true;
try {
- if (msgCtx.getMessage().isFault()) {
- processor.processFault(msgCtx,
- HandlerChainProcessor.Direction.IN);
+ if (mepMessageCtx.getMessageObject().isFault()) {
+ processor.processFault(mepMessageCtx, HandlerChainProcessor.Direction.IN);
} else {
- success = processor.processChain(msgCtx,
- HandlerChainProcessor.Direction.IN,
- mep,
- !isOneWay);
+ success =
+ processor.processChain(mepMessageCtx,
+ HandlerChainProcessor.Direction.IN,
+ mep,
+ !isOneWay);
}
} catch (RuntimeException re) {
/*
- * handler framework should only throw an exception here if
- * we are in the client inbound case. Make sure the message
- * context and message are transformed.
- */
- HandlerChainProcessor.convertToFaultMessage(msgCtx, re, proto);
+ * handler framework should only throw an exception here if
+ * we are in the client inbound case. Make sure the message
+ * context and message are transformed.
+ */
+ HandlerChainProcessor.convertToFaultMessage(mepMessageCtx, re, proto);
+ // done invoking inbound handlers, be sure to set the access lock flag on the context to true
+ mepMessageCtx.setApplicationAccessLocked(true);
return false;
}
-
+
if (!success && mep.equals(HandlerChainProcessor.MEP.REQUEST)) {
// uh-oh. We've changed directions on the server inbound handler processing,
// This means we're now on an outbound flow, and the endpoint will not
// be called. Be sure to mark the context and message as such.
+
+ // done invoking inbound handlers, be sure to set the access lock flag on the context to true
+ mepMessageCtx.setApplicationAccessLocked(true);
return false;
}
+ // done invoking inbound handlers, be sure to set the access lock flag on the context to true
+ mepMessageCtx.setApplicationAccessLocked(true);
return true;
}
/**
* Invoke OutboundHandlers
- *
+ *
* @param msgCtx
*/
- public static boolean invokeOutboundHandlers(MessageContext msgCtx,
- List<Handler> handlers, EndpointDescription endpointDesc, HandlerChainProcessor.MEP mep, boolean isOneWay) {
-
+ public static boolean invokeOutboundHandlers(MEPContext mepMessageCtx, List<Handler> handlers,
+ HandlerChainProcessor.MEP mep, boolean isOneWay) {
+
if (handlers == null)
return true;
String bindingProto = null;
- if (mep.equals(HandlerChainProcessor.MEP.REQUEST)) // outbound request; must be on the client
- bindingProto = endpointDesc.getClientBindingID();
- else // outbound response; must be on the server
- bindingProto = endpointDesc.getBindingType();
+ if (mep.equals(HandlerChainProcessor.MEP.REQUEST)) // outbound request; must be on the client
+ bindingProto = mepMessageCtx.getEndpointDesc().getClientBindingID();
+ else
+ // outbound response; must be on the server
+ bindingProto = mepMessageCtx.getEndpointDesc().getBindingType();
Protocol proto = Protocol.getProtocolForBinding(bindingProto);
-
+
HandlerChainProcessor processor = new HandlerChainProcessor(handlers, proto);
// if not one-way, expect a response
boolean success = true;
try {
- if (msgCtx.getMessage().isFault()) {
- processor.processFault(msgCtx,
- HandlerChainProcessor.Direction.OUT);
+ if (mepMessageCtx.getMessageObject().isFault()) {
+ processor.processFault(mepMessageCtx, HandlerChainProcessor.Direction.OUT);
} else {
- success = processor.processChain(msgCtx,
- HandlerChainProcessor.Direction.OUT,
- mep, !isOneWay);
+ success =
+ processor.processChain(mepMessageCtx,
+ HandlerChainProcessor.Direction.OUT,
+ mep,
+ !isOneWay);
}
} catch (RuntimeException re) {
/*
- * handler framework should only throw an exception here if
- * we are in the server outbound case. Make sure the message
- * context and message are transformed.
- */
- HandlerChainProcessor.convertToFaultMessage(msgCtx, re, proto);
+ * handler framework should only throw an exception here if
+ * we are in the server outbound case. Make sure the message
+ * context and message are transformed.
+ */
+ HandlerChainProcessor.convertToFaultMessage(mepMessageCtx, re, proto);
return false;
}
@@ -135,5 +135,5 @@
return true;
}
-
+
}
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?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- 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 Wed Jun 27 09:45:37 2007
@@ -18,37 +18,36 @@
*/
package org.apache.axis2.jaxws.handler;
-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;
+
+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 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;
-import org.apache.axis2.jaxws.description.ServiceDescription;
import org.apache.axis2.jaxws.description.xml.handler.HandlerChainType;
import org.apache.axis2.jaxws.description.xml.handler.HandlerChainsType;
import org.apache.axis2.jaxws.description.xml.handler.HandlerType;
+import org.apache.axis2.jaxws.handler.lifecycle.factory.HandlerLifecycleManager;
+import org.apache.axis2.jaxws.handler.lifecycle.factory.HandlerLifecycleManagerFactory;
import org.apache.axis2.jaxws.i18n.Messages;
-import org.apache.axis2.jaxws.runtime.description.injection.ResourceInjectionServiceRuntimeDescription;
-import org.apache.axis2.jaxws.runtime.description.injection.impl.ResourceInjectionServiceRuntimeDescriptionBuilder;
-import org.apache.axis2.jaxws.server.endpoint.lifecycle.EndpointLifecycleException;
+import org.apache.axis2.jaxws.registry.FactoryRegistry;
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.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
/*
* This class should be created by the ServiceDelegate.
* HandlerResolverImpl.getHandlerChain(PortInfo) will be called by the
@@ -141,7 +140,7 @@
// which is where one might get the portinfo object. We still have the
// passed-in variable, however, due to the spec
- ArrayList handlers = new ArrayList<Handler>();
+ ArrayList<Handler> handlers = new ArrayList<Handler>();
/*
* TODO: do a better job checking that the return value matches up
@@ -172,21 +171,17 @@
// or will schema not allow it?
String portHandler = handlerType.getHandlerClass().getValue();
Handler handler;
- // instantiate portHandler class
+
+ // Create temporary MessageContext to pass information to HandlerLifecycleManager
+ MessageContext ctx = new MessageContext();
+ ctx.setEndpointDescription(endpointDesc);
+
+ HandlerLifecycleManager hlm = createHandlerlifecycleManager();
+
+ // instantiate portHandler class
try {
- // TODO: review: ok to use system classloader?
- handler = (Handler) loadClass(portHandler).newInstance();
- // TODO: must also do resource injection according to JAXWS 9.3.1
- callHandlerPostConstruct(handler, endpointDesc.getServiceDescription());
- } catch (ClassNotFoundException e) {
- // TODO: should we just ignore this problem?
- // TODO: NLS log and throw
- throw ExceptionFactory.makeWebServiceException(e);
- } catch (InstantiationException ie) {
- // TODO: should we just ignore this problem?
- // TODO: NLS log and throw
- throw ExceptionFactory.makeWebServiceException(ie);
- } catch (IllegalAccessException e) {
+ handler = hlm.createHandlerInstance(ctx, loadClass(portHandler));
+ } catch (Exception e) {
// TODO: should we just ignore this problem?
// TODO: NLS log and throw
throw ExceptionFactory.makeWebServiceException(e);
@@ -215,7 +210,12 @@
return handlers;
}
-
+ private HandlerLifecycleManager createHandlerlifecycleManager() {
+ HandlerLifecycleManagerFactory elmf = (HandlerLifecycleManagerFactory)FactoryRegistry
+ .getFactory(HandlerLifecycleManagerFactory.class);
+ return elmf.createHandlerLifecycleManager();
+ }
+
private static Class loadClass(String clazz) throws ClassNotFoundException {
try {
return forName(clazz, true, getContextClassLoader());
@@ -274,55 +274,6 @@
return cl;
}
- private static void callHandlerPostConstruct(Handler handler, ServiceDescription serviceDesc) throws WebServiceException {
- ResourceInjectionServiceRuntimeDescription resInj = ResourceInjectionServiceRuntimeDescriptionBuilder.create(serviceDesc, handler.getClass());
- if (resInj != null) {
- Method pcMethod = resInj.getPostConstructMethod();
- if (pcMethod != null) {
- if(log.isDebugEnabled()){
- log.debug("Invoking Method with @PostConstruct annotation");
- }
- invokeMethod(handler, pcMethod, null);
- if(log.isDebugEnabled()){
- log.debug("Completed invoke on Method with @PostConstruct annotation");
- }
- }
- }
- }
-
-
- /*
- * Helper method to destroy all instantiated Handlers once the runtime
- * is done with them.
- */
- private static void callHandlerPreDestroy(Handler handler, ServiceDescription serviceDesc) throws WebServiceException {
- ResourceInjectionServiceRuntimeDescription resInj = ResourceInjectionServiceRuntimeDescriptionBuilder.create(serviceDesc, handler.getClass());
- if (resInj != null) {
- Method pcMethod = resInj.getPreDestroyMethod();
- if (pcMethod != null) {
- if(log.isDebugEnabled()){
- log.debug("Invoking Method with @PostConstruct annotation");
- }
- invokeMethod(handler, pcMethod, null);
- if(log.isDebugEnabled()){
- log.debug("Completed invoke on Method with @PostConstruct annotation");
- }
- }
- }
- }
-
- private static void invokeMethod(Handler handlerInstance, Method m, Object[] params) throws WebServiceException{
- try{
- m.invoke(handlerInstance, params);
- }catch(InvocationTargetException e){
- // TODO perhaps a "HandlerLifecycleException" would be better?
- throw ExceptionFactory.makeWebServiceException(e);
- }catch(IllegalAccessException e){
- // TODO perhaps a "HandlerLifecycleException" would be better?
- throw ExceptionFactory.makeWebServiceException(e);
- }
- }
-
private static boolean chainResolvesToPort(HandlerChainType handlerChainType, PortInfo portinfo) {
List<String> protocolBindings = handlerChainType.getProtocolBindings();
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/handler/LogicalMessageContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/handler/LogicalMessageContext.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/handler/LogicalMessageContext.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/handler/LogicalMessageContext.java Wed Jun 27 09:45:37 2007
@@ -18,6 +18,7 @@
*/
package org.apache.axis2.jaxws.handler;
+import org.apache.axis2.jaxws.core.MEPContext;
import org.apache.axis2.jaxws.core.MessageContext;
import org.apache.axis2.jaxws.message.Message;
@@ -27,24 +28,19 @@
* The LogicalMessageContext is a JAX-WS interface that is given to Logical handlers to provide
* access to the message and its associated properties.
*/
-public class LogicalMessageContext extends ProtectedMessageContext
- implements javax.xml.ws.handler.LogicalMessageContext {
+public class LogicalMessageContext extends BaseMessageContext implements
+ javax.xml.ws.handler.LogicalMessageContext {
- private LogicalMessage message;
-
- public LogicalMessageContext() {
- super();
- }
-
- public LogicalMessageContext(MessageContext mc) {
- super(mc);
+ public LogicalMessageContext(MessageContext messageCtx) {
+ super(messageCtx);
}
+ /*
+ * (non-Javadoc)
+ * @see javax.xml.ws.handler.LogicalMessageContext#getMessage()
+ */
public LogicalMessage getMessage() {
- if (message == null) {
- Message msg = getMessageObject();
- message = new LogicalMessageImpl(msg);
- }
- return message;
+ return new LogicalMessageImpl(messageCtx.getMEPContext());
}
+
}
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/handler/LogicalMessageImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/handler/LogicalMessageImpl.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/handler/LogicalMessageImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/handler/LogicalMessageImpl.java Wed Jun 27 09:45:37 2007
@@ -36,6 +36,7 @@
import javax.xml.ws.WebServiceException;
import org.apache.axis2.jaxws.ExceptionFactory;
+import org.apache.axis2.jaxws.core.MEPContext;
import org.apache.axis2.jaxws.message.Block;
import org.apache.axis2.jaxws.message.Message;
import org.apache.axis2.jaxws.message.databinding.JAXBBlockContext;
@@ -46,10 +47,11 @@
public class LogicalMessageImpl implements LogicalMessage {
- private Message message;
-
- public LogicalMessageImpl(Message m) {
- message = m;
+
+ private MEPContext mepCtx;
+
+ protected LogicalMessageImpl(MEPContext m) {
+ mepCtx = m;
}
/*
@@ -76,7 +78,7 @@
private Object _getPayload(Object context, BlockFactory factory) {
Object payload = null;
try {
- Block block = message.getBodyBlock(context, factory);
+ Block block = mepCtx.getMessageObject().getBodyBlock(context, factory);
Object content = block.getBusinessObject(true);
// For now, we have to create a new Block from the original content
@@ -85,7 +87,7 @@
Payloads payloads = createPayloads(content);
Block cacheBlock = factory.createFrom(payloads.CACHE_PAYLOAD, context, block.getQName());
- message.setBodyBlock(cacheBlock);
+ mepCtx.getMessageObject().setBodyBlock(cacheBlock);
payload = payloads.HANDLER_PAYLOAD;
} catch (XMLStreamException e) {
@@ -117,8 +119,8 @@
private void _setPayload(Object object, Object context, BlockFactory factory) {
Block block = factory.createFrom(object, context, null);
- if (message != null) {
- message.setBodyBlock(block);
+ if (mepCtx.getMessageObject() != null) {
+ mepCtx.getMessageObject().setBodyBlock(block);
}
}
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?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- 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 Wed Jun 27 09:45:37 2007
@@ -18,16 +18,28 @@
*/
package org.apache.axis2.jaxws.handler;
+import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.core.MessageContext;
+import org.apache.axis2.jaxws.i18n.Messages;
+import org.apache.axis2.jaxws.message.Block;
import org.apache.axis2.jaxws.message.Message;
+import org.apache.axis2.jaxws.message.databinding.JAXBBlockContext;
+import org.apache.axis2.jaxws.message.factory.BlockFactory;
+import org.apache.axis2.jaxws.message.factory.JAXBBlockFactory;
import org.apache.axis2.jaxws.message.factory.MessageFactory;
import org.apache.axis2.jaxws.registry.FactoryRegistry;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import javax.xml.bind.JAXBContext;
import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPConstants;
import javax.xml.soap.SOAPMessage;
import javax.xml.stream.XMLStreamException;
-import java.net.URI;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
import java.util.Set;
/**
@@ -35,37 +47,101 @@
* access to the SOAP message that represents the request or response via SAAJ. It also allows
* access to any properties that have been registered and set on the MessageContext.
*/
-public class SoapMessageContext extends ProtectedMessageContext
- implements javax.xml.ws.handler.soap.SOAPMessageContext {
-
-
- public SoapMessageContext() {
- super();
- }
-
- public SoapMessageContext(MessageContext mc) {
- super(mc);
+public class SoapMessageContext extends BaseMessageContext implements
+ javax.xml.ws.handler.soap.SOAPMessageContext {
+ private static final Log log = LogFactory.getLog(SoapMessageContext.class);
+ public SoapMessageContext(MessageContext messageCtx) {
+ super(messageCtx);
}
public Object[] getHeaders(QName qname, JAXBContext jaxbcontext, boolean flag) {
- return null;
+ if(log.isDebugEnabled()){
+ log.debug("Getting all Headers for Qname: "+qname);
+ }
+
+ if(qname == null){
+ if(log.isDebugEnabled()){
+ log.debug("Invalid QName, QName cannot be null");
+ }
+ ExceptionFactory.makeWebServiceException(Messages.getMessage(""));
+ }
+ if(jaxbcontext == null){
+ if(log.isDebugEnabled()){
+ log.debug("Invalid JAXBContext, JAXBContext cannot be null");
+ }
+ 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.
+
+ }
+ List<Object> list = new ArrayList<Object>();
+ String namespace = qname.getNamespaceURI();
+ String localPart = qname.getLocalPart();
+ BlockFactory blockFactory = (JAXBBlockFactory)FactoryRegistry.getFactory(JAXBBlockFactory.class);
+ Message m = messageCtx.getMessage();
+ JAXBBlockContext jbc = new JAXBBlockContext(jaxbcontext);
+ if(m.getNumHeaderBlocks()>0){
+ Block hb = m.getHeaderBlock(namespace, localPart, jbc, blockFactory);
+ if(hb!=null){
+ try{
+
+ Object bo = hb.getBusinessObject(false);
+ if(bo!=null){
+ if(log.isDebugEnabled()){
+ log.debug("Extracted BO from Header Block");
+ }
+ list.add(bo);
+ }
+
+ }catch(XMLStreamException e){
+ ExceptionFactory.makeWebServiceException(e);
+ }
+ }
+ }
+ return list.toArray(new Object[0]);
+
}
public SOAPMessage getMessage() {
- Message msg = getMessageObject();
+ Message msg = messageCtx.getMEPContext().getMessageObject();
return msg.getAsSOAPMessage();
}
public Set<String> getRoles() {
- return null;
+ // TODO implement better. We should be doing smarter checking of the header,
+ // especially for the Ultimate receiver actor/role
+
+ /*
+ * JAVADOC to help get this implemented correctly:
+ *
+ * Gets the SOAP actor roles associated with an execution of the handler
+ * chain. Note that SOAP actor roles apply to the SOAP node and are
+ * managed using SOAPBinding.setRoles and SOAPBinding.getRoles. Handler
+ * instances in the handler chain use this information about the SOAP
+ * actor roles to process the SOAP header blocks. Note that the SOAP
+ * actor roles are invariant during the processing of SOAP message
+ * through the handler chain.
+ */
+
+ HashSet<String> roles = new HashSet<String>(3);
+ // JAX-WS 10.1.1.1 defaults:
+ // SOAP 1.1
+ roles.add(SOAPConstants.URI_SOAP_ACTOR_NEXT);
+ // SOAP 1.2
+ roles.add(SOAPConstants.URI_SOAP_1_2_ROLE_ULTIMATE_RECEIVER);
+ roles.add(SOAPConstants.URI_SOAP_1_2_ROLE_NEXT);
+ return roles;
}
public void setMessage(SOAPMessage soapmessage) {
// TODO I don't like this at all.
try {
- Message msg = ((MessageFactory)FactoryRegistry.getFactory(MessageFactory.class))
- .createFrom(soapmessage);
- msgContext.setMessage(msg);
+ Message msg =
+ ((MessageFactory) FactoryRegistry.getFactory(MessageFactory.class)).createFrom(soapmessage);
+ messageCtx.getMEPContext().setMessage(msg);
} catch (XMLStreamException e) {
// TODO log it, and throw something?
}
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMethodMarshaller.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMethodMarshaller.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMethodMarshaller.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMethodMarshaller.java Wed Jun 27 09:45:37 2007
@@ -87,14 +87,14 @@
Element returnElement = null;
if (operationDesc.isResultHeader()) {
returnElement =
- MethodMarshallerUtils.getReturnElement(packages, message, null, true,
+ MethodMarshallerUtils.getReturnElement(packages, message, null, false, true,
operationDesc.getResultTargetNamespace(),
operationDesc.getResultName(),
MethodMarshallerUtils.numOutputBodyParams(pds) > 0);
} else {
returnElement = MethodMarshallerUtils
- .getReturnElement(packages, message, null, false, null, null,
+ .getReturnElement(packages, message, null, false, false, null, null,
MethodMarshallerUtils.numOutputBodyParams(pds) > 0);
hasReturnInBody = true;
}
@@ -232,8 +232,11 @@
returnElement = new Element(returnObject, returnQName, returnType);
}
}
- MethodMarshallerUtils.toMessage(returnElement, returnType,
- marshalDesc, m,
+ MethodMarshallerUtils.toMessage(returnElement,
+ returnType,
+ operationDesc.isListType(),
+ marshalDesc,
+ m,
null, // always marshal using "by element" mode
operationDesc.isResultHeader());
}
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMinimalMethodMarshaller.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMinimalMethodMarshaller.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMinimalMethodMarshaller.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMinimalMethodMarshaller.java Wed Jun 27 09:45:37 2007
@@ -96,14 +96,14 @@
Element returnElement = null;
if (operationDesc.isResultHeader()) {
returnElement = MethodMarshallerUtils
- .getReturnElement(packages, message, byJavaType, true,
+ .getReturnElement(packages, message, byJavaType, operationDesc.isListType(), true,
operationDesc.getResultTargetNamespace(),
operationDesc.getResultName(),
MethodMarshallerUtils.numOutputBodyParams(pds) > 0);
} else {
returnElement = MethodMarshallerUtils
- .getReturnElement(packages, message, byJavaType, false, null, null,
+ .getReturnElement(packages, message, byJavaType, operationDesc.isListType(), false, null, null,
MethodMarshallerUtils.numOutputBodyParams(pds) > 0);
hasReturnInBody = true;
}
@@ -258,7 +258,7 @@
} else {
returnElement = new Element(returnObject, returnQName, returnType);
}
- MethodMarshallerUtils.toMessage(returnElement, returnType,
+ MethodMarshallerUtils.toMessage(returnElement, returnType, operationDesc.isListType(),
marshalDesc, m,
byJavaType,
operationDesc.isResultHeader());
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?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- 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 Wed Jun 27 09:45:37 2007
@@ -306,6 +306,7 @@
}
MethodMarshallerUtils.toMessage(returnElement,
returnType,
+ operationDesc.isListType(),
marshalDesc,
m,
returnType, // force marshal by type
@@ -388,7 +389,7 @@
returnElement = MethodMarshallerUtils.getReturnElement(packages,
message,
returnType,
- // Hmm we may want to refine this
+ operationDesc.isListType(),
true, // is a header
operationDesc.getResultTargetNamespace(),
// header ns
@@ -399,7 +400,7 @@
returnElement = MethodMarshallerUtils.getReturnElement(packages,
message,
returnType,
- // Force Unmarshal by type
+ operationDesc.isListType(),
false,
null,
null,
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedPlusMethodMarshaller.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedPlusMethodMarshaller.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedPlusMethodMarshaller.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedPlusMethodMarshaller.java Wed Jun 27 09:45:37 2007
@@ -222,6 +222,7 @@
Class actualType = pd.getParameterActualType();
if (MethodMarshallerUtils.isNotJAXBRootElement(actualType, marshalDesc)) {
blkContext.setProcessType(actualType);
+ blkContext.setIsxmlList(pd.isListType());
}
}
block = message.getHeaderBlock(pd.getTargetNamespace(), localName, blkContext,
@@ -247,7 +248,7 @@
} else {
// Header result: Get the value from the headers
Element returnElement =
- MethodMarshallerUtils.getReturnElement(packages, message, null, true,
+ MethodMarshallerUtils.getReturnElement(packages, message, null, false, true,
operationDesc.getResultTargetNamespace(),
operationDesc.getResultPartName(),
false);
@@ -379,6 +380,7 @@
Annotation annos[] = actualType.getAnnotations();
if (annos == null || annos.length == 0) {
blkContext.setProcessType(actualType);
+ blkContext.setIsxmlList(pd.isListType());
}
}
}
@@ -507,8 +509,11 @@
Class byJavaType =
MethodMarshallerUtils.isNotJAXBRootElement(returnType, marshalDesc) ? returnType : null;
- MethodMarshallerUtils.toMessage(returnElement, returnType,
- marshalDesc, m,
+ MethodMarshallerUtils.toMessage(returnElement,
+ returnType,
+ operationDesc.isListType(),
+ marshalDesc,
+ m,
byJavaType,
true);
}
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?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- 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 Wed Jun 27 09:45:37 2007
@@ -242,6 +242,7 @@
// Trigger unmarshal by java type if necessary
if (unmarshalByJavaType != null && unmarshalByJavaType[i] != null) {
context.setProcessType(unmarshalByJavaType[i]);
+ context.setIsxmlList(pd.isListType());
}
// Unmarshal the object into a JAXB object or JAXBElement
@@ -418,6 +419,9 @@
// Marshal by type only if necessary
if (pde.getByJavaTypeClass() != null) {
context.setProcessType(pde.getByJavaTypeClass());
+ if(pde.getParam()!=null){
+ context.setIsxmlList(pde.getParam().isListType());
+ }
}
// Create a JAXBBlock out of the value.
@@ -460,6 +464,7 @@
*/
static void toMessage(Element returnElement,
Class returnType,
+ boolean isList,
MarshalServiceRuntimeDescription marshalDesc,
Message message,
Class marshalByJavaTypeClass,
@@ -471,6 +476,7 @@
JAXBBlockContext context = new JAXBBlockContext(marshalDesc.getPackages());
if (marshalByJavaTypeClass != null) {
context.setProcessType(marshalByJavaTypeClass);
+ context.setIsxmlList(isList);
}
// Create a JAXBBlock out of the value.
@@ -504,6 +510,7 @@
static Element getReturnElement(TreeSet<String> packages,
Message message,
Class unmarshalByJavaTypeClass, // normally null
+ boolean isList,
boolean isHeader,
String headerNS,
String headerLocalPart,
@@ -515,6 +522,7 @@
JAXBBlockContext context = new JAXBBlockContext(packages);
if (unmarshalByJavaTypeClass != null && !isHeader) {
context.setProcessType(unmarshalByJavaTypeClass);
+ context.setIsxmlList(isList);
}
Block block = null;
if (isHeader) {
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org