axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ashut...@apache.org
Subject svn commit: r219693 - in /webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/src/org/apache/axis/jaxrpc: client/ handler/ handler/soap/
Date Tue, 19 Jul 2005 14:17:34 GMT
Author: ashutosh
Date: Tue Jul 19 07:17:32 2005
New Revision: 219693

URL: http://svn.apache.org/viewcvs?rev=219693&view=rev
Log:
Trying to integrate JAX-RPC handler with Axis2. JAX-RPC MessageContext and SOAPMessageContext
will maintain an instance of Axis2 MC.
Also, Axis2Handler class extends AbstractHandler of Axis2 and maintains an instance of jax-rpc
handler

Added:
    webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/src/org/apache/axis/jaxrpc/handler/Axis2Handler.java
Modified:
    webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/src/org/apache/axis/jaxrpc/client/BindingProviderImpl.java
    webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/src/org/apache/axis/jaxrpc/client/ServiceImpl.java
    webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/src/org/apache/axis/jaxrpc/handler/MessageContextImpl.java
    webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/src/org/apache/axis/jaxrpc/handler/soap/SOAPMessageContextImpl.java

Modified: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/src/org/apache/axis/jaxrpc/client/BindingProviderImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/src/org/apache/axis/jaxrpc/client/BindingProviderImpl.java?rev=219693&r1=219692&r2=219693&view=diff
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/src/org/apache/axis/jaxrpc/client/BindingProviderImpl.java
(original)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/src/org/apache/axis/jaxrpc/client/BindingProviderImpl.java
Tue Jul 19 07:17:32 2005
@@ -60,5 +60,11 @@
 	public void setBinding(BindingImpl binding) {
 		this.binding = binding;
 	}
+	
+	public List getHandlerChain(){
+		// For now just returning ServiceHandlerChain. Later may decide
+		// on what basis should take handlers from bindingHandlerChain and portHandlerChain
+		return serviceHandlerChain;
+	}
 
 }

Modified: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/src/org/apache/axis/jaxrpc/client/ServiceImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/src/org/apache/axis/jaxrpc/client/ServiceImpl.java?rev=219693&r1=219692&r2=219693&view=diff
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/src/org/apache/axis/jaxrpc/client/ServiceImpl.java
(original)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/src/org/apache/axis/jaxrpc/client/ServiceImpl.java
Tue Jul 19 07:17:32 2005
@@ -33,6 +33,7 @@
 import javax.xml.rpc.Stub;
 import javax.xml.rpc.Service.Mode;
 import javax.xml.rpc.encoding.TypeMappingRegistry;
+import javax.xml.rpc.handler.AbstractHandler;
 import javax.xml.rpc.handler.HandlerInfo;
 import javax.xml.rpc.handler.HandlerRegistry;
 import javax.xml.rpc.security.SecurityConfiguration;
@@ -45,6 +46,8 @@
 import org.apache.axis.jaxrpc.JAXRPCWSDLInterface;
 import org.apache.axis.jaxrpc.JAXRPCWSDL11Interface;
 import org.apache.axis.jaxrpc.factory.WSDLFactoryImpl;
