Thanks for the comments, all. I hacked the source code for 2.4.2,
putting in the fix in the method getAbsoluteAddress that was already in
the source code in the repository (and will presumably be there for
2.4.3). This made the problems disappear. Good job!

David Sills



-----Original Message-----
From: David Sills [mailto:dsi...@datasourceinc.com] 
Sent: Wednesday, October 05, 2011 12:43 PM
To: users@cxf.apache.org
Subject: Published endpoint URL

All:

I'm not sure how to move forward on this or whether I'm doing this all
wrong and could use a suggestion. Ideas?

The code in FormattedServiceListWriter seems to have an issue. I am
specifying in my Spring configuration the property publishedEndpointUrl:

  <jaxws:endpoint 
        id="fingerprintService" 
        implementor="#fingerprintServiceBean"
        address="/FingerprintService"
 
publishedEndpointUrl="https://dsills-t1500:8300/dsi-services/secure/Fing
erprintService"
  />

I so this because I want it clear how the service is to be addressed.
The code in the list writer, however, doesn't work for me:

    private String getAbsoluteAddress(String basePath,
AbstractDestination d) {
        String endpointAddress =
(String)d.getEndpointInfo().getProperty("publishedEndpointUrl");
        if (endpointAddress != null) {
            return endpointAddress;
        }
        endpointAddress = d.getEndpointInfo().getAddress();
***     if (basePath == null || endpointAddress.startsWith(basePath)) {
            return endpointAddress;
        } else {
            return basePath + endpointAddress;
        }
    }

This produces:

http://dsills-t1500:9090/dsi-serviceshttps://dsills-t1500:8300/dsi-servi
ces/secure/FingerprintService

which is obviously nonsense.

Perhaps this might help?:

***     if (basePath == null || endpointAddress.startsWith(basePath) ||
                        isValidURL(endpointAddress)) {
...

where isValidURL is something like:

private boolean isValidURL(String endpointAddress)
{
  if (endpointAddress.indexOf("://") != -1)
  {
    try
    {
      URL url = new URL(endpointAddress);
    }
    catch (MalformedURLException e) { }
  }
  return false;
}

Of course, you may already have a utility that can do this as well - I
don't know the whole codebase, but it's just an idea.

David Sills

Reply via email to