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 de...@apache.org on 2007/02/22 09:15:43 UTC
svn commit: r510437 - in /webservices/axis2/trunk/java/modules:
adb/src/org/apache/axis2/rpc/receivers/
java2wsdl/src/org/apache/ws/java2wsdl/
kernel/src/org/apache/axis2/deployment/
kernel/src/org/apache/axis2/deployment/util/ kernel/src/org/apache/ax...
Author: deepal
Date: Thu Feb 22 00:15:42 2007
New Revision: 510437
URL: http://svn.apache.org/viewvc?view=rev&rev=510437
Log:
- pojo annotation support
- initial implementation
Added:
webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/AnnotationConstants.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java
Modified:
webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/rpc/receivers/RPCUtil.java
webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/SchemaGenerator.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisMessage.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java
Modified: webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/rpc/receivers/RPCUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/rpc/receivers/RPCUtil.java?view=diff&rev=510437&r1=510436&r2=510437
==============================================================================
--- webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/rpc/receivers/RPCUtil.java (original)
+++ webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/rpc/receivers/RPCUtil.java Thu Feb 22 00:15:42 2007
@@ -14,9 +14,14 @@
import org.apache.axis2.databinding.utils.BeanUtil;
import org.apache.axis2.databinding.utils.reader.NullXMLStreamReader;
import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.AxisMessage;
import org.apache.axis2.engine.ObjectSupplier;
import org.apache.axis2.util.StreamWrapper;
import org.apache.ws.java2wsdl.utils.TypeTable;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
+import org.apache.ws.commons.schema.XmlSchemaSequence;
+import org.apache.ws.commons.schema.XmlSchemaComplexType;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamReader;
@@ -220,4 +225,30 @@
outMessage.setEnvelope(envelope);
}
+ /**
+ * This can be used to get the part name of the response
+ * @param outMessage : AxisMessage
+ * @return String
+ */
+ private static String getReturnName(AxisMessage outMessage){
+ if(outMessage!=null){
+ Object element= outMessage.getSchemaElement();
+ if(element instanceof XmlSchemaComplexType){
+ XmlSchemaComplexType xmlSchemaComplexType = (XmlSchemaComplexType) element;
+ Object particle = xmlSchemaComplexType.getParticle();
+ if(particle instanceof XmlSchemaSequence ){
+ XmlSchemaSequence xmlSchemaSequence = (XmlSchemaSequence) particle;
+ Object items = xmlSchemaSequence.getItems();
+ if(items instanceof XmlSchemaObjectCollection){
+ XmlSchemaObjectCollection xmlSchemaObjectCollection = (XmlSchemaObjectCollection) items;
+ Object schemaElement= xmlSchemaObjectCollection.getItem(0);
+ if(schemaElement instanceof XmlSchemaElement){
+ return ((XmlSchemaElement)schemaElement).getName();
+ }
+ }
+ }
+ }
+ }
+ return RETURN_WRAPPER;
+ }
}
Added: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/AnnotationConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/AnnotationConstants.java?view=auto&rev=510437
==============================================================================
--- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/AnnotationConstants.java (added)
+++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/AnnotationConstants.java Thu Feb 22 00:15:42 2007
@@ -0,0 +1,30 @@
+package org.apache.ws.java2wsdl;
+
+/*
+* Copyright 2004,2005 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.
+*
+*
+*/
+public interface AnnotationConstants {
+ String WEB_SERVICE = "javax.jws.WebService";
+ String WEB_METHOD = "javax.jws.WebMethod";
+ String WEB_PARAM = "javax.jws.WebParam";
+ String WEB_RESULT = "javax.jws.WebResult";
+ String TARGETNAMESPACE = "targetNamespace";
+ String NAME = "name";
+ String EXCLUDE = "exclude";
+ String ACTION = "action";
+ String WSDL_LOCATION = "wsdlLocation";
+}
Modified: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/SchemaGenerator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/SchemaGenerator.java?view=diff&rev=510437&r1=510436&r2=510437
==============================================================================
--- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/SchemaGenerator.java (original)
+++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/SchemaGenerator.java Thu Feb 22 00:15:42 2007
@@ -89,7 +89,7 @@
this.classLoader = loader;
this.className = className;
- Class clazz = Class.forName(className, true, loader);
+ Class clazz = Class.forName(className, true, loader);
methodTable = new MethodTable(clazz);
this.targetNamespace = Java2WSDLUtils.targetNamespaceFromClassName(
@@ -137,11 +137,7 @@
//all most all the time the ittr will have only one class in it
while (jClassIter.hasNext()) {
JClass jclass = (JClass) jClassIter.next();
- // serviceName = jclass.getSimpleName();
- //todo in the future , when we support annotation we can use this
- //JAnnotation[] annotations = jclass.getAnnotations();
-
- if (jclass.getQualifiedName().equals(className)) {
+ if (getQualifiedName(jclass).equals(className)) {
/**
* Schema genertaion done in two stage 1. Load all the methods and
* create type for methods parameters (if the parameters are Bean
@@ -150,6 +146,13 @@
* nothing will happen) 2. In the next stage for all the methods
* messages and port types will be creteated
*/
+ JAnnotation annotation = jclass.getAnnotation(AnnotationConstants.WEB_SERVICE);
+ if(annotation!=null){
+ String tns = annotation.getValue(AnnotationConstants.TARGETNAMESPACE).asString();
+ if(tns!=null&&!"".equals(tns)){
+ targetNamespace = tns;
+ }
+ }
methods = jclass.getDeclaredMethods();
//short the elements in the array
Arrays.sort(methods);
@@ -161,14 +164,20 @@
for (int i = 0; i < methods.length; i++) {
JMethod jMethod = methods[i];
- String methodName = methods[i].getSimpleName();
+ JAnnotation methodAnnon= jMethod.getAnnotation(AnnotationConstants.WEB_METHOD);
+ if(methodAnnon!=null){
+ if(methodAnnon.getValue(AnnotationConstants.EXCLUDE).asBoolean()){
+ continue;
+ }
+ }
+ String methodName = getSimpleName(jMethod);
// no need to think abt this method , since that is system
// config method
- if (excludeMethods.contains(jMethod.getSimpleName())) {
+ if (excludeMethods.contains(getSimpleName(jMethod))) {
continue;
}
- if (uniqueMethods.get(jMethod.getSimpleName()) != null) {
+ if (uniqueMethods.get(getSimpleName(jMethod)) != null) {
throw new Exception(
" Sorry we don't support methods overloading !!!! ");
}
@@ -178,47 +187,64 @@
continue;
}
if (jMethod.getExceptionTypes().length > 0) {
- methodSchemaType = createSchemaTypeForMethodPart(jMethod.getSimpleName() + "Fault");
+ methodSchemaType = createSchemaTypeForMethodPart(getSimpleName(jMethod) + "Fault");
sequence = new XmlSchemaSequence();
XmlSchemaElement elt1 = new XmlSchemaElement();
- elt1.setName(jMethod.getSimpleName() + "Fault");
+ elt1.setName(getSimpleName(jMethod) + "Fault");
elt1.setSchemaTypeName(typeTable.getQNamefortheType(Object.class.getName()));
sequence.getItems().add(elt1);
methodSchemaType.setParticle(sequence);
}
- uniqueMethods.put(jMethod.getSimpleName(), jMethod);
+ uniqueMethods.put(getSimpleName(jMethod), jMethod);
//create the schema type for the method wrapper
- uniqueMethods.put(jMethod.getSimpleName(), jMethod);
+ uniqueMethods.put(getSimpleName(jMethod), jMethod);
JParameter [] paras = jMethod.getParameters();
String parameterNames [] = null;
if (paras.length > 0) {
parameterNames = methodTable.getParameterNames(methodName);
sequence = new XmlSchemaSequence();
- methodSchemaType = createSchemaTypeForMethodPart(jMethod.getSimpleName());
+ methodSchemaType = createSchemaTypeForMethodPart(getSimpleName(jMethod));
methodSchemaType.setParticle(sequence);
}
for (int j = 0; j < paras.length; j++) {
JParameter methodParameter = paras[j];
+ String parameterName =null;
+ JAnnotation paramterAnnon= methodParameter.getAnnotation(AnnotationConstants.WEB_PARAM);
+ if(paramterAnnon!=null){
+ parameterName = paramterAnnon.getValue(AnnotationConstants.NAME).asString();
+ }
+ if(parameterName==null||"".equals(parameterName)){
+ parameterName = (parameterNames != null && parameterNames[j] != null) ? parameterNames[j] : getSimpleName(methodParameter);
+ }
JClass paraType = methodParameter.getType();
- generateSchemaForType(sequence, paraType,
- (parameterNames != null && parameterNames[j] != null) ? parameterNames[j] : methodParameter.getSimpleName());
+ generateSchemaForType(sequence, paraType,parameterName);
}
// for its return type
JClass returnType = jMethod.getReturnType();
if (!returnType.isVoidType()) {
- methodSchemaType = createSchemaTypeForMethodPart(jMethod.getSimpleName() + RESPONSE);
+ methodSchemaType = createSchemaTypeForMethodPart(getSimpleName(jMethod) + RESPONSE);
sequence = new XmlSchemaSequence();
methodSchemaType.setParticle(sequence);
- generateSchemaForType(sequence, returnType, "return");
+ JAnnotation returnAnnon= jMethod.getAnnotation(AnnotationConstants.WEB_RESULT);
+ if(returnAnnon!=null){
+ String returnName= returnAnnon.getValue(AnnotationConstants.NAME).asString();
+ if(returnName!=null&&!"".equals(returnName)){
+ generateSchemaForType(sequence, returnType, returnName);
+ } else{
+ generateSchemaForType(sequence, returnType, "return");
+ }
+ } else{
+ generateSchemaForType(sequence, returnType, "return");
+ }
}
}
} else {
//generate the schema type for extra classes
- extraSchemaTypeName = typeTable.getSimpleSchemaTypeName(jclass.getQualifiedName());
+ extraSchemaTypeName = typeTable.getSimpleSchemaTypeName(getQualifiedName(jclass));
if (extraSchemaTypeName == null) {
generateSchema(jclass);
}
@@ -248,12 +274,12 @@
* @param javaType
*/
private QName generateSchema(JClass javaType) throws Exception {
- String name = javaType.getQualifiedName();
+ String name = getQualifiedName(javaType);
QName schemaTypeName = typeTable.getComplexSchemaType(name);
if (schemaTypeName == null) {
- String simpleName = javaType.getSimpleName();
+ String simpleName = getSimpleName(javaType);
- String packageName = javaType.getContainingPackage().getQualifiedName();
+ String packageName = getQualifiedName(javaType.getContainingPackage());
String targetNameSpace = resolveSchemaNamespace(packageName);
XmlSchema xmlSchema = getXmlSchema(targetNameSpace);
@@ -281,7 +307,7 @@
JClass tempClass = javaType;
Set propertiesSet = new HashSet();
- while (tempClass != null && !"java.lang.Object".equals(tempClass.getQualifiedName())) {
+ while (tempClass != null && !"java.lang.Object".equals(getQualifiedName(tempClass))) {
JProperty[] tempProperties = tempClass.getDeclaredProperties();
for (int i = 0; i < tempProperties.length; i++) {
propertiesSet.add(tempProperties[i]);
@@ -292,14 +318,14 @@
Arrays.sort(properties);
for (int i = 0; i < properties.length; i++) {
JProperty property = properties[i];
- String propertyName = property.getType().getQualifiedName();
+ String propertyName = getQualifiedName(property.getType());
boolean isArryType = property.getType().isArrayType();
if (isArryType) {
- propertyName = property.getType().getArrayComponentType().getQualifiedName();
+ propertyName = getQualifiedName(property.getType().getArrayComponentType());
}
if (typeTable.isSimpleType(propertyName)) {
XmlSchemaElement elt1 = new XmlSchemaElement();
- elt1.setName(getCorrectName(property.getSimpleName()));
+ elt1.setName(getCorrectName(getSimpleName(property)));
elt1.setSchemaTypeName(typeTable.getSimpleSchemaTypeName(propertyName));
sequence.getItems().add(elt1);
if (isArryType) {
@@ -316,7 +342,7 @@
generateSchema(property.getType());
}
XmlSchemaElement elt1 = new XmlSchemaElement();
- elt1.setName(getCorrectName(property.getSimpleName()));
+ elt1.setName(getCorrectName(getSimpleName(property)));
elt1.setSchemaTypeName(typeTable.getComplexSchemaType(propertyName));
sequence.getItems().add(elt1);
if (isArryType) {
@@ -345,7 +371,7 @@
type = type.getArrayComponentType();
}
- String classTypeName = type.getQualifiedName();
+ String classTypeName = getQualifiedName(type);
if (isArrayType && "byte".equals(classTypeName)) {
classTypeName = "base64Binary";
isArrayType = false;
@@ -360,8 +386,7 @@
isArrayType);
//addImport((XmlSchema)schemaMap.get(schemaTargetNameSpace), schemaTypeName);
String schemaNamespace;
- schemaNamespace = resolveSchemaNamespace(type.getContainingPackage().
- getQualifiedName());
+ schemaNamespace = resolveSchemaNamespace(getQualifiedName(type.getContainingPackage()));
addImport(getXmlSchema(schemaNamespace), schemaTypeName);
} else {
@@ -554,5 +579,36 @@
public String getTargetNamespace() {
return targetNamespace;
}
+
+ protected String getSimpleName(JMethod method){
+ return method.getSimpleName();
+ }
+ protected String getSimpleName(JClass type){
+ return type.getSimpleName();
+ }
+ protected String getSimpleName(JProperty peroperty){
+ return peroperty.getSimpleName();
+ }
+ protected String getSimpleName(JParameter parameter){
+ return parameter.getSimpleName();
+ }
+
+ protected String getQualifiedName(JMethod method){
+ return method.getQualifiedName();
+ }
+ protected String getQualifiedName(JClass type){
+ return type.getQualifiedName();
+ }
+ protected String getQualifiedName(JProperty peroperty){
+ return peroperty.getQualifiedName();
+ }
+ protected String getQualifiedName(JParameter parameter){
+ return parameter.getQualifiedName();
+ }
+ protected String getQualifiedName(JPackage packagez){
+ return packagez.getQualifiedName();
+ }
+
+
}
Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java?view=auto&rev=510437
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java Thu Feb 22 00:15:42 2007
@@ -0,0 +1,139 @@
+package org.apache.axis2.deployment;
+
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.deployment.repository.util.DeploymentFileData;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.util.Loader;
+import org.apache.axis2.engine.MessageReceiver;
+import org.apache.axis2.wsdl.WSDLConstants;
+import org.apache.ws.java2wsdl.AnnotationConstants;
+import org.codehaus.jam.*;
+
+import java.io.File;
+import java.net.URL;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+
+/*
+* Copyright 2004,2005 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.
+*
+*
+*/
+public class POJODeployer implements Deployer {
+
+ private ConfigurationContext configCtx;
+
+ //To initialize the deployer
+ public void init(ConfigurationContext configCtx) {
+ this.configCtx = configCtx;
+ }//Will process the file and add that to axisConfig
+
+ public void deploy(DeploymentFileData deploymentFileData) {
+ ClassLoader threadClassLoader = null;
+ try {
+ threadClassLoader = Thread.currentThread().getContextClassLoader();
+ String extension = deploymentFileData.getType();
+ if (".class".equals(extension)) {
+ File file = deploymentFileData.getFile();
+ if (file != null) {
+ File parentFile = file.getParentFile();
+ DeploymentClassLoader classLoader = new DeploymentClassLoader(new URL[]{parentFile.toURL()},
+ configCtx.getAxisConfiguration().getSystemClassLoader(), true);
+ Thread.currentThread().setContextClassLoader(classLoader);
+ String className = file.getName();
+ className = className.replaceAll(".class", "");
+ JamServiceFactory factory = JamServiceFactory.getInstance();
+ JamServiceParams jam_service_parms = factory.createServiceParams();
+ jam_service_parms.addClassLoader(classLoader);
+ jam_service_parms.includeClass(className);
+ JamService service = factory.createService(jam_service_parms);
+ JamClassIterator jClassIter = service.getClasses();
+ while (jClassIter.hasNext()) {
+ JClass jclass = (JClass) jClassIter.next();
+ if (jclass.getQualifiedName().equals(className)) {
+ /**
+ * Schema genertaion done in two stage 1. Load all the methods and
+ * create type for methods parameters (if the parameters are Bean
+ * then it will create Complex types for those , and if the
+ * parameters are simple type which decribe in SimpleTypeTable
+ * nothing will happen) 2. In the next stage for all the methods
+ * messages and port types will be creteated
+ */
+ boolean callJaxWs = false;
+ JAnnotation annotation = jclass.getAnnotation(AnnotationConstants.WEB_SERVICE);
+ if (annotation != null) {
+ String wsdlLocation = annotation.getValue(AnnotationConstants.WSDL_LOCATION).asString();
+ if (wsdlLocation != null && !"".equals(wsdlLocation)) {
+ callJaxWs = true;
+ }
+ }
+ if (callJaxWs) {
+ Class claxx = Class.forName(
+ "org.apache.axis2.jaxws.description.DescriptionFactory");
+ Method mthod = claxx.getMethod(
+ "createServiceDescriptionFromServiceImpl",
+ new Class[]{Class.class, AxisService.class});
+ Class pojoClass = Loader.loadClass(classLoader, className);
+ AxisService axisService = new AxisService(className);
+ axisService.setName(className);
+ mthod.invoke(claxx,new Object[]{pojoClass, axisService});
+ configCtx.getAxisConfiguration().addService(axisService);
+ } else {
+ HashMap messageReciverMap = new HashMap();
+ Class inOnlyMessageReceiver = Loader.loadClass(
+ "org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver");
+ MessageReceiver messageReceiver =
+ (MessageReceiver) inOnlyMessageReceiver.newInstance();
+ messageReciverMap.put(
+ WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_ONLY,
+ messageReceiver);
+ Class inoutMessageReceiver = Loader.loadClass(
+ "org.apache.axis2.rpc.receivers.RPCMessageReceiver");
+ MessageReceiver inOutmessageReceiver =
+ (MessageReceiver) inoutMessageReceiver.newInstance();
+ messageReciverMap.put(
+ WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_OUT,
+ inOutmessageReceiver);
+ AxisService axisService = AxisService.createService(className,
+ configCtx.getAxisConfiguration(),
+ messageReciverMap, null, null, classLoader);
+ configCtx.getAxisConfiguration().addService(axisService);
+ }
+ }
+ }
+ }
+
+ } else if ("jar".equals(extension)) {
+ //TODO need to extart the zip file and find out the classes which has annotated
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ if (threadClassLoader != null) {
+ Thread.currentThread().setContextClassLoader(threadClassLoader);
+ }
+ }
+ }
+
+ public void setDirectory(String directory) {
+ }
+
+ public void setExtension(String extension) {
+ }
+
+ public void unDeploy(String fileName) {
+ }
+}
+
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java?view=diff&rev=510437&r1=510436&r2=510437
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java Thu Feb 22 00:15:42 2007
@@ -21,8 +21,10 @@
import org.apache.ws.commons.schema.utils.NamespaceMap;
import org.apache.ws.java2wsdl.Java2WSDLConstants;
import org.apache.ws.java2wsdl.SchemaGenerator;
+import org.apache.ws.java2wsdl.AnnotationConstants;
import org.apache.ws.java2wsdl.utils.TypeTable;
import org.codehaus.jam.JMethod;
+import org.codehaus.jam.JAnnotation;
import javax.xml.namespace.QName;
import java.io.*;
@@ -294,6 +296,12 @@
for (int i = 0; i < method.length; i++) {
JMethod jmethod = method[i];
+ JAnnotation methodAnnon= jmethod.getAnnotation(AnnotationConstants.WEB_METHOD);
+ if(methodAnnon!=null){
+ if(methodAnnon.getValue(AnnotationConstants.EXCLUDE).asBoolean()){
+ continue;
+ }
+ }
if (!jmethod.isPublic()) {
// no need to expose , private and protected methods
continue;
@@ -374,6 +382,13 @@
if (inMessage != null) {
inMessage.setElementQName(table.getComplexSchemaType(jmethod.getSimpleName()));
inMessage.setName(opName + Java2WSDLConstants.MESSAGE_SUFFIX);
+ }
+ JAnnotation methodAnnon= jmethod.getAnnotation(AnnotationConstants.WEB_METHOD);
+ if(methodAnnon!=null){
+ String action= methodAnnon.getValue(AnnotationConstants.ACTION).asString();
+ if(action!=null&&!"".equals(action)){
+ operation.setSoapAction(action);
+ }
}
return operation;
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisMessage.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisMessage.java?view=diff&rev=510437&r1=510436&r2=510437
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisMessage.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisMessage.java Thu Feb 22 00:15:42 2007
@@ -119,22 +119,18 @@
return null;
}
- public String getName
- () {
+ public String getName() {
return name;
}
- public void setName
- (String
- name) {
+ public void setName(String name) {
this.name = name;
}
/**
* This will return a list of WSDLExtensibilityAttribute
*/
- public List getExtensibilityAttributes
- () {
+ public List getExtensibilityAttributes() {
// TODO : Deepal implement this properly.
// the list should contain list of WSDLExtensibilityAttribute
@@ -158,4 +154,5 @@
throw new UnsupportedOperationException("axisMessage.isEngaged(qName) is not supported");
}
+
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java?view=diff&rev=510437&r1=510436&r2=510437
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java Thu Feb 22 00:15:42 2007
@@ -23,7 +23,6 @@
import org.apache.axis2.addressing.AddressingConstants;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
-import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.dataretrieval.AxisDataLocator;
import org.apache.axis2.dataretrieval.AxisDataLocatorImpl;
@@ -55,8 +54,10 @@
import org.apache.ws.commons.schema.utils.NamespacePrefixList;
import org.apache.ws.java2wsdl.Java2WSDLConstants;
import org.apache.ws.java2wsdl.SchemaGenerator;
+import org.apache.ws.java2wsdl.AnnotationConstants;
import org.apache.ws.java2wsdl.utils.TypeTable;
import org.codehaus.jam.JMethod;
+import org.codehaus.jam.JAnnotation;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
@@ -1496,13 +1497,13 @@
* @param schemaNamespace
* @throws AxisFault
*/
-
- public static AxisService createService(String implClass,
+ public static AxisService createService(String implClass,
AxisConfiguration axisConfiguration,
Map messageReceiverClassMap,
String targetNamespace,
- String schemaNamespace) throws AxisFault {
- Parameter parameter = new Parameter(Constants.SERVICE_CLASS, implClass);
+ String schemaNamespace,
+ ClassLoader loader) throws AxisFault {
+ Parameter parameter = new Parameter(Constants.SERVICE_CLASS, implClass);
OMElement paraElement = Utils.getParameter(Constants.SERVICE_CLASS, implClass, false);
parameter.setParameterElement(paraElement);
AxisService axisService = new AxisService();
@@ -1522,7 +1523,7 @@
}
axisService.setName(serviceName);
- axisService.setClassLoader(axisConfiguration.getServiceClassLoader());
+ axisService.setClassLoader(loader);
ClassLoader serviceClassLoader = axisService.getClassLoader();
SchemaGenerator schemaGenerator;
@@ -1568,6 +1569,12 @@
for (int i = 0; i < method.length; i++) {
JMethod jmethod = method[i];
+ JAnnotation methodAnnon= jmethod.getAnnotation(AnnotationConstants.WEB_METHOD);
+ if(methodAnnon!=null){
+ if(methodAnnon.getValue(AnnotationConstants.EXCLUDE).asBoolean()){
+ continue;
+ }
+ }
if (!jmethod.isPublic()) {
// no need to expose , private and protected methods
continue;
@@ -1606,6 +1613,22 @@
}
+
+ public static AxisService createService(String implClass,
+ AxisConfiguration axisConfiguration,
+ Map messageReceiverClassMap,
+ String targetNamespace,
+ String schemaNamespace) throws AxisFault {
+ return createService(implClass,
+ axisConfiguration,
+ messageReceiverClassMap,
+ targetNamespace,
+ schemaNamespace,
+ axisConfiguration.getServiceClassLoader());
+
+
+ }
+
/**
* To create a service for a given Java class with user defined schema and target
* namespaces. This method should be used iff, the operations in the service class is homogeneous.
@@ -1689,6 +1712,12 @@
for (int i = 0; i < method.length; i++) {
JMethod jmethod = method[i];
+ JAnnotation methodAnnon= jmethod.getAnnotation(AnnotationConstants.WEB_METHOD);
+ if(methodAnnon!=null){
+ if(methodAnnon.getValue(AnnotationConstants.EXCLUDE).asBoolean()){
+ continue;
+ }
+ }
if (!jmethod.isPublic()) {
// no need to expose , private and protected methods
continue;
Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java?view=diff&rev=510437&r1=510436&r2=510437
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java Thu Feb 22 00:15:42 2007
@@ -20,6 +20,7 @@
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
+import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -212,8 +213,14 @@
// of whether they include an @WebMethod annotation. That annotation may
// be present to customize the mapping, but is not required (p14)
Method[] seiMethods = sei.getMethods();
+ ArrayList methodList = new ArrayList();
if (sei != null) {
for (Method method:seiMethods) {
+
+ if(method.getDeclaringClass().getName().equals("java.lang.Object")){
+ continue;
+ }
+ methodList.add(method);
if (!Modifier.isPublic(method.getModifiers())) {
// JSR-181 says methods must be public (p14)
// TODO NLS
@@ -221,9 +228,10 @@
}
// TODO: other validation per JSR-181
}
-
+
}
- return seiMethods;
+ return (Method[])methodList.toArray(new Method[methodList.size()]);
+// return seiMethods;
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org