Author: sandakith Date: Mon Jan 28 00:18:34 2008 New Revision: 615755 URL: http://svn.apache.org/viewvc?rev=615755&view=rev Log: On the annotated pojo the name was picked up by name attribute of the javax.jws.WebService annotation now but JSR 181 specifies that the in javax.jws.WebService the parameter serviceName contains the wsdl:service name to mapp. If its not available then the default will be Simple name of the class + "Service" Now moved the logic was moved to a Util method and it will return the String version of the ServiceName according to the JSR 181 spec
Modified: 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/java2wsdl/AnnotationConstants.java webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java 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?rev=615755&r1=615754&r2=615755&view=diff ============================================================================== --- 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 Mon Jan 28 00:18:34 2008 @@ -717,4 +717,29 @@ File file = new File(filename); return file.getName(); } + + + /** + * The util method to prepare the JSR 181 annotated service name from given annotation or for defaults + * JSR 181 specifies that the in javax.jws.WebService the parameter serviceName contains the wsdl:service name + * to mapp. If its not available then the default will be Simple name of the class + "Service" + * @return String version of the ServiceName according to the JSR 181 spec + */ + public static String getAnnotatedServiceName(Class serviceClass, JAnnotation serviceAnnotation){ + String serviceName = ""; + if(serviceAnnotation.getValue(AnnotationConstants.SERVICE_NAME) != null) { + serviceName = (serviceAnnotation.getValue(AnnotationConstants.SERVICE_NAME)).asString(); + } + if(serviceName.equals("")){ + serviceName=serviceClass.getName(); + int firstChar = serviceName.lastIndexOf ('.') + 1; + if ( firstChar > 0 ) { + serviceName = serviceName.substring ( firstChar ); + } + serviceName+="Service"; + } + return serviceName; + } + + } Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/AnnotationConstants.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/AnnotationConstants.java?rev=615755&r1=615754&r2=615755&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/AnnotationConstants.java (original) +++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/AnnotationConstants.java Mon Jan 28 00:18:34 2008 @@ -25,6 +25,7 @@ String WEB_RESULT = "javax.jws.WebResult"; String TARGETNAMESPACE = "targetNamespace"; String NAME = "name"; + String SERVICE_NAME = "serviceName"; String EXCLUDE = "exclude"; String ACTION = "action"; String WSDL_LOCATION = "wsdlLocation"; Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java?rev=615755&r1=615754&r2=615755&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java (original) +++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java Mon Jan 28 00:18:34 2008 @@ -177,18 +177,7 @@ targetNamespace = tns; schemaTargetNameSpace = tns; } - if(annotation.getValue(AnnotationConstants.NAME) != null) { - String serviceName = (annotation.getValue(AnnotationConstants.NAME)).asString(); - if(serviceName.equals("")){ - serviceName=serviceClass.getName(); - int firstChar = serviceName.lastIndexOf ('.') + 1; - if ( firstChar > 0 ) { - serviceName = serviceName.substring ( firstChar ); - } - } - service.setName(serviceName); - } - + service.setName(Utils.getAnnotatedServiceName(serviceClass,annotation)); } methods = processMethods(jclass.getDeclaredMethods()); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]