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 ch...@apache.org on 2005/06/23 12:20:21 UTC

svn commit: r193126 - in /webservices/axis/trunk/java/modules: core/src/org/apache/axis/context/ wsdl/src/org/apache/axis/wsdl/builder/wsdl4j/ wsdl/src/org/apache/axis/wsdl/codegen/ wsdl/src/org/apache/axis/wsdl/codegen/emitter/ wsdl/src/org/apache/wsd...

Author: chathura
Date: Thu Jun 23 03:20:18 2005
New Revision: 193126

URL: http://svn.apache.org/viewcvs?rev=193126&view=rev
Log:
FIxed the issue of getting the namespace URIs for the Schema element. Added the programatic functionality required for the generation of the Message Receiver. The template is not included.

Modified:
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/OperationContext.java
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/builder/wsdl4j/WSDL1ToWOMBuilder.java
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/builder/wsdl4j/WSDLPump.java
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenConfiguration.java
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/XSLTConstants.java
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/WSDLDescription.java
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/WSDLDescriptionImpl.java

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/OperationContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/OperationContext.java?rev=193126&r1=193125&r2=193126&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/OperationContext.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/OperationContext.java Thu Jun 23 03:20:18 2005
@@ -144,7 +144,7 @@
      * @return
      * @throws AxisFault
      */
