axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hemap...@apache.org
Subject svn commit: r354536 - in /webservices/axis2/trunk/java/modules/core/src/org/apache/axis2: client/WSDLMEPClientBuilder.java description/AxisService.java
Date Tue, 06 Dec 2005 20:34:21 GMT
Author: hemapani
Date: Tue Dec  6 12:34:16 2005
New Revision: 354536

URL: http://svn.apache.org/viewcvs?rev=354536&view=rev
Log:
updates to the Dynamic invoker, the wrappers for the MEPClients are comming

Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/WSDLMEPClientBuilder.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/WSDLMEPClientBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/WSDLMEPClientBuilder.java?rev=354536&r1=354535&r2=354536&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/WSDLMEPClientBuilder.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/WSDLMEPClientBuilder.java
Tue Dec  6 12:34:16 2005
@@ -23,12 +23,21 @@
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.wsdl.WSDLConstants;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.context.ServiceGroupContext;
+import org.apache.axis2.deployment.DeploymentException;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisOperationFactory;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.AxisServiceGroup;
 import org.apache.axis2.wsdl.WSDLVersionWrapper;
 import org.apache.axis2.wsdl.builder.WOMBuilder;
 import org.apache.axis2.wsdl.builder.WOMBuilderFactory;
 import org.apache.wsdl.WSDLBinding;
 import org.apache.wsdl.WSDLBindingOperation;
+import org.apache.wsdl.WSDLConstants;
 import org.apache.wsdl.WSDLDescription;
 import org.apache.wsdl.WSDLEndpoint;
 import org.apache.wsdl.WSDLInterface;
