Author: richard.opalka(a)jboss.com
Date: 2011-08-13 19:16:46 -0400 (Sat, 13 Aug 2011)
New Revision: 14836
Modified:
common/branches/jbossws-common-1.4.1.SP1/pom.xml
common/branches/jbossws-common-1.4.1.SP1/src/main/java/org/jboss/wsf/common/serviceref/AbstractServiceObjectFactoryJAXWS.java
Log:
[JBWS-3338] construct ports using features properly
Modified: common/branches/jbossws-common-1.4.1.SP1/pom.xml
===================================================================
--- common/branches/jbossws-common-1.4.1.SP1/pom.xml 2011-08-13 23:12:31 UTC (rev 14835)
+++ common/branches/jbossws-common-1.4.1.SP1/pom.xml 2011-08-13 23:16:46 UTC (rev 14836)
@@ -27,7 +27,7 @@
<!-- Properties -->
<properties>
- <jbossws.spi.version>1.4.1.GA</jbossws.spi.version>
+ <jbossws.spi.version>1.4.1.SP1</jbossws.spi.version>
<jboss.jaxbintros.version>1.0.2.GA</jboss.jaxbintros.version>
<jboss.common.core.version>2.2.14.GA</jboss.common.core.version>
<jboss.ejb.api.version>3.0.0.GA</jboss.ejb.api.version>
Modified:
common/branches/jbossws-common-1.4.1.SP1/src/main/java/org/jboss/wsf/common/serviceref/AbstractServiceObjectFactoryJAXWS.java
===================================================================
---
common/branches/jbossws-common-1.4.1.SP1/src/main/java/org/jboss/wsf/common/serviceref/AbstractServiceObjectFactoryJAXWS.java 2011-08-13
23:12:31 UTC (rev 14835)
+++
common/branches/jbossws-common-1.4.1.SP1/src/main/java/org/jboss/wsf/common/serviceref/AbstractServiceObjectFactoryJAXWS.java 2011-08-13
23:16:46 UTC (rev 14836)
@@ -190,7 +190,9 @@
Class<?> retType = method.getReturnType();
if (methodName.startsWith("get") &&
targetClass.isAssignableFrom(retType))
{
- port = method.invoke(target, new Object[0]);
+ final Method targetMethod = getMethodFor(methodName, features,
serviceClass);
+ final Object[] args = getArgumentsFor(features);
+ port = targetMethod.invoke(target, args);
retVal = port;
break;
}
@@ -199,7 +201,7 @@
if (port == null)
{
- Method method = getMethodFor(portQName, features, serviceClass);
+ Method method = getMethodFor("getPort", portQName, features,
serviceClass);
Object[] args = getArgumentsFor(portQName, features, targetClass);
port = method.invoke(target, args);
retVal = port;
@@ -345,25 +347,38 @@
return null;
}
- private Method getMethodFor(final QName portQName, final WebServiceFeature[] features,
final Class<?> serviceClass)
+ private Method getMethodFor(final String methodName, final QName portQName, final
WebServiceFeature[] features, final Class<?> serviceClass)
throws NoSuchMethodException
{
if ((portQName == null) && (features == null))
- return serviceClass.getMethod("getPort", new Class[]
+ return serviceClass.getMethod(methodName, new Class[]
{Class.class});
if ((portQName != null) && (features == null))
- return serviceClass.getMethod("getPort", new Class[]
+ return serviceClass.getMethod(methodName, new Class[]
{QName.class, Class.class});
if ((portQName == null) && (features != null))
- return serviceClass.getMethod("getPort", new Class[]
+ return serviceClass.getMethod(methodName, new Class[]
{Class.class, WebServiceFeature[].class});
if ((portQName != null) && (features != null))
- return serviceClass.getMethod("getPort", new Class[]
+ return serviceClass.getMethod(methodName, new Class[]
{QName.class, Class.class, WebServiceFeature[].class});
throw new IllegalStateException();
}
+ private Method getMethodFor(final String methodName, final WebServiceFeature[]
features, final Class<?> serviceClass)
+ throws NoSuchMethodException
+ {
+ if (features == null)
+ {
+ return serviceClass.getMethod(methodName, new Class[] {});
+ }
+ else
+ {
+ return serviceClass.getMethod(methodName, new Class[] { WebServiceFeature[].class }
);
+ }
+ }
+
private Object[] getArgumentsFor(final QName portQName, final WebServiceFeature[]
features,
final Class<?> targetClass) throws NoSuchMethodException
{
@@ -383,6 +398,18 @@
throw new IllegalStateException();
}
+ private Object[] getArgumentsFor(final WebServiceFeature[] features) throws
NoSuchMethodException
+ {
+ if (features == null)
+ {
+ return new Object[] {};
+ }
+ else
+ {
+ return new Object[] {features};
+ }
+ }
+
private WebServiceFeature[] getFeatures(final UnifiedServiceRefMetaData serviceRef)
{
List<WebServiceFeature> features = new
LinkedList<WebServiceFeature>();
@@ -425,8 +452,9 @@
{
List<WebServiceFeature> features = new
LinkedList<WebServiceFeature>();
// configure @Addressing feature
- if (portComponentRefMD.isAddressingEnabled())
+ if (portComponentRefMD.isAddressingAnnotationSpecified())
{
+ final boolean enabled = portComponentRefMD.isAddressingEnabled();
final boolean required = portComponentRefMD.isAddressingRequired();
final String refResponses = portComponentRefMD.getAddressingResponses();
AddressingFeature.Responses responses = AddressingFeature.Responses.ALL;
@@ -435,7 +463,7 @@
if ("NON_ANONYMOUS".equals(refResponses))
responses = AddressingFeature.Responses.NON_ANONYMOUS;
- features.add(new AddressingFeature(true, required, responses));
+ features.add(new AddressingFeature(enabled, required, responses));
}
// configure @MTOM feature
@@ -445,9 +473,10 @@
}
// configure @RespectBinding feature
- if (portComponentRefMD.isRespectBindingEnabled())
+ if (portComponentRefMD.isRespectBindingAnnotationSpecified())
{
- features.add(new RespectBindingFeature(true));
+ final boolean enabled = portComponentRefMD.isRespectBindingEnabled();
+ features.add(new RespectBindingFeature(enabled));
}
return features.size() == 0 ? null : features.toArray(new WebServiceFeature[]