Author: nthaker
Date: Tue Jul 20 16:44:48 2010
New Revision: 965900
URL: http://svn.apache.org/viewvc?rev=965900&view=rev
Log:
AXIS2-4783: JAX-WS2.2 update for @RequestWrapper, @ResponseWrapper & @WebFault
annotation.
Modified:
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/FaultDescription.java
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/OperationDescription.java
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/JavaClassToDBCConverter.java
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/JavaMethodsToMDCConverter.java
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/impl/FaultDescriptionImpl.java
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java
axis/axis2/java/core/trunk/modules/metadata/test/org/apache/axis2/jaxws/description/AnnotationServiceImplDescriptionTests.java
Modified:
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/FaultDescription.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/FaultDescription.java?rev=965900&r1=965899&r2=965900&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/FaultDescription.java
(original)
+++
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/FaultDescription.java
Tue Jul 20 16:44:48 2010
@@ -81,6 +81,10 @@ public interface FaultDescription {
* if not defined.
*/
public String getTargetNamespace();
-
-
+
+ /**
+ * @return the name of the wsdl:message that defines the fault element.
+ * @return
+ */
+ public String getMessageName();
}
\ No newline at end of file
Modified:
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/OperationDescription.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/OperationDescription.java?rev=965900&r1=965899&r2=965900&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/OperationDescription.java
(original)
+++
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/OperationDescription.java
Tue Jul 20 16:44:48 2010
@@ -172,7 +172,8 @@ public interface OperationDescription {
public String getRequestWrapperTargetNamespace();
public String getRequestWrapperLocalName();
-
+
+ public String getRequestWrapperPartName();
/**
* @return the class name of the wrapper class. NOTE: This method will
return null if the
* request wrapper class is not known during the description layer
processing. In such
@@ -185,6 +186,8 @@ public interface OperationDescription {
public String getResponseWrapperTargetNamespace();
public String getResponseWrapperLocalName();
+
+ public String getResponseWrapperPartName();
public String[] getParamNames();
Modified:
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/JavaClassToDBCConverter.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/JavaClassToDBCConverter.java?rev=965900&r1=965899&r2=965900&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/JavaClassToDBCConverter.java
(original)
+++
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/JavaClassToDBCConverter.java
Tue Jul 20 16:44:48 2010
@@ -381,6 +381,7 @@ public class JavaClassToDBCConverter {
webFaultAnnot.setFaultBean(webFault.faultBean());
webFaultAnnot.setName(webFault.name());
webFaultAnnot.setTargetNamespace(webFault.targetNamespace());
+ webFaultAnnot.setMessageName(webFault.messageName());
composite.setWebFaultAnnot(webFaultAnnot);
}
}
Modified:
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/JavaMethodsToMDCConverter.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/JavaMethodsToMDCConverter.java?rev=965900&r1=965899&r2=965900&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/JavaMethodsToMDCConverter.java
(original)
+++
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/JavaMethodsToMDCConverter.java
Tue Jul 20 16:44:48 2010
@@ -197,6 +197,7 @@ public class JavaMethodsToMDCConverter {
rwAnnot.setClassName(requestWrapper.className());
rwAnnot.setLocalName(requestWrapper.localName());
rwAnnot.setTargetNamespace(requestWrapper.targetNamespace());
+ rwAnnot.setPartName(requestWrapper.partName());
mdc.setRequestWrapperAnnot(rwAnnot);
}
}
@@ -217,6 +218,7 @@ public class JavaMethodsToMDCConverter {
rwAnnot.setClassName(responseWrapper.className());
rwAnnot.setLocalName(responseWrapper.localName());
rwAnnot.setTargetNamespace(responseWrapper.targetNamespace());
+ rwAnnot.setPartName(responseWrapper.partName());
mdc.setResponseWrapperAnnot(rwAnnot);
}
}
Modified:
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/impl/FaultDescriptionImpl.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/impl/FaultDescriptionImpl.java?rev=965900&r1=965899&r2=965900&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/impl/FaultDescriptionImpl.java
(original)
+++
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/impl/FaultDescriptionImpl.java
Tue Jul 20 16:44:48 2010
@@ -46,6 +46,7 @@ class FaultDescriptionImpl implements Fa
private String name = ""; // WebFault.name
private String faultBean = ""; // WebFault.faultBean
private String targetNamespace = ""; // WebFault.targetNamespace
+ private String messageName = ""; //WebFault.messageName
private String faultInfo = null;
private static final String FAULT = "Fault";
@@ -163,6 +164,21 @@ class FaultDescriptionImpl implements Fa
return name;
}
+ public String getMessageName(){
+ if(messageName.length()>0){
+ return name;
+ }else{
+ WebFault annotation= this.getAnnoWebFault();
+ if(annotation!=null && annotation.messageName().length()>0){
+ messageName=annotation.messageName();
+ }else{
+ // The default is undefined.
+ // The JAX-WS layer may use the fault bean information to
determine the name
+ }
+ }
+ return messageName;
+ }
+
public String getTargetNamespace() {
if (targetNamespace.length() > 0) {
return targetNamespace;
Modified:
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java?rev=965900&r1=965899&r2=965900&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java
(original)
+++
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java
Tue Jul 20 16:44:48 2010
@@ -123,13 +123,13 @@ class OperationDescriptionImpl
private String requestWrapperTargetNamespace;
private String requestWrapperLocalName;
private String requestWrapperClassName;
-
+ private String requestWrapperPartName;
// ANNOTATION: @ResponseWrapper
private ResponseWrapper responseWrapperAnnotation;
private String responseWrapperLocalName;
private String responseWrapperTargetNamespace;
private String responseWrapperClassName;
-
+ private String responseWrapperPartName;
// ANNOTATION: @Action
private Action actionAnnotation;
@@ -1089,7 +1089,37 @@ class OperationDescriptionImpl
}
return requestWrapperClassName;
}
-
+
+ public String getRequestWrapperPartName(){
+ return getAnnoRequestWrapperPartName();
+ }
+
+ /**
+ * Return PartName for RequestWrapper annotation if one present.
+ * @return
+ */
+ public String getAnnoRequestWrapperPartName(){
+ if(!isWrappedParameters()){
+ return null;
+ }
+ if (requestWrapperPartName == null) {
+ if (getAnnoRequestWrapper() != null &&
+
!DescriptionUtils.isEmpty(getAnnoRequestWrapper().partName())) {
+ requestWrapperPartName = getAnnoRequestWrapper().partName();
+ } else {
+ // There is no default for the RequestWrapper part name.
+ requestWrapperPartName = null;
+ }
+ }
+ if(log.isDebugEnabled()){
+ if(requestWrapperPartName!=null){
+ log.debug("RequestWrapperPartName ="+requestWrapperPartName);
+ }else{
+ log.debug("RequestWrapperPartName = NULL");
+ }
+ }
+ return requestWrapperPartName;
+ }
// ===========================================
// ANNOTATION: ResponseWrapper
// ===========================================
@@ -1194,6 +1224,36 @@ class OperationDescriptionImpl
return responseWrapperClassName;
}
+ public String getResponseWrapperPartName(){
+ return getAnnoResponseWrapperPartName();
+ }
+
+ /**
+ * return ResponseWrapper PartName if one present.
+ * @return
+ */
+ public String getAnnoResponseWrapperPartName(){
+ if(!isWrappedParameters()){
+ return null;
+ }
+ if (responseWrapperPartName == null) {
+ if (getAnnoResponseWrapper() != null &&
+
!DescriptionUtils.isEmpty(getAnnoResponseWrapper().partName())) {
+ responseWrapperPartName = getAnnoResponseWrapper().partName();
+ } else {
+ // There is no default for the ResponseWrapper part name.
+ responseWrapperPartName = null;
+ }
+ }
+ if(log.isDebugEnabled()){
+ if(responseWrapperPartName!=null){
+ log.debug("ResponseWrapperPartName ="+responseWrapperPartName);
+ }else{
+ log.debug("ResponseWrapperPartName = NULL");
+ }
+ }
+ return responseWrapperPartName;
+ }
// ===========================================
// ANNOTATION: WebFault
// ===========================================
Modified:
axis/axis2/java/core/trunk/modules/metadata/test/org/apache/axis2/jaxws/description/AnnotationServiceImplDescriptionTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/metadata/test/org/apache/axis2/jaxws/description/AnnotationServiceImplDescriptionTests.java?rev=965900&r1=965899&r2=965900&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/metadata/test/org/apache/axis2/jaxws/description/AnnotationServiceImplDescriptionTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/metadata/test/org/apache/axis2/jaxws/description/AnnotationServiceImplDescriptionTests.java
Tue Jul 20 16:44:48 2010
@@ -43,6 +43,7 @@ import javax.jws.soap.SOAPBinding;
import javax.xml.ws.Holder;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;
+import javax.xml.ws.WebFault;
import java.io.IOException;
import java.util.Iterator;
@@ -1346,6 +1347,33 @@ public class AnnotationServiceImplDescri
assertTrue(checkParamDesc.isHeader());
}
+ /**
+ * This method tests the new property updates in JAX-WS2.2 specification.
+ * @RequestWrapper(PartName)
+ * @ResponseWrapper(PartName)
+ * @WebFault(MessageName)
+ * We will ensure that these new properties are successfully set in the
Metadata layer
+ */
+ public void testJAXWS22AnnotationPropertyUpdate(){
+ EndpointInterfaceDescription testEndpointInterfaceDesc =
+ getEndpointInterfaceDesc(ReqRspWrapperTestImpl.class);
+ OperationDescription operationDesc =
+
testEndpointInterfaceDesc.getOperationForJavaMethod("method1")[0];
+ assertNotNull(operationDesc);
+
+ assertEquals("jaxws22.RequestPartName",
+ operationDesc.getRequestWrapperPartName());
+
+ assertEquals("jaxws22.ResponsePartName",
+ operationDesc.getResponseWrapperPartName());
+
+
+ operationDesc =
testEndpointInterfaceDesc.getOperationForJavaMethod("method2")[0];
+ assertNotNull(operationDesc);
+ FaultDescription faultDescription =
operationDesc.getFaultDescriptions()[0];
+
+ assertEquals("jaxws22MessageName", faultDescription.getMessageName());
+ }
/*
* Method to return the endpoint interface description for a given
implementation class.
@@ -1461,10 +1489,12 @@ class DefaultReqRspWrapperBareTestImpl {
//Note the default parameterStyle is WRAPPED, so no type-level annotation is
required.
class ReqRspWrapperTestImpl {
@RequestWrapper(localName = "method1ReqWrapper", targetNamespace =
"http://a.b.c.method1ReqTNS",
- className =
"org.apache.axis2.jaxws.description.AnnotationServiceImplDescriptionTests.ReqRspWrapperTestImpl.method1ReqWrapper")
+ className =
"org.apache.axis2.jaxws.description.AnnotationServiceImplDescriptionTests.ReqRspWrapperTestImpl.method1ReqWrapper",
+ partName = "jaxws22.RequestPartName")
@ResponseWrapper(localName = "method1RspWrapper",
targetNamespace = "http://a.b.c.method1RspTNS",
- className =
"org.apache.axis2.jaxws.description.AnnotationServiceImplDescriptionTests.ReqRspWrapperTestImpl.method1RspWrapper")
+ className =
"org.apache.axis2.jaxws.description.AnnotationServiceImplDescriptionTests.ReqRspWrapperTestImpl.method1RspWrapper",
+ partName = "jaxws22.ResponsePartName")
public String method1(String s) {
return s;
}
@@ -1473,7 +1503,7 @@ class ReqRspWrapperTestImpl {
className =
"org.apache.axis2.jaxws.description.AnnotationServiceImplDescriptionTests.ReqRspWrapperTestImpl.method2ReqWrapper")
@ResponseWrapper(localName = "method2RspWrapper",
targetNamespace = "http://a.b.c.method2RspTNS")
- public String method2(String s) {
+ public String method2(String s) throws ReqRspWrapperException{
return s;
}
@@ -1490,6 +1520,17 @@ class ReqRspWrapperTestImpl {
}
}
+...@webfault(messageName="jaxws22MessageName")
+class ReqRspWrapperException extends Exception{
+ private String message = null;
+ public ReqRspWrapperException(){
+
+ }
+ public ReqRspWrapperException(String message){
+ this.message = message;
+ }
+
+}
//=============================================================================
//testWebMethod service implementaiton class
//=============================================================================