Author: mageshbk(a)jboss.com
Date: 2007-05-06 02:50:21 -0400 (Sun, 06 May 2007)
New Revision: 2977
Modified:
branches/jbossws-1.2.0.SP1-JBWS-1643/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpoint.java
branches/jbossws-1.2.0.SP1-JBWS-1643/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointManager.java
Log:
[JBWS-1609]Address in WSDL - Port value is -1 when server is requested with default port
80
Modified:
branches/jbossws-1.2.0.SP1-JBWS-1643/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpoint.java
===================================================================
---
branches/jbossws-1.2.0.SP1-JBWS-1643/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpoint.java 2007-05-06
06:47:02 UTC (rev 2976)
+++
branches/jbossws-1.2.0.SP1-JBWS-1643/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpoint.java 2007-05-06
06:50:21 UTC (rev 2977)
@@ -58,6 +58,7 @@
* This object registered with the ServiceEndpointManager service.
*
* @author Thomas.Diesler(a)jboss.org
+ * @author mageshbk(a)jboss.com
* @since 16-Jan-2005
*/
public class ServiceEndpoint
@@ -134,15 +135,16 @@
ServiceEndpointInfo sepInfo = getServiceEndpointInfo();
EndpointMetaData epMetaData = sepInfo.getServerEndpointMetaData();
- //String wsdlHost = reqURL.getHost();
+ ServiceEndpointManagerFactory factory =
ServiceEndpointManagerFactory.getInstance();
+ ServiceEndpointManager epManager = factory.getServiceEndpointManager();
+
String wsdlHost = reqURL.getProtocol() + "://" + reqURL.getHost() +
":" + reqURL.getPort();
- ServiceEndpointManagerFactory factory =
ServiceEndpointManagerFactory.getInstance();
- ServiceEndpointManager epManager = factory.getServiceEndpointManager();
if (epManager.getWebServiceHost().equals(ServiceEndpointManager.UNDEFINED_HOSTNAME)
== false)
{
- wsdlHost = epManager.getWebServiceHost();
+ wsdlHost = epManager.getDisplayHost(sepInfo, reqURL);
}
+
if(log.isDebugEnabled()) log.debug("WSDL request, using host: " +
wsdlHost);
WSDLRequestHandler wsdlRequestHandler = new WSDLRequestHandler(epMetaData);
Modified:
branches/jbossws-1.2.0.SP1-JBWS-1643/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointManager.java
===================================================================
---
branches/jbossws-1.2.0.SP1-JBWS-1643/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointManager.java 2007-05-06
06:47:02 UTC (rev 2976)
+++
branches/jbossws-1.2.0.SP1-JBWS-1643/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointManager.java 2007-05-06
06:50:21 UTC (rev 2977)
@@ -78,6 +78,7 @@
* A service that manages JBossWS endpoints.
*
* @author Thomas.Diesler(a)jboss.org
+ * @author mageshbk(a)jboss.com
* @since 15-Jan-2005
*/
public class ServiceEndpointManager implements ServiceEndpointManagerMBean
@@ -334,18 +335,73 @@
return registered;
}
- private String getDisplayAddress(ServiceEndpointInfo seInfo, URL requestURL) throws
MalformedURLException {
+
+ private String getDisplayAddress(ServiceEndpointInfo seInfo, URL requestURL) throws
MalformedURLException
+ {
String endpointAddress = seInfo.getServerEndpointMetaData().getEndpointAddress();
URL displayURL = new URL(endpointAddress);
- String endPointPath = displayURL.getPath();
- if (this.getWebServiceHost().equals(ServiceEndpointManager.UNDEFINED_HOSTNAME) ==
true)
+ String displayHost = getDisplayHost(seInfo, requestURL);
+
+ String displayAddress = displayHost + displayURL.getPath();
+ if (log.isDebugEnabled())
{
- displayURL = requestURL;
+ log.trace("Mapping WSDL soap:address from '" + endpointAddress +
"' to '" + displayAddress + "'");
}
- String displayAddress = displayURL.getProtocol() + "://" +
displayURL.getHost() + ":" + displayURL.getPort() + endPointPath;
return displayAddress;
}
+ /*
+ * Formats the Service endpoint host according to the beans.xml definition and
+ * the requested url and returns the URL as string
+ *
+ */
+ public String getDisplayHost(ServiceEndpointInfo seInfo, URL requestURL) throws
MalformedURLException
+ {
+ String endpointAddress = seInfo.getServerEndpointMetaData().getEndpointAddress();
+ URL displayURL = new URL(endpointAddress);
+ String protocol = displayURL.getProtocol();
+ String host = displayURL.getHost();
+ int port = displayURL.getPort();
+ String uriScheme = requestURL.getProtocol();
+ if
("CONFIDENTIAL".equals(seInfo.getServerEndpointMetaData().getTransportGuarantee()))
+ {
+ //If service is defined to be confidential then always it is https
+ uriScheme = "https";
+ }
+ if (alwaysModifySOAPAddress ||
host.equals(ServiceEndpointManager.UNDEFINED_HOSTNAME) == true)
+ {
+ //Modify the address
+ if (this.getWebServiceHost().equals(ServiceEndpointManager.UNDEFINED_HOSTNAME)
== true)
+ {
+ //Use the incoming request's address
+ protocol = uriScheme;
+ host = requestURL.getHost();
+ port = requestURL.getPort();
+ }
+ else
+ {
+ //Use the address given in jboss-beans.xml
+ protocol = uriScheme;
+ host = this.getWebServiceHost();
+ if (protocol.equals("https"))
+ {
+ port = this.getWebServiceSecurePort();
+ }
+ else
+ {
+ port = this.getWebServicePort();
+ }
+ }
+ }
+ String displayHost = protocol + "://" + host + (port > 0 ?
":" + port : "");
+
+ if (log.isDebugEnabled())
+ {
+ log.trace("Mapping WSDL host from '" + protocol + "://"
+ host + ":" + port + "' to '" + displayHost +
"'");
+ }
+ return displayHost;
+ }
+
/** Get the endpoint metrics
*/
public ServiceEndpointMetrics getServiceEndpointMetrics(ObjectName sepID)
Show replies by date