@@ -40,15 +49,20 @@
 public class WSDLMEPClientBuilder {
 	private boolean isoneway= false;
 	private WSDLDescription description;
-	private String clienthome;
+	private ConfigurationContext configurationContext;
 	
-	public WSDLMEPClientBuilder(String clienthome){
-		this.clienthome = clienthome;
+	public WSDLMEPClientBuilder(String clienthome) throws AxisFault{
+		try{
+		configurationContext = new ConfigurationContextFactory().buildClientConfigurationContext(clienthome);
+		}catch(DeploymentException e){
+			throw new AxisFault(e);
+		}
 	}
 	
 	public void defineDescription(URL wsdlurl)throws AxisFault{
 		try {
-			WOMBuilder buider = WOMBuilderFactory.getBuilder(WSDLConstants.WSDL_1_1);
+			
+			WOMBuilder buider = WOMBuilderFactory.getBuilder(org.apache.axis2.wsdl.WSDLConstants.WSDL_1_1);
 			WSDLVersionWrapper vw = buider.build(wsdlurl.openStream());
 			description = vw.getDescription();
 		} catch (Exception e) {
@@ -64,13 +78,16 @@
 	}
 	
 	public MEPClient createMEPClient(QName servicename, QName endpointname,String operationname)
throws AxisFault{
+		if(description == null){
+			throw new AxisFault("You need to call public void defineDescription(URL wsdlurl before
this method)");
+		}
 		WSDLService service = findService(servicename);
+		AxisService serviceDesc = new AxisService(service);
+		
 		WSDLEndpoint endpoint = findEndpoint(endpointname,service);
 		EndpointReference toepr = null;
-		String soapAction = "";
 		Options op = new Options();
 		
-		
 		Iterator elements = endpoint.getExtensibilityElements().iterator();
         while (elements.hasNext()) {
                 Object obj = elements.next();
@@ -89,7 +106,24 @@
         }
 
         WSDLBinding binding = endpoint.getBinding();
+        
+        //let us configure the complete AxisService out of this, not the current the Operation
only
+        Iterator bindings = binding.getBindingOperations().values().iterator();
+        while(bindings.hasNext()){
+        	WSDLBindingOperation wsdlbop =(WSDLBindingOperation)bindings.next();
+        	WSDLOperation wsdlop = wsdlbop.getOperation();
+        	AxisOperation axisOp =  AxisOperationFactory.getAxisOperation(findMEP(wsdlop));
+        	axisOp.setName(wsdlop.getName());
+        	serviceDesc.addOperation(axisOp);
+        }
+        
+        //This part is compelte mess .. I think we need to look closly at the ServiceGroups
 ..time been this works
+        configurationContext.getAxisConfiguration().addService(serviceDesc);
+        AxisServiceGroup serviceGroup = new AxisServiceGroup(configurationContext.getAxisConfiguration());
+        ServiceGroupContext serviceGroupContext = new ServiceGroupContext(configurationContext,serviceGroup);
+        ServiceContext serviceContext =  new ServiceContext(serviceDesc,serviceGroupContext);
 
+        
         WSDLOperation wsdlop = getOperation(operationname,endpoint);
         
         WSDLBindingOperation bop = binding.getBindingOperation(wsdlop.getName());
@@ -104,11 +138,13 @@
         }
         
         
-        MEPClient mepclient = new MessageSender(clienthome);
+        
+        
+        MEPClient mepclient = null;
         if(wsdlop.getInputMessage() != null && wsdlop.getOutputMessage() != null
&& !isoneway){
-        	mepclient = new Call(clienthome);
+        	mepclient = new InOutMEPClient(serviceContext);
         }else if(wsdlop.getInputMessage() != null || isoneway){
-            mepclient = new MessageSender(clienthome);        	
+            mepclient = new InOnlyMEPClient(serviceContext);      	
         }else{
         	throw new AxisFault("Unknown MEP");
         }
@@ -175,4 +211,38 @@
 	public void setIsoneway(boolean isoneway) {
 		this.isoneway = isoneway;
 	}
+	
+	
+	private int findMEP(WSDLOperation wsdlOp) throws AxisFault{
+		if(wsdlOp.getInputMessage() == null){
+			throw new AxisFault("Unsupported MEP");
+		}
+		if(wsdlOp.getOutputMessage() == null){
+			return WSDLConstants.MEP_CONSTANT_IN_ONLY;
+		}else{
+			return WSDLConstants.MEP_CONSTANT_IN_OUT;
+		}
+	}
+	
+//	public static void main(String[] args) throws Exception{
+//		WSDLMEPClientBuilder builder = new WSDLMEPClientBuilder("/home/hemapani/tools/axis2-0.93-SNAPSHOT-bin/repository/");
+//		//builder.defineDescription(new URL("http://mssoapinterop.org/asmx/WSDL/InteropTestDocLit.wsdl"));
+//		builder.defineDescription(new File("/home/hemapani/temp/InteropTestDocLit.wsdl").toURL());
+//		InOutMEPClient mepclient = (InOutMEPClient)builder.createMEPClient("echoStruct");
+//		
+//		String message= "<echoStructParam xmlns=\"http://soapinterop.org/xsd\"><varFloat>23.4</varFloat>\"<varInt>35</varInt><varString>Hello1</varString></echoStructParam>";
+//		XMLStreamReader in = XMLInputFactory.newInstance().createXMLStreamReader(new ByteArrayInputStream(message.getBytes()));
+//		StAXOMBuilder omb = new StAXOMBuilder(in);
+//		
+//		AxisOperation opDesc = AxisOperationFactory.getAxisOperation(AxisOperationFactory.MEP_CONSTANT_IN_OUT);
+//		opDesc.setName(new QName("http://soapinterop.org","echoStruct"));
+//		MessageContext msgctx= new MessageContext(mepclient.getServiceContext().getConfigurationContext());
+//		
+//		SOAPFactory soapFactory = new SOAP11Factory();
+//		SOAPEnvelope envelope = soapFactory.getDefaultEnvelope();
+//		envelope.getBody().setFirstChild(omb.getDocumentElement());
+//		msgctx.setEnvelope(envelope);
+//		
+//		mepclient.invokeBlocking(opDesc,msgctx);
+//	}
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java?rev=354536&r1=354535&r2=354536&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
Tue Dec  6 12:34:16 2005
@@ -66,7 +66,7 @@
     private String axisServiceName;
     private String fileName = "";
 
-    private WSDLServiceImpl serviceimpl = null;
+    private WSDLService serviceimpl = null;
 
     private HashMap wsaaction_operationmap = null;
 
@@ -81,7 +81,7 @@
      * Constructor AxisService
      */
 
-    public AxisService(WSDLServiceImpl serviceimpl) {
+    public AxisService(WSDLService serviceimpl) {
         this.serviceimpl = serviceimpl;
         this.wsaaction_operationmap = new HashMap();
         this.setComponentProperty(PARAMETER_KEY, new ParameterIncludeImpl());



Mime
View raw message