axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ashut...@apache.org
Subject svn commit: r220052 - in /webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws: src/org/apache/axis/jaxrpc/client/ test/org/apache/axis/jaxrpc/handler/soap/
Date Thu, 21 Jul 2005 12:41:12 GMT
Author: ashutosh
Date: Thu Jul 21 05:41:11 2005
New Revision: 220052

URL: http://svn.apache.org/viewcvs?rev=220052&view=rev
Log: (empty)

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/CallImpl.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/test/org/apache/axis/jaxrpc/handler/soap/ClientWithLoggingHandler.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=220052&r1=220051&r2=220052&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
Thu Jul 21 05:41:11 2005
@@ -26,6 +26,9 @@
 import javax.xml.rpc.JAXRPCContext;
 import javax.xml.rpc.handler.HandlerInfo;
 
+import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.engine.Phase;
+
 public class BindingProviderImpl implements BindingProvider {
 
 	protected JAXRPCRequestContext requestContext;
@@ -35,6 +38,9 @@
 	protected List<HandlerInfo> serviceHandlerChain;
 	protected Map<URI, List> bindingHandlerChain;
 	protected Map<QName, List> portHandlerChain;
+	
+	protected Phase jaxRpcPhase;
+	ServiceContext sContext;
 	
 	public BindingProviderImpl(){
 		//default constructor

Modified: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/src/org/apache/axis/jaxrpc/client/CallImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/src/org/apache/axis/jaxrpc/client/CallImpl.java?rev=220052&r1=220051&r2=220052&view=diff
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/src/org/apache/axis/jaxrpc/client/CallImpl.java
(original)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/src/org/apache/axis/jaxrpc/client/CallImpl.java
Thu Jul 21 05:41:11 2005
@@ -39,9 +39,9 @@
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMFactory;
 import org.apache.axis2.om.OMNamespace;
-import org.apache.axis2.om.OMOutput;
 import org.apache.axis2.clientapi.Callback;
 import org.apache.axis2.clientapi.AsyncResult;
+import org.apache.axis2.description.OperationDescription;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.addressing.AddressingConstants;
 
@@ -435,6 +435,13 @@
 		//Or else it could be a unnecessary memory hold up.
 		inputParams.clear();
 		operationName = opName;
+		
+		OperationDescription od = new OperationDescription(opName);
+		if(jaxRpcPhase != null){
+			od.setRemainingPhasesInFlow(jaxRpcPhase.getHandlers());
+			od.setPhasesOutFlow(jaxRpcPhase.getHandlers());
+		}
+		sContext.getServiceConfig().addOperation(od);
 	}
 
 	/**
@@ -627,7 +634,7 @@
 		
 		//TODO axis2Call object should actually be gotten somehow from underlying Axis2 engine
 		// may have to change the following line
-		org.apache.axis2.clientapi.Call axis2Call = new org.apache.axis2.clientapi.Call();
+		org.apache.axis2.clientapi.Call axis2Call = new org.apache.axis2.clientapi.Call(sContext);
 		axis2Call.setTo(new EndpointReference(AddressingConstants.WSA_TO,targetEndpointAddress));
 		OMElement response = axis2Call.invokeBlocking(operationName.getLocalPart(),methodElement);
 		

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=220052&r1=220051&r2=220052&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
Thu Jul 21 05:41:11 2005
@@ -47,7 +47,18 @@
 import org.apache.axis.jaxrpc.JAXRPCWSDL11Interface;
 import org.apache.axis.jaxrpc.factory.WSDLFactoryImpl;
 import org.apache.axis.jaxrpc.handler.Axis2Handler;
+import org.apache.axis2.clientapi.ListenerManager;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.description.OperationDescription;
+import org.apache.axis2.description.ServiceDescription;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.engine.AxisConfigurationImpl;
+import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.engine.AxisFault;
 import org.apache.axis2.engine.Phase;
+import org.apache.axis2.phaseresolver.PhaseResolver;
 
 /**
  * @author sunja07
@@ -68,22 +79,58 @@
 	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);
+		Phase jaxRpcPhase = null;
+		List jaxRpcHandlerList = null;
+		List list = bp.getHandlerChain();
+		if(list != null){
+			jaxRpcPhase = new Phase("JAXRPCPhase");
+			jaxRpcHandlerList = new ArrayList();
+			jaxRpcHandlerList.addAll(list);
+			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;
+		}
+		return null;
+	}
+	
+	private ServiceContext getAxis2Service(Phase p)throws AxisFault{
+		/*AxisConfiguration axisConfig = new AxisConfigurationImpl();
+		ConfigurationContext configContext = new ConfigurationContext(axisConfig);
+		AxisEngine engine = new AxisEngine(configContext);
+		return engine;*/
+		ServiceDescription description = new ServiceDescription();
+
+	    ConfigurationContext sysContext = null;
+	    try{
+		    if (ListenerManager.configurationContext == null) {
+		            ConfigurationContextFactory efac = new ConfigurationContextFactory();
+		            sysContext = efac.buildClientConfigurationContext(null);
+		    } else {
+		            sysContext = ListenerManager.configurationContext;
+		    }
+	    } catch(Exception e){
+	    	e.printStackTrace();
+	    }
+		/*OperationDescription od = new OperationDescription(new QName("TemplateOperatin")
+				);
+		if(p != null){
+		od.setRemainingPhasesInFlow(p.getHandlers());
+		od.setPhasesOutFlow(p.getHandlers());
 		}
-		
-		return jaxRpcPhase;
+		description.addOperation(od);*/
+		sysContext.getAxisConfiguration().addService(description);
+	    
+		ServiceContext sContext = new ServiceContext(description, sysContext);
+		return sContext;
 	}
 	
 	/**
@@ -103,7 +150,12 @@
 		((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);
+		try{
+			((CallImpl)call).jaxRpcPhase = createAxis2Phase((CallImpl)call);
+			((CallImpl)call).sContext = getAxis2Service(((CallImpl)call).jaxRpcPhase);
+		} catch (Exception e){
+			e.printStackTrace();
+		}
 		return call;
 	}
 	

Modified: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/test/org/apache/axis/jaxrpc/handler/soap/ClientWithLoggingHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/test/org/apache/axis/jaxrpc/handler/soap/ClientWithLoggingHandler.java?rev=220052&r1=220051&r2=220052&view=diff
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/test/org/apache/axis/jaxrpc/handler/soap/ClientWithLoggingHandler.java
(original)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/jaxws/test/org/apache/axis/jaxrpc/handler/soap/ClientWithLoggingHandler.java
Thu Jul 21 05:41:11 2005
@@ -3,6 +3,9 @@
 import junit.framework.TestCase;
 
 import javax.xml.namespace.QName;
+
+import java.io.BufferedOutputStream;
+import java.io.OutputStream;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.List;
@@ -14,6 +17,10 @@
 import javax.xml.rpc.handler.HandlerInfo;
 import javax.xml.rpc.handler.HandlerRegistry;
 
+import org.apache.axis.jaxrpc.client.ServiceImpl;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.impl.OMOutputImpl;
+
 public class ClientWithLoggingHandler extends TestCase {
 
 	public static void main(String[] args) {
@@ -25,8 +32,7 @@
 	
 	public void testDII() {
 		try {
-			ServiceFactory sf = ServiceFactory.newInstance();
-			Service s = sf.createService(new URL(getTestResourceDirectory()+ "/Echo.wsdl") , new QName("EchoService"));
+			Service s = new ServiceImpl();
 			
 			HandlerRegistry registry = s.getHandlerRegistry();
 			List<HandlerInfo> handlerList = new ArrayList<HandlerInfo>();
@@ -36,18 +42,25 @@
 			registry.setHandlerChain(handlerList);
 			
 			Call call = s.createCall();
-			call.addParameter("param1", new QName("Here the URL for XSD should be given","string"),
java.lang.String.class, ParameterMode.IN);
-			call.setReturnType(new QName("URL of XSD","string"), String.class);
+			call.setOperationName(new QName("http://testingURL.org/","EchoString"));
+			call.setTargetEndpointAddress("http://localhost:8080/axis/services/Echo");
+			call.addParameter("param1", new QName("http://www.w3.org/2001/XMLSchema","any"), java.lang.Object.class,
ParameterMode.IN);
+			call.setReturnType(new QName("http://www.w3.org/2001/XMLSchema","any"), Object.class);
 			Object[] inParams = new Object[]{"hello World!"};
-			String response = (String) call.invoke(inParams);
-			assertEquals("hello World!",response);
-		}catch (Exception e) {
+			OMElement response = (OMElement)call.invoke(inParams);
+			try {
+				OutputStream fos = new BufferedOutputStream(System.out);
+				OMOutputImpl otpt = new OMOutputImpl(fos, false);
+				response.serialize(otpt);
+				fos.flush();
+				otpt.flush();
+				} catch (Exception e){}
+
+		} catch (Exception e) {
+			e.printStackTrace();
 			fail(e.getMessage());
 		}
 	}
 	
-	private String getTestResourceDirectory() {
-		return "C:\\workspace\\3.1Workspace\\JAXRPC2_Work\\test-resources";
-	}
 
 }



Mime
View raw message