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/06 08:15:43 UTC
svn commit: r180236 - in /webservices/axis/trunk/java/modules:
core/src/org/apache/axis/receivers/ wsdl/src/org/apache/axis/wsdl/codegen/
wsdl/src/org/apache/axis/wsdl/codegen/emitter/
wsdl/src/org/apache/axis/wsdl/codegen/writer/
wsdl/src/org/apache/axis/wsdl/databinding/
wsdl/src/org/apache/axis/wsdl/template/general/
wsdl/src/org/apache/axis/wsdl/template/java/
Author: chathura
Date: Sun Jun 5 23:15:41 2005
New Revision: 180236
URL: http://svn.apache.org/viewcvs?rev=180236&view=rev
Log:
Fixed the server side stub generation along with a -t functionality that will generate a testcase and a sample dummy implementation and deploy a service in a SimpleHTTPServer and call the ws methods.
Added:
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/Constants.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/TestServiceXMLWriter.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/TestSkeltonImplWriter.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/TestSkeletonImplTemplate.xsl
Modified:
webservices/axis/trunk/java/modules/core/src/org/apache/axis/receivers/RawXMLINOutMessageRecevier.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/JavaEmitter.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/axis/wsdl/databinding/DefaultTypeMapper.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/databinding/TypeMappingAdapter.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/general/ServiceXMLTemplate.xsl
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/TestClassTemplate.xsl
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/receivers/RawXMLINOutMessageRecevier.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/receivers/RawXMLINOutMessageRecevier.java?rev=180236&r1=180235&r2=180236&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/receivers/RawXMLINOutMessageRecevier.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/receivers/RawXMLINOutMessageRecevier.java Sun Jun 5 23:15:41 2005
@@ -125,7 +125,39 @@
throw new AxisFault("Unknown style ");
}
newmsgContext.setEnvelope(envelope);
- } else {
+ } else if((parameters != null)
+ && (parameters.length == 0)){
+ SOAPEnvelope envelope = null;
+
+ String style = msgContext.getOperationContext().getAxisOperation().getStyle();
+
+ if (WSDLService.STYLE_DOC.equals(style)) {
+
+ Object[] parms = new Object[0];
+
+ // invoke the WebService
+ OMElement result = (OMElement) method.invoke(obj, parms);
+ envelope = OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope();
+ envelope.getBody().setFirstChild(result);
+
+ } else if (WSDLService.STYLE_RPC.equals(style)) {
+
+ Object[] parms = new Object[0];
+
+ // invoke the WebService
+ OMElement result = (OMElement) method.invoke(obj, parms);
+ SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
+ envelope = fac.getDefaultEnvelope();
+
+ OMNamespace ns = fac.createOMNamespace("http://soapenc/", "res");
+ OMElement responseMethodName = fac.createOMElement(methodName + "Response", ns);
+ responseMethodName.addChild(result);
+ envelope.getBody().addChild(responseMethodName);
+ } else {
+ throw new AxisFault("Unknown style ");
+ }
+ newmsgContext.setEnvelope(envelope);
+ }else {
throw new AxisFault(
"Raw Xml provider supports only the methods bearing the signature public OMElement "
+ "<method-name>(OMElement) where the method name is anything");
Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/Constants.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/Constants.java?rev=180236&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/Constants.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/Constants.java Sun Jun 5 23:15:41 2005
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.wsdl.codegen;
+
+/**
+ * @author chathura@opensource.lk
+ *
+ */
+public class Constants {
+ public static int TEST_PORT =5555;
+}
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=180236&r1=180235&r2=180236&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 Sun Jun 5 23:15:41 2005
@@ -77,6 +77,10 @@
public static final String JAVA_TEMPLATE = "/org/apache/axis/wsdl/template/java/TestClassTemplate.xsl";
public static final String CSHARP_TEMPLATE = "/org/apache/axis/wsdl/template/csharp/TestClassTemplate.xsl";
}
+
+ public interface XSLTTestSkeltonImplTemplates{
+ public static final String JAVA_TEMPLATE = "/org/apache/axis/wsdl/template/java/TestSkeletonImplTemplate.xsl";
+ }
public interface XSLTServiceXMLTemplates{
public static final String GENERAL_SERVICE_TEMPLATE = "/org/apache/axis/wsdl/template/general/ServiceXMLTemplate.xsl";
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/JavaEmitter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/JavaEmitter.java?rev=180236&r1=180235&r2=180236&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/JavaEmitter.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/JavaEmitter.java Sun Jun 5 23:15:41 2005
@@ -1,6 +1,7 @@
package org.apache.axis.wsdl.codegen.emitter;
import org.apache.axis.wsdl.codegen.CodeGenConfiguration;
+import org.apache.axis.wsdl.databinding.DefaultTypeMapper;
import org.apache.axis.wsdl.databinding.JavaTypeMapper;
import org.apache.axis.wsdl.databinding.TypeMapper;
@@ -29,7 +30,7 @@
*/
public JavaEmitter(CodeGenConfiguration configuration) {
this.configuration = configuration;
- this.mapper = new JavaTypeMapper();
+ this.mapper = new DefaultTypeMapper();
}
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=180236&r1=180235&r2=180236&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 Sun Jun 5 23:15:41 2005
@@ -8,9 +8,9 @@
import java.util.HashMap;
import java.util.Iterator;
-
import org.apache.axis.wsdl.codegen.CodeGenConfiguration;
import org.apache.axis.wsdl.codegen.CodeGenerationException;
+import org.apache.axis.wsdl.codegen.Constants;
import org.apache.axis.wsdl.codegen.extension.AxisBindingBuilder;
import org.apache.axis.wsdl.codegen.writer.BeanWriter;
import org.apache.axis.wsdl.codegen.writer.CallbackHandlerWriter;
@@ -20,16 +20,18 @@
import org.apache.axis.wsdl.codegen.writer.ServiceXMLWriter;
import org.apache.axis.wsdl.codegen.writer.SkeletonWriter;
import org.apache.axis.wsdl.codegen.writer.TestClassWriter;
+import org.apache.axis.wsdl.codegen.writer.TestServiceXMLWriter;
+import org.apache.axis.wsdl.codegen.writer.TestSkeltonImplWriter;
import org.apache.axis.wsdl.databinding.TypeMapper;
import org.apache.crimson.tree.XmlDocument;
import org.apache.wsdl.WSDLBinding;
import org.apache.wsdl.WSDLDescription;
import org.apache.wsdl.WSDLEndpoint;
+import org.apache.wsdl.WSDLExtensibilityElement;
import org.apache.wsdl.WSDLInterface;
import org.apache.wsdl.WSDLOperation;
import org.apache.wsdl.WSDLService;
import org.apache.wsdl.WSDLTypes;
-import org.apache.wsdl.WSDLExtensibilityElement;
import org.apache.wsdl.extensions.ExtensionConstants;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
@@ -75,6 +77,9 @@
private static final String STUB_SUFFIX = "Stub";
private static final String TEST_SUFFIX = "Test";
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";
+
protected InputStream xsltStream = null;
protected CodeGenConfiguration configuration;
@@ -124,12 +129,28 @@
writeCallBackHandlers(axisBinding);
//write the test classes
writeTestClasses(axisBinding);
+ //write a dummy implementation call for the tests to run.
+ writeTestSkeletonImpl(axisBinding);
+ //write a testservice.xml that will load the dummy skeleton impl for testing
+ writeTestServiceXML(axisBinding);
} catch (Exception e) {
e.printStackTrace();
throw new CodeGenerationException(e);
}
}
-
+
+
+ protected void writeTestSkeletonImpl(WSDLBinding binding)throws Exception{
+ if (configuration.isWriteTestCase()){
+ XmlDocument classModel = createDocumentForTestSkeltonImpl(binding);
+ TestSkeltonImplWriter callbackWriter =
+ new TestSkeltonImplWriter(this.configuration.getOutputLocation(),
+ this.configuration.getOutputLanguage()
+ );
+ writeClass(classModel,callbackWriter);
+ }
+ }
+
/**
*
*/
@@ -191,6 +212,19 @@
}
+
+
+
+ protected void writeTestServiceXML(WSDLBinding axisBinding) throws Exception {
+ if (this.configuration.isWriteTestCase()){
+ //Note - One can generate the service xml using the interface XML
+ XmlDocument skeletonModel = createDOMDocuementForServiceXML(axisBinding, true);
+ TestServiceXMLWriter testServiceXmlWriter = new TestServiceXMLWriter(this.configuration.getOutputLocation(),
+ this.configuration.getOutputLanguage()
+ );
+ writeClass(skeletonModel,testServiceXmlWriter);
+ }
+ }
/**
* Writes the skeleton
@@ -200,7 +234,7 @@
protected void writeServiceXml(WSDLBinding axisBinding) throws Exception {
if (this.configuration.isGenerateDeployementDescriptor()){
//Note - One can generate the service xml using the interface XML
- XmlDocument skeletonModel = createDOMDocuementForInterface(axisBinding);
+ XmlDocument skeletonModel = createDOMDocuementForServiceXML(axisBinding, false);
ClassWriter serviceXmlWriter = new ServiceXMLWriter(this.configuration.getOutputLocation(),
this.configuration.getOutputLanguage()
);
@@ -257,6 +291,8 @@
model.getDocumentElement().getAttribute("name"));
writer.writeOutFile(new ByteArrayInputStream(memoryStream.toByteArray()));
}
+
+
/**
* @see org.apache.axis.wsdl.codegen.emitter.Emitter#emitSkeleton()
@@ -269,12 +305,36 @@
writeSkeleton(axisBinding);
//write interface implementations
writeServiceXml(axisBinding);
+ //write the test classes
+ writeTestClasses(axisBinding);
+ //write a dummy implementation call for the tests to run.
+ writeTestSkeletonImpl(axisBinding);
+ //write a testservice.xml that will load the dummy skeleton impl for testing
+ writeTestServiceXML(axisBinding);
} catch (Exception e) {
e.printStackTrace();
throw new CodeGenerationException(e);
}
}
+
+ protected XmlDocument createDocumentForTestSkeltonImpl(WSDLBinding binding){
+ WSDLInterface boundInterface = binding.getBoundInterface();
+
+ XmlDocument doc = new XmlDocument();
+ Element rootElement = doc.createElement("class");
+ addAttribute(doc,"package",configuration.getPackageName()+TEST_PACKAGE_NAME_SUFFIX, rootElement);
+ addAttribute(doc,"servicename",boundInterface.getName().getLocalPart()+SERVICE_CLASS_SUFFIX,rootElement);
+ addAttribute(doc, "implpackage", configuration.getPackageName(), rootElement);
+ addAttribute(doc,"name",boundInterface.getName().getLocalPart()+TEST_SERVICE_CLASS_NAME_SUFFIX,rootElement);
+ addAttribute(doc, "namespace", boundInterface.getName().getNamespaceURI(), rootElement);
+ fillSyncAttributes(doc, rootElement);
+ loadOperations(boundInterface, doc, rootElement);
+ doc.appendChild(rootElement);
+
+ return doc;
+ }
+
/**
* Generating the callbacks
* @param binding
@@ -344,6 +404,25 @@
return null;
}
+ protected XmlDocument createDOMDocuementForServiceXML(WSDLBinding binding, boolean forTesting) {
+ WSDLInterface boundInterface = binding.getBoundInterface();
+
+ XmlDocument doc = new XmlDocument();
+ Element rootElement = doc.createElement("interface");
+ if(forTesting){
+ addAttribute(doc,"package",configuration.getPackageName()+TEST_PACKAGE_NAME_SUFFIX, rootElement);
+ addAttribute(doc,"name",boundInterface.getName().getLocalPart()+TEST_SERVICE_CLASS_NAME_SUFFIX,rootElement);
+ }else{
+ addAttribute(doc,"package",configuration.getPackageName(), rootElement);
+ addAttribute(doc,"name",boundInterface.getName().getLocalPart()+SERVICE_CLASS_SUFFIX,rootElement);
+ }
+ addAttribute(doc,"servicename",boundInterface.getName().getLocalPart()+TEST_SERVICE_CLASS_NAME_SUFFIX,rootElement);
+ fillSyncAttributes(doc, rootElement);
+ loadOperations(boundInterface, doc, rootElement);
+ doc.appendChild(rootElement);
+
+ return doc;
+ }
/**
* Creates the DOM tree for the interface creation
* @param binding
@@ -399,14 +478,17 @@
XmlDocument doc = new XmlDocument();
Element rootElement = doc.createElement("class");
- addAttribute(doc,"package",configuration.getPackageName(),rootElement);
+ String serviceXMLPath = configuration.getPackageName().replace('.','/')+TEST_PACKAGE_NAME_SUFFIX.replace('.','/')+"/testservice.xml";
+ addAttribute(doc,"package",configuration.getPackageName()+TEST_PACKAGE_NAME_SUFFIX,rootElement);
+ addAttribute(doc, "servicexmlpath", serviceXMLPath, rootElement);
+ addAttribute(doc, "implpackage", configuration.getPackageName(), rootElement);
String localPart = boundInterface.getName().getLocalPart();
addAttribute(doc,"name",localPart+TEST_SUFFIX,rootElement);
addAttribute(doc,"namespace",boundInterface.getName().getNamespaceURI(),rootElement);
addAttribute(doc,"interfaceName",localPart,rootElement);
- addAttribute(doc, "servicename", boundInterface.getName().getLocalPart()+SERVICE_CLASS_SUFFIX, rootElement);
addAttribute(doc,"callbackname",localPart + CALL_BACK_HANDLER_SUFFIX,rootElement);
addAttribute(doc,"stubname",localPart + STUB_SUFFIX,rootElement);
+ addAttribute(doc, "address", "http://localhost:"+Constants.TEST_PORT+"/services/"+boundInterface.getName().getLocalPart()+TEST_SERVICE_CLASS_NAME_SUFFIX, rootElement);
fillSyncAttributes(doc, rootElement);
loadOperations(boundInterface, doc, rootElement);
doc.appendChild(rootElement);
Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/TestServiceXMLWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/TestServiceXMLWriter.java?rev=180236&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/TestServiceXMLWriter.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/TestServiceXMLWriter.java Sun Jun 5 23:15:41 2005
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.wsdl.codegen.writer;
+
+import java.io.File;
+import java.io.FileOutputStream;
+
+import org.apache.axis.wsdl.util.FileWriter;
+
+/**
+ * @author chathura@opensource.lk
+ *
+ */
+public class TestServiceXMLWriter extends ServiceXMLWriter {
+
+ public TestServiceXMLWriter(String outputFileLocation){
+ super(outputFileLocation);
+ }
+ public TestServiceXMLWriter(File outputFileLocation,int language){
+ super(outputFileLocation, language);
+ }
+
+ public void createOutFile(String packageName, String fileName) throws Exception {
+ File outputFile = FileWriter.createClassFile(outputFileLocation,packageName,"testservice",".xml");
+ this.stream = new FileOutputStream(outputFile);
+ }
+}
Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/TestSkeltonImplWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/TestSkeltonImplWriter.java?rev=180236&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/TestSkeltonImplWriter.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/TestSkeltonImplWriter.java Sun Jun 5 23:15:41 2005
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.wsdl.codegen.writer;
+
+import java.io.File;
+
+import org.apache.axis.wsdl.codegen.XSLTConstants;
+
+/**
+ * @author chathura@opensource.lk
+ *
+ */
+public class TestSkeltonImplWriter extends ClassWriter {
+
+ public TestSkeltonImplWriter(String outputFileLocation) {
+ this.outputFileLocation = new File(outputFileLocation);
+ }
+
+ public TestSkeltonImplWriter(File outputFileLocation,int language) {
+ this.outputFileLocation = outputFileLocation;
+ this.language = language;
+ }
+
+ public void loadTemplate() {
+ Class clazz = this.getClass();
+ switch (language){
+ case XSLTConstants.LanguageTypes.JAVA:
+ this.xsltStream = clazz.getResourceAsStream(XSLTConstants.XSLTTestSkeltonImplTemplates.JAVA_TEMPLATE);
+ break;
+ default:
+ throw new UnsupportedOperationException();
+ }
+ }
+
+}
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/databinding/DefaultTypeMapper.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/databinding/DefaultTypeMapper.java?rev=180236&r1=180235&r2=180236&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/databinding/DefaultTypeMapper.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/databinding/DefaultTypeMapper.java Sun Jun 5 23:15:41 2005
@@ -16,8 +16,6 @@
package org.apache.axis.wsdl.databinding;
-import org.apache.axis.om.OMElement;
-
import javax.xml.namespace.QName;
/**
@@ -39,8 +37,7 @@
*/
public class DefaultTypeMapper extends TypeMappingAdapter {
- public Class getTypeMapping(QName qname) {
- return OMElement.class;
+ public DefaultTypeMapper(){
}
public String getParameterName(QName qname){
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/databinding/TypeMappingAdapter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/databinding/TypeMappingAdapter.java?rev=180236&r1=180235&r2=180236&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/databinding/TypeMappingAdapter.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/databinding/TypeMappingAdapter.java Sun Jun 5 23:15:41 2005
@@ -1,9 +1,10 @@
package org.apache.axis.wsdl.databinding;
-import org.apache.axis.om.OMElement;
+import java.util.HashMap;
import javax.xml.namespace.QName;
-import java.util.HashMap;
+
+import org.apache.axis.om.OMElement;
/*
* Copyright 2004,2005 The Apache Software Foundation.
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/general/ServiceXMLTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/general/ServiceXMLTemplate.xsl?rev=180236&r1=180235&r2=180236&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/general/ServiceXMLTemplate.xsl (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/general/ServiceXMLTemplate.xsl Sun Jun 5 23:15:41 2005
@@ -2,7 +2,7 @@
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
<xsl:template match="/interface">
<xsl:comment>Auto generated Axis Service XML</xsl:comment>
- <service><xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute>
+ <service><xsl:attribute name="name"><xsl:value-of select="@servicename"/></xsl:attribute>
<parameter name="ServiceClass" locked="xsd:false"><xsl:value-of select="@package"/>.<xsl:value-of select="@name"/></parameter>
<xsl:for-each select="method">
<xsl:comment>Mounting the method <xsl:value-of select="@name"/> </xsl:comment>
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/TestClassTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/TestClassTemplate.xsl?rev=180236&r1=180235&r2=180236&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/TestClassTemplate.xsl (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/TestClassTemplate.xsl Sun Jun 5 23:15:41 2005
@@ -3,11 +3,13 @@
<xsl:template match="/class">
<xsl:variable name="interfaceName"><xsl:value-of select="@interfaceName"/></xsl:variable>
<xsl:variable name="package"><xsl:value-of select="@package"/></xsl:variable>
+ <xsl:variable name="implpackage"><xsl:value-of select="@implpackage"/></xsl:variable>
<xsl:variable name="callbackname"><xsl:value-of select="@callbackname"/></xsl:variable>
<xsl:variable name="stubname"><xsl:value-of select="@stubname"/></xsl:variable>
<xsl:variable name="isSync"><xsl:value-of select="@isSync"/></xsl:variable>
<xsl:variable name="isAsync"><xsl:value-of select="@isAsync"/></xsl:variable>
- <xsl:variable name="servicename"><xsl:value-of select="@servicename"/></xsl:variable>
+ <xsl:variable name="address"><xsl:value-of select="@address"/></xsl:variable>
+ <xsl:variable name="servicexmlpath"><xsl:value-of select="@servicexmlpath"/></xsl:variable>
package <xsl:value-of select="$package"/>;
import java.io.InputStream;
@@ -17,7 +19,7 @@
import org.apache.axis.deployment.DeploymentEngine;
import org.apache.axis.description.ServiceDescription;
import org.apache.axis.engine.AxisConfiguration;
- import org.apache.axis.integration.Constants;
+ import org.apache.axis.wsdl.codegen.Constants;
import org.apache.axis.transport.http.SimpleHTTPServer;
@@ -37,18 +39,18 @@
.getProperty("user.dir"));
AxisConfiguration axisConfig = deploymentEngine.load();
ClassLoader classLoader = this.getClass().getClassLoader();
- classLoader.getResource("com.datatransferhsbc.HSBCServices");
- classLoader.getResource("com.datatransferhsbc.HSBCServicesStub");
+ classLoader.getResource("<xsl:value-of select="$implpackage"/>.<xsl:value-of select="$interfaceName"/>");
+ classLoader.getResource("<xsl:value-of select="$implpackage"/>.<xsl:value-of select="$stubname"/>");
ClassLoader cl = Thread.currentThread().getContextClassLoader();
InputStream in = cl
- .getResourceAsStream("com/datatransferhsbc/service.xml");
+ .getResourceAsStream("<xsl:value-of select="$servicexmlpath"/>");
ServiceDescription service = new ServiceDescription();
deploymentEngine.buildService(service, in, classLoader);
ConfigurationContext configurationContext = new ConfigurationContext(
axisConfig);
ServerSocket serverSoc = null;
- serverSoc = new ServerSocket(Constants.TESTING_PORT);
+ serverSoc = new ServerSocket(Constants.TEST_PORT);
server = new SimpleHTTPServer(
configurationContext, serverSoc);
Thread thread = new Thread(server);
@@ -57,7 +59,7 @@
try {
thread.start();
System.out.print("Server started on port "
- + Constants.TESTING_PORT + ".....");
+ + Constants.TEST_PORT + ".....");
} finally {
}
@@ -87,7 +89,7 @@
*/
public void test<xsl:value-of select="@name"/>() throws java.lang.Exception{
- <xsl:value-of select="$stubname"/> stub = new <xsl:value-of select="$package"/>.<xsl:value-of select="$stubname"/>(".","http://localhost:5050/services/<xsl:value-of select="$servicename"/>/<xsl:value-of select="@name"/>");
+ <xsl:value-of select="$implpackage"/>.<xsl:value-of select="$stubname"/> stub = new <xsl:value-of select="$implpackage"/>.<xsl:value-of select="$stubname"/>(".","<xsl:value-of select="$address"/>/<xsl:value-of select="@name"/>");
<xsl:choose>
<xsl:when test="$inputtype!=''">
assertNotNull(stub.<xsl:value-of select="@name"/>(
@@ -108,7 +110,7 @@
* Auto generated test method
*/
public void testStart<xsl:value-of select="@name"/>() throws java.lang.Exception{
- <xsl:value-of select="$stubname"/> stub = new <xsl:value-of select="$package"/>.<xsl:value-of select="$stubname"/>();
+ <xsl:value-of select="$implpackage"/>.<xsl:value-of select="$stubname"/> stub = new <xsl:value-of select="$implpackage"/>.<xsl:value-of select="$stubname"/>();
<xsl:choose>
<xsl:when test="$inputtype!=''">
stub.start<xsl:value-of select="@name"/>(
@@ -126,11 +128,11 @@
}
- private class <xsl:value-of select="$tempCallbackName"/> extends <xsl:value-of select="$package"/>.<xsl:value-of select="$callbackname"/>{
+ private class <xsl:value-of select="$tempCallbackName"/> extends <xsl:value-of select="$implpackage"/>.<xsl:value-of select="$callbackname"/>{
public <xsl:value-of select="$tempCallbackName"/>(){ super(null);}
public void receiveResult<xsl:value-of select="@name"/>(org.apache.axis.clientapi.AsyncResult result) {
- assertNotNull(result);
+ assertNotNull(result.getResponseEnvelope().getBody().getFirstChild());
}
public void receiveError<xsl:value-of select="@name"/>(java.lang.Exception e) {
Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/TestSkeletonImplTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/TestSkeletonImplTemplate.xsl?rev=180236&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/TestSkeletonImplTemplate.xsl (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/TestSkeletonImplTemplate.xsl Sun Jun 5 23:15:41 2005
@@ -0,0 +1,48 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:output method="text"/>
+ <xsl:template match="/class">
+ <xsl:variable name="namespace"><xsl:value-of select="@namespace"/></xsl:variable>
+ package <xsl:value-of select="@package"/>;
+
+ import javax.xml.namespace.QName;
+
+ import org.apache.axis.om.OMAbstractFactory;
+ import org.apache.axis.om.OMElement;
+ import org.apache.axis.om.OMFactory;
+ import org.apache.axis.om.impl.llom.OMTextImpl;
+
+
+ /**
+ * Auto generated java skeleton for the service by the Axis code generator
+ */
+
+ public class <xsl:value-of select="@name"></xsl:value-of> extends <xsl:value-of select="@implpackage"/>.<xsl:value-of select="@servicename"></xsl:value-of>{
+ <xsl:for-each select="method">
+ <xsl:variable name="outputtype"><xsl:value-of select="output/param/@type"></xsl:value-of></xsl:variable>
+
+ <xsl:variable name="inputtype"><xsl:value-of select="input/param/@type"></xsl:value-of></xsl:variable> <!-- this needs to change-->
+ <xsl:variable name="inputparam"><xsl:value-of select="input/param/@name"></xsl:value-of></xsl:variable> <!-- this needs to change-->
+
+ /**
+ * Auto generated method signature
+ *<xsl:if test="$inputtype!=''">@param <xsl:value-of select="$inputparam"></xsl:value-of></xsl:if>
+ */
+ public <xsl:if test="$outputtype=''">void</xsl:if><xsl:if test="$outputtype!=''"><xsl:value-of select="$outputtype"/></xsl:if><xsl:text> </xsl:text><xsl:value-of select="@name"/>(<xsl:if test="$inputtype!=''"><xsl:value-of select="$inputtype"/><xsl:text> </xsl:text><xsl:value-of select="$inputparam"></xsl:value-of></xsl:if>){
+ //Todo fill this with the necessary business logic
+ <xsl:if test="$outputtype!=''">
+ //Returns an simple om element
+ OMFactory factory = OMAbstractFactory.getOMFactory();
+ OMElement element = factory.createOMElement(new QName("<xsl:value-of select="$namespace"/>", "<xsl:value-of select="generate-id()"/>"), null);
+ OMElement element1 = factory.createOMElement(new QName("<xsl:value-of select="$namespace"/>","<xsl:value-of select="generate-id()"/>"), element);
+ element.addChild(element1);
+ OMTextImpl text = new OMTextImpl("<xsl:value-of select="generate-id()"/>");
+ element1.addChild(text);
+ return element;
+ </xsl:if>
+ }
+
+
+ </xsl:for-each>
+ }
+ </xsl:template>
+ </xsl:stylesheet>
\ No newline at end of file