+import org.apache.axis.jaxrpc.handler.Axis2Handler;
+import org.apache.axis2.engine.Phase;
 
 /**
  * @author sunja07
@@ -64,6 +67,25 @@
 	
 	private javax.wsdl.Service wsdlService = null;
 	
+	private Phase createAxis2Phase(BindingProviderImpl bp){
+		Phase jaxRpcPhase = new Phase("JAXRPCPhase");
+		List jaxRpcHandlerList = new ArrayList();
+		jaxRpcHandlerList.addAll(bp.getHandlerChain());
+		Iterator handlerIter = jaxRpcHandlerList.iterator();
+		while(handlerIter.hasNext()){
+			Object handlerObject = handlerIter.next();
+			Axis2Handler axisHandler = null;
+			if(handlerObject instanceof AbstractHandler){
+				axisHandler = new Axis2Handler((AbstractHandler)handlerObject);
+			}
+			if(axisHandler != null){
+				jaxRpcPhase.addHandler(axisHandler);
+			}
+		}
+		
+		return jaxRpcPhase;
+	}
+	
 	/**
 	 * Method createCall
 	 * Creates a Call object not associated with specific operation or target 
@@ -79,6 +101,9 @@
 		((CallImpl)call).portHandlerChain = this.handlerRegistry.portHandlerChain;
 		((CallImpl)call).bindingHandlerChain = this.handlerRegistry.bindingHandlerChain;
 		((CallImpl)call).setBinding(new BindingImpl());
+		//CREATE SOME WRAPPER FUNCTION HERE TO CONVERT ALL THE JAX-RPC
+		//INFORMATION TO AXIS2 INFORMATION(SPECIFICALLY HANDLER INFO) 
+		Phase jaxRpcPhase = createAxis2Phase((CallImpl)call);
 		return call;
 	}
 	

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/src/org/apache/axis/jaxrpc/handler/Axis2Handler.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/src/org/apache/axis/jaxrpc/handler/Axis2Handler.java?rev=219693&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/src/org/apache/axis/jaxrpc/handler/Axis2Handler.java
(added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/src/org/apache/axis/jaxrpc/handler/Axis2Handler.java
Tue Jul 19 07:17:32 2005
@@ -0,0 +1,33 @@
+package org.apache.axis.jaxrpc.handler;
+
+import org.apache.axis.jaxrpc.handler.soap.SOAPMessageContextImpl;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.engine.AxisFault;
+import org.apache.axis2.handlers.AbstractHandler;
+
+public class Axis2Handler extends AbstractHandler {
+	
+	private javax.xml.rpc.handler.AbstractHandler jaxRpcHandler;
+	
+	public Axis2Handler(){
+		//Default constructor, jaxRpcHandler will be set through setter method
+	}
+	
+	public Axis2Handler(javax.xml.rpc.handler.AbstractHandler jaxRpcHandler){
+		this.jaxRpcHandler = jaxRpcHandler;
+	}
+	
+	public void setJaxRpcHandler(javax.xml.rpc.handler.AbstractHandler handler){
+		jaxRpcHandler = handler;
+	}
+	
+	public javax.xml.rpc.handler.AbstractHandler getJaxRpcHandler(){
+		return jaxRpcHandler;
+	}
+
+	public void invoke(MessageContext mc) throws AxisFault {
+		//Call the handlerMessage() method from 
+		jaxRpcHandler.handleMessage(new SOAPMessageContextImpl(mc));
+	}
+
+}

Modified: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/src/org/apache/axis/jaxrpc/handler/MessageContextImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/src/org/apache/axis/jaxrpc/handler/MessageContextImpl.java?rev=219693&r1=219692&r2=219693&view=diff
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/src/org/apache/axis/jaxrpc/handler/MessageContextImpl.java
(original)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/src/org/apache/axis/jaxrpc/handler/MessageContextImpl.java
Tue Jul 19 07:17:32 2005
@@ -8,12 +8,14 @@
 public class MessageContextImpl implements MessageContext {
 	
 	/**
-	 * HashMap to hold peroperties, key is the propertyName, and value is a
-	 * class with keyValue and scopeValue
+	 * No scope information is present in Axis2, so am just adding it in
+	 * a separate HashMap
 	 */
-	protected HashMap<String, PropVals> properties;
+	protected HashMap<String, Scope> propertyScopes = new HashMap<String, Scope>();
 	
-	protected class PropVals{
+	protected org.apache.axis2.context.MessageContext axisMC;
+	
+	/*protected class PropVals{
 		Object value;
 		Scope propScope;
 		
@@ -21,78 +23,68 @@
 			this.value = value;
 			this.propScope = scope;
 		}
-	}
+	}*/
+	
 	
-	public MessageContextImpl(){
-		properties = new HashMap<String, PropVals>();
+	/**
+	 * The JAX-RPC MessageContext is prepared from Axis2 MessageContext, we
+	 * delegate all the setters and getters methods to Axis2 MC whenever
+	 * possible
+	 */
+	public MessageContextImpl(org.apache.axis2.context.MessageContext amc){
+		axisMC = amc;
 	}
 
 	public void setPropertyScope(String name, Scope scope)
 			throws IllegalArgumentException {
-		
-		PropVals property = properties.get(name);
-		if(property != null)
-			property.propScope = scope;
+		//No scope information is present in Axis2, so am just adding it in
+		// a separate HashMap
+		propertyScopes.put(name, scope);
 
 	}
 
 	public Scope getPropertyScope(String name) throws IllegalArgumentException {
-		
-		PropVals property = properties.get(name);
-		if(property != null)
-			return property.propScope;
-		return null;
+		return propertyScopes.get(name);
 	}
 
 	public void setProperty(String name, Object value)
 			throws IllegalArgumentException, UnsupportedOperationException {
 		
-		PropVals property = properties.get(name);
-		if(property != null)
-			property.value = value;
-		else
-			properties.put(name, new PropVals(value, Scope.HANDLER)); //Using HANDLER as the default
scope
-										// not sure which one should be default or if scope can be null
-
+		axisMC.setProperty(name, value);
+		propertyScopes.put(name, Scope.HANDLER); //Using HANDLER as the default scope
+			//	  not sure which one should be default or if scope can be null
 	}
 
 	public void setProperty(String name, Object value, Scope scope)
 			throws IllegalArgumentException, UnsupportedOperationException {
 		
-		PropVals property = properties.get(name);
-		if(property != null){
-			property.value = value;
-			property.propScope = scope;
-		} else
-			properties.put(name, new PropVals(value, scope));
-
+		axisMC.setProperty(name, value);
+		propertyScopes.put(name, scope);
 	}
 
 	public Object getProperty(String name) throws IllegalArgumentException {
 		
-		PropVals property = properties.get(name);
-		if(property != null)
-			return property.value;
-		return null;
+		return axisMC.getProperty(name);
 	}
 
 	public void removeProperty(String name) throws IllegalArgumentException {
 		
-		properties.remove(name);
+		throw new UnsupportedOperationException("removing a property not supported" +
+		" in underlying Axis2 MessageContext");
 	}
 
 	public boolean containsProperty(String name) {
 		
-		PropVals property = properties.get(name);
-		if(property != null)
+		Object value = axisMC.getProperty(name);
+		if(value != null)
 			return true;
 		else
 			return false;
 	}
 
 	public Iterator getPropertyNames() {
-		
-		return properties.keySet().iterator();
+		// Returning by reading values from the propertyScope for now, may not be correct
+		return propertyScopes.keySet().iterator();
 	}
 
 }

Modified: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/src/org/apache/axis/jaxrpc/handler/soap/SOAPMessageContextImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/src/org/apache/axis/jaxrpc/handler/soap/SOAPMessageContextImpl.java?rev=219693&r1=219692&r2=219693&view=diff
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/src/org/apache/axis/jaxrpc/handler/soap/SOAPMessageContextImpl.java
(original)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/src/org/apache/axis/jaxrpc/handler/soap/SOAPMessageContextImpl.java
Tue Jul 19 07:17:32 2005
@@ -12,21 +12,36 @@
 
 /*
  * Need to do something more in this class for faults and error messages?
+ * or atleast provide some more setters and getters to hook on to underlying
+ * Axis2 MC
  */
 public class SOAPMessageContextImpl extends MessageContextImpl implements SOAPMessageContext
{
 
-	private SOAPMessage message;
+	//private SOAPMessage message;
+	
 	private String[] roles;
 	
+	/**
+	 * The JAX-RPC MessageContext is prepared from Axis2 MessageContext, we
+	 * delegate all the setters and getters methods to Axis2 MC whenever
+	 * possible
+	 */
+	public SOAPMessageContextImpl(org.apache.axis2.context.MessageContext amc){
+		super(amc);
+	}
 	
 	public SOAPMessage getMessage() {
-		
-		return message;
+		javax.xml.soap.SOAPEnvelope env = new org.apache.axis2.saaj.SOAPEnvelopeImpl(axisMC.getEnvelope());
+		return new org.apache.axis2.saaj.SOAPMessageImpl(env);
 	}
 
 	public void setMessage(SOAPMessage message) throws JAXRPCException,
 			UnsupportedOperationException {
-		this.message = message;
+		try{
+			axisMC.setEnvelope(((org.apache.axis2.saaj.SOAPEnvelopeImpl)(message.getSOAPPart().getEnvelope())).getOMEnvelope());
+		} catch(javax.xml.soap.SOAPException e){
+			throw new JAXRPCException(e);
+		}
 	}
 
 	public Object[] getHeaders(QName header, JAXBContext context,



Mime
View raw message