-    public MessageContext getMessageContext(byte messageLabel) throws AxisFault {
+    public MessageContext getMessageContext(int messageLabel) throws AxisFault {
         if (messageLabel == WSDLConstants.MESSAGE_LABEL_IN) {
             return inMessageContext;
         } else if (messageLabel == WSDLConstants.MESSAGE_LABEL_OUT) {

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/builder/wsdl4j/WSDL1ToWOMBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/builder/wsdl4j/WSDL1ToWOMBuilder.java?rev=193126&r1=193125&r2=193126&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/builder/wsdl4j/WSDL1ToWOMBuilder.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/builder/wsdl4j/WSDL1ToWOMBuilder.java Thu Jun 23 03:20:18 2005
@@ -48,7 +48,7 @@
     }
     
     public WSDLDescription build (InputStream in, WSDLComponentFactory wsdlComponentFactory) throws WSDLException{
-    	WSDLDescription wsdlDefinitions = new WSDLDescriptionImpl();
+    	WSDLDescription wsdlDefinitions = wsdlComponentFactory.createDescription();
 
         WSDLPump pump = new WSDLPump(wsdlDefinitions, this.readInTheWSDLFile(in), wsdlComponentFactory);
         pump.pump();

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/builder/wsdl4j/WSDLPump.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/builder/wsdl4j/WSDLPump.java?rev=193126&r1=193125&r2=193126&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/builder/wsdl4j/WSDLPump.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/builder/wsdl4j/WSDLPump.java Thu Jun 23 03:20:18 2005
@@ -115,6 +115,7 @@
 		wsdlDefinition.setWSDL1DefinitionName(wsdl4JDefinition.getQName());
 		wsdlDefinition
 				.setTargetNameSpace(wsdl4JDefinition.getTargetNamespace());
+		wsdlDefinition.setNamespaces(wsdl4JDefinition.getNamespaces());
 		this.copyExtensibleElements(wsdl4JDefinition.getExtensibilityElements(), wsdlDefinition);		
 
 		/////////////////////////////////////////////////////////////////////
@@ -135,10 +136,7 @@
 		Types wsdl4jTypes = wsdl4JDefinition.getTypes();
 		if (null != wsdl4jTypes) {
 			WSDLTypes wsdlTypes = this.wsdlComponenetFactory.createTypes();
-			
-//			Schema schema = (Schema)wsdlTypes.getExtensibilityElements();
-//			Element element = schema.getElement();
-			
+					
 			
 			this.copyExtensibleElements(wsdl4jTypes.getExtensibilityElements(),
 					wsdlTypes);			

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenConfiguration.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenConfiguration.java?rev=193126&r1=193125&r2=193126&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenConfiguration.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenConfiguration.java Thu Jun 23 03:20:18 2005
@@ -38,6 +38,7 @@
     private boolean serverSide=false;
     private boolean generateDeployementDescriptor=true;
     private boolean writeTestCase=false;
+    private boolean writeMessageReceiver = true;
     private String packageName=XSLTConstants.DEFAULT_PACKAGE_NAME;
 
 
@@ -159,4 +160,12 @@
     public boolean isWriteTestCase() {
         return writeTestCase;
     }
+    
+    
+	public boolean isWriteMessageReceiver() {
+		return writeMessageReceiver;
+	}
+	public void setWriteMessageReceiver(boolean writeMessageReceiver) {
+		this.writeMessageReceiver = writeMessageReceiver;
+	}
 }

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/XSLTConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/XSLTConstants.java?rev=193126&r1=193125&r2=193126&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/XSLTConstants.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/XSLTConstants.java Thu Jun 23 03:20:18 2005
@@ -85,4 +85,10 @@
      public interface XSLTServiceXMLTemplates{
     	public static final String GENERAL_SERVICE_TEMPLATE = "/org/apache/axis/wsdl/template/general/ServiceXMLTemplate.xsl";
     }
+     
+     public interface XSLTMessageReceiverTemplates{
+     	public static final String JAVA_TEMPLATE = "/org/apache/axis/wsdl/template/java/MessageReceiverTemplate.xsl";
+     }
+     
+     
 }

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java?rev=193126&r1=193125&r2=193126&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java Thu Jun 23 03:20:18 2005
@@ -7,6 +7,7 @@
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.Map;
 
 import org.apache.axis.wsdl.codegen.CodeGenConfiguration;
 import org.apache.axis.wsdl.codegen.CodeGenerationException;
@@ -17,6 +18,7 @@
 import org.apache.axis.wsdl.codegen.writer.ClassWriter;
 import org.apache.axis.wsdl.codegen.writer.InterfaceImplementationWriter;
 import org.apache.axis.wsdl.codegen.writer.InterfaceWriter;
+import org.apache.axis.wsdl.codegen.writer.MessageReceiverWriter;
 import org.apache.axis.wsdl.codegen.writer.ServiceXMLWriter;
 import org.apache.axis.wsdl.codegen.writer.SkeletonWriter;
 import org.apache.axis.wsdl.codegen.writer.TestClassWriter;
@@ -79,6 +81,7 @@
     private static final String SERVICE_CLASS_SUFFIX ="Skeleton";
     private static final String TEST_PACKAGE_NAME_SUFFIX =".test";
     private static final String TEST_SERVICE_CLASS_NAME_SUFFIX ="SkeletonTest";
+    private static final String MESSAGE_RECEIVER_SUFFIX = "MessageReceiver";
     
 
     protected InputStream xsltStream = null;
@@ -113,7 +116,7 @@
             WSDLBinding axisBinding = wom.getBinding(AxisBindingBuilder.AXIS_BINDING_QNAME);
             WSDLService axisService = null;
             //write interfaces
-            HashMap services = wom.getServices();
+            Map services = wom.getServices();
             if (!services.isEmpty()) {
                 if (services.size()==1){
                     axisService = (WSDLService)services.values().toArray()[0];
@@ -249,13 +252,24 @@
      * @throws Exception
      */
     protected void writeInterfaceImplementation(WSDLBinding axisBinding,WSDLService service) throws Exception {
-        XmlDocument interfaceImplModel = createDOMDocuementForInterfaceImplementation(axisBinding, service);
+        XmlDocument interfaceImplModel = createDOMDocuementForInterfaceImplementation(axisBinding, service);        
         InterfaceImplementationWriter writer =
                 new InterfaceImplementationWriter(this.configuration.getOutputLocation(),
                         this.configuration.getOutputLanguage()
                 );
         writeClass(interfaceImplModel,writer);
     }
+    
+    protected void writeMessageReceiver(WSDLBinding axisBinding)throws Exception{
+    	if (configuration.isWriteMessageReceiver()){
+            XmlDocument classModel = createDocumentForMessageReceiver(axisBinding);
+            MessageReceiverWriter writer =
+                    new MessageReceiverWriter(this.configuration.getOutputLocation(),
+                            this.configuration.getOutputLanguage()
+                    );
+            writeClass(classModel,writer);
+        }
+    }
 
     /**
      * todo Not used yet
@@ -283,7 +297,7 @@
      * @throws IOException
      * @throws Exception
      */
-    private void writeClass(XmlDocument model,ClassWriter writer) throws IOException,Exception {
+    protected void writeClass(XmlDocument model,ClassWriter writer) throws IOException,Exception {
         ByteArrayOutputStream memoryStream = new ByteArrayOutputStream();
         model.write(memoryStream);
         writer.loadTemplate();
@@ -294,6 +308,7 @@
     
     
 
+
     /**
      * @see org.apache.axis.wsdl.codegen.emitter.Emitter#emitSkeleton()
      */
@@ -311,12 +326,15 @@
             writeTestSkeletonImpl(axisBinding);
             //write a testservice.xml that will load the dummy skeleton impl for testing
             writeTestServiceXML(axisBinding);
+            //write a MessageReceiver for this particular service.
+            writeMessageReceiver(axisBinding);
         } catch (Exception e) {
             e.printStackTrace();
             throw new CodeGenerationException(e);
         }
     }
 
+     
     
     protected XmlDocument createDocumentForTestSkeltonImpl(WSDLBinding binding){
     	WSDLInterface boundInterface = binding.getBoundInterface();
@@ -420,6 +438,28 @@
         loadOperations(boundInterface, doc, rootElement);
         doc.appendChild(rootElement);
 
+        return doc;
+    }
+    
+    
+    protected XmlDocument createDocumentForMessageReceiver(WSDLBinding binding){
+    	WSDLInterface boundInterface = binding.getBoundInterface();
+
+        XmlDocument doc = new XmlDocument();
+        Element rootElement = doc.createElement("interface");
+        addAttribute(doc,"package",configuration.getPackageName(), rootElement);
+        addAttribute(doc,"name",boundInterface.getName().getLocalPart()+MESSAGE_RECEIVER_SUFFIX,rootElement);
+        addAttribute(doc,"skeletonname",boundInterface.getName().getLocalPart() + SERVICE_CLASS_SUFFIX,rootElement);
+        addAttribute(doc, "basereceiver", "org.apache.axis.receivers.RawXMLINOutMessageRecevier", rootElement);
+        fillSyncAttributes(doc, rootElement);
+        loadOperations(boundInterface, doc, rootElement);
+        doc.appendChild(rootElement);
+        try {
+			doc.write(System.out);
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
         return doc;
     }
     /**

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/WSDLDescription.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/WSDLDescription.java?rev=193126&r1=193125&r2=193126&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/WSDLDescription.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/WSDLDescription.java Thu Jun 23 03:20:18 2005
@@ -16,7 +16,7 @@
 package org.apache.wsdl;
 
 import java.util.ArrayList;
-import java.util.HashMap;
+import java.util.Map;
 
 import javax.xml.namespace.QName;
 
@@ -32,14 +32,14 @@
      *
      * @return
      */
-    public HashMap getBindings();
+    public Map getBindings();
 
     /**
      * Sets the whole new set of Bindings to the WSDLDefinition.
      *
      * @param bindings
      */
-    public void setBindings(HashMap bindings);
+    public void setBindings(Map bindings);
 
     /**
      * The WSDLBinding Will be added to the map keyed  with its own QName.
@@ -83,14 +83,14 @@
      *
      * @return
      */
-    public HashMap getServices();
+    public Map getServices();
 
     /**
      * Method setServices
      *
      * @param services
      */
-    public void setServices(HashMap services);
+    public void setServices(Map services);
 
     /**
      * Will return the <code>WSDLService </code> if found otherwise return null.
@@ -129,14 +129,14 @@
      *
      * @return
      */
-    public HashMap getWsdlInterfaces();
+    public Map getWsdlInterfaces();
 
     /**
      * Method setWsdlInterfaces
      *
      * @param wsdlInterfaces
      */
-    public void setWsdlInterfaces(HashMap wsdlInterfaces);
+    public void setWsdlInterfaces(Map wsdlInterfaces);
 
     /**
      * Method getTypes
@@ -172,7 +172,7 @@
      *
      * @return
      */
-    public HashMap getNamespaces();
+    public Map getNamespaces();
 
     /**
      * Sets the Namespaces associated with the Difinition Component
@@ -180,7 +180,7 @@
      *
      * @param namespaces
      */
-    public void setNamespaces(HashMap namespaces);
+    public void setNamespaces(Map namespaces);
 
     /**
      * Will return the Namespace URI as a String if there exists an
@@ -293,7 +293,7 @@
     
     /**
      * Will return the first binding component the collection returned by the 
-     * <code>HashMap</code>.
+     * <code>Map</code>.
      * @return
      */
     public WSDLBinding getFirstBinding();

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/WSDLDescriptionImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/WSDLDescriptionImpl.java?rev=193126&r1=193125&r2=193126&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/WSDLDescriptionImpl.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/wsdl/impl/WSDLDescriptionImpl.java Thu Jun 23 03:20:18 2005
@@ -18,6 +18,7 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.Map;
 
 import javax.xml.namespace.QName;
 
@@ -71,18 +72,18 @@
     /**
      * This List will be a list of <code>WSDLInterface</code> objects.
      */
-    private HashMap wsdlInterfaces = new HashMap();
+    private Map wsdlInterfaces = new HashMap();
 
     /**
      * This <code>HashMap </code> is a Map of <code>WSDLBinding </code> objects.
      */
-    private HashMap bindings = new HashMap();
+    private Map bindings = new HashMap();
 
     /**
      * This <code>HashMap </code> is a list of <code>WSDLService </code> objects.
      * Support of multiple is backed by the requirements in the specification.
      */
-    private HashMap services = new HashMap();
+    private Map services = new HashMap();
 
     /**
      * WSDL imports
@@ -98,7 +99,7 @@
      * Will keep a map of all the Namespaces associated with the
      * Definition Component and will be keyed by the Namespace prefix.
      */
-    private HashMap namespaces = new HashMap();
+    private Map namespaces = new HashMap();
 
     /**
      * Returns a Map of <code>WSDLBindings</code> Objects keyed by the <code>QName</code>
@@ -106,7 +107,7 @@
      *
      * @return
      */
-    public HashMap getBindings() {
+    public Map getBindings() {
         return bindings;
     }
 
@@ -115,7 +116,7 @@
      *
      * @param bindings
      */
-    public void setBindings(HashMap bindings) {
+    public void setBindings(Map bindings) {
 
         // if(this.bindings.size() > 0) throw new WSDLProcessingException("WSDLBimding Map already contains " +
         // "one or more bindings. Trying to assign a new map will loose those Bindings.");
@@ -187,7 +188,7 @@
      *
      * @return
      */
-    public HashMap getServices() {
+    public Map getServices() {
         return services;
     }
 
@@ -196,7 +197,7 @@
      *
      * @param services
      */
-    public void setServices(HashMap services) {
+    public void setServices(Map services) {
         this.services = services;
     }
 
@@ -252,7 +253,7 @@
      *
      * @return
      */
-    public HashMap getWsdlInterfaces() {
+    public Map getWsdlInterfaces() {
         return wsdlInterfaces;
     }
 
@@ -261,7 +262,7 @@
      *
      * @param wsdlInterfaces
      */
-    public void setWsdlInterfaces(HashMap wsdlInterfaces) {
+    public void setWsdlInterfaces(Map wsdlInterfaces) {
         this.wsdlInterfaces = wsdlInterfaces;
     }
 
@@ -307,7 +308,7 @@
      *
      * @return
      */
-    public HashMap getNamespaces() {
+    public Map getNamespaces() {
         return namespaces;
     }
 
@@ -317,7 +318,7 @@
      *
      * @param namespaces
      */
-    public void setNamespaces(HashMap namespaces) {
+    public void setNamespaces(Map namespaces) {
         this.namespaces = namespaces;
     }