Author: jim.ma
Date: 2013-08-23 02:35:05 -0400 (Fri, 23 Aug 2013)
New Revision: 17884
Modified:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/serviceref/AbstractServiceObjectFactoryJAXWS.java
Log:
[JBWS-3679]:Use local deployed endpoint address to initialize port and avoid to use the
rewrote soap address
Modified:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/serviceref/AbstractServiceObjectFactoryJAXWS.java
===================================================================
---
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/serviceref/AbstractServiceObjectFactoryJAXWS.java 2013-08-21
14:52:50 UTC (rev 17883)
+++
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/serviceref/AbstractServiceObjectFactoryJAXWS.java 2013-08-23
06:35:05 UTC (rev 17884)
@@ -33,6 +33,7 @@
import java.util.List;
import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
import javax.xml.ws.RespectBindingFeature;
import javax.xml.ws.Service;
import javax.xml.ws.WebServiceClient;
@@ -77,8 +78,16 @@
{
final QName portQName = this.getPortQName(targetClassName,
serviceImplClass, serviceRef);
final WebServiceFeature[] portFeatures = this.getFeatures(targetClassName,
serviceImplClass, serviceRef);
-
- return instantiatePort(serviceClass, targetClass, serviceInstance,
portQName, portFeatures);
+ String forcedAddress = null;
+ //if there is no wsdlLocation, always use the local deployed endpoint
address to initialize port
+ URL wsdlURL = this.getWsdlURL(serviceRef, serviceClass);
+ final QName serviceQName = this.getServiceQName(serviceRef,
serviceClass);
+ if (wsdlURL == null &&
serviceRef.getDeployedServiceAddresses().get(serviceQName) != null)
+ {
+ forcedAddress =
serviceRef.getDeployedServiceAddresses().get(serviceQName);
+ }
+ return instantiatePort(serviceClass, targetClass, serviceInstance,
portQName, portFeatures,
+ forcedAddress);
}
}
finally
@@ -168,7 +177,7 @@
}
private Object instantiatePort(final Class<?> serviceClass, final Class<?>
targetClass, final Service target,
- final QName portQName, final WebServiceFeature[] features) throws
NoSuchMethodException,
+ final QName portQName, final WebServiceFeature[] features, final String
endpointAddress) throws NoSuchMethodException,
InstantiationException, IllegalAccessException, InvocationTargetException
{
Object retVal = null;
@@ -198,7 +207,10 @@
port = method.invoke(target, args);
retVal = port;
}
-
+ if (endpointAddress != null)
+ {
+ ((BindingProvider)
retVal).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
endpointAddress);
+ }
return retVal;
}
Show replies by date