You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Neil Youngman (JIRA)" <ji...@apache.org> on 2009/05/15 10:58:45 UTC

[jira] Issue Comment Edited: (AXIS2-3843) httpFrontendHostUrl does not affect auto-generated WSDL

    [ https://issues.apache.org/jira/browse/AXIS2-3843?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12709764#action_12709764 ] 

Neil Youngman edited comment on AXIS2-3843 at 5/15/09 1:58 AM:
---------------------------------------------------------------

What I now have locally is patched as follows:

*** SimpleHTTPServer.java.~1~	2008-08-06 17:12:26.000000000 +0100
--- SimpleHTTPServer.java	2009-05-15 09:29:33.000000000 +0100
*************** public class SimpleHTTPServer implements
*** 251,268 ****
       * @see org.apache.axis2.transport.TransportListener#getEPRForService(String,String)
       */
      public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault {
          //if host address is present
          if (hostAddress != null) {
              if (embedded != null) {
!                 String endpointRefernce = hostAddress ;
                  if(configurationContext.getServiceContextPath().startsWith("/")){
!                     endpointRefernce =  endpointRefernce +
!                             configurationContext.getServiceContextPath() + "/" + serviceName;
                  } else {
!                     endpointRefernce = endpointRefernce + '/' +
!                             configurationContext.getServiceContextPath() + "/" + serviceName;
                  }
!                 return new EndpointReference[]{new EndpointReference(endpointRefernce + "/")};
              } else {
                  throw new AxisFault("Unable to generate EPR for the transport : http");
              }
--- 251,275 ----
       * @see org.apache.axis2.transport.TransportListener#getEPRForService(String,String)
       */
      public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault {
+         Parameter frontEndHostParam = configurationContext.getAxisConfiguration().getParameter(
+             Constants.HTTP_FRONTEND_HOST_URL);
+         if (frontEndHostParam != null) {
+             return new EndpointReference[]
+             {new EndpointReference((String) frontEndHostParam.getValue() + "/" + serviceName + "/")};
+         }
+ 
          //if host address is present
          if (hostAddress != null) {
              if (embedded != null) {
!                 String endpointReference = hostAddress ;
                  if(configurationContext.getServiceContextPath().startsWith("/")){
!                     endpointReference =  endpointReference +
!                         configurationContext.getServiceContextPath() + "/" + serviceName;
                  } else {
!                     endpointReference = endpointReference + '/' +
!                         configurationContext.getServiceContextPath() + "/" + serviceName;
                  }
!                 return new EndpointReference[]{new EndpointReference(endpointReference + "/")};
              } else {
                  throw new AxisFault("Unable to generate EPR for the transport : http");
              }
*************** public class SimpleHTTPServer implements
*** 277,302 ****
                      localAddress = HttpUtils.getIpAddress(configurationContext.getAxisConfiguration());
                  }
                  if (localAddress == null) {
!                    ipAddress = "127.0.0.1";
!                  } else {
                      ipAddress = localAddress;
!                  }
              } catch (SocketException e) {
                  throw AxisFault.makeFault(e);
              }
          }
          if (embedded != null) {
!             String endpointRefernce = "http://" + ipAddress + ":" + embedded.getPort() ;
              if(configurationContext.getServiceContextPath().startsWith("/")){
!                 endpointRefernce =  endpointRefernce +
!                         configurationContext.getServiceContextPath() + "/" + serviceName;
              } else {
!                 endpointRefernce = endpointRefernce + '/' +
!                         configurationContext.getServiceContextPath() + "/" + serviceName;
              }
  
! 
!             return new EndpointReference[]{new EndpointReference(endpointRefernce + "/")};
          } else {
              throw new AxisFault("Unable to generate EPR for the transport : http");
          }
--- 284,308 ----
                      localAddress = HttpUtils.getIpAddress(configurationContext.getAxisConfiguration());
                  }
                  if (localAddress == null) {
!                     ipAddress = "127.0.0.1";
!                 } else {
                      ipAddress = localAddress;
!                 }
              } catch (SocketException e) {
                  throw AxisFault.makeFault(e);
              }
          }
          if (embedded != null) {
!             String endpointReference = "http://" + ipAddress + ":" + embedded.getPort() ;
              if(configurationContext.getServiceContextPath().startsWith("/")){
!                 endpointReference =  endpointReference +
!                     configurationContext.getServiceContextPath() + "/" + serviceName;
              } else {
!                 endpointReference = endpointReference + '/' +
!                     configurationContext.getServiceContextPath() + "/" + serviceName;
              }
  
!             return new EndpointReference[]{new EndpointReference(endpointReference + "/")};
          } else {
              throw new AxisFault("Unable to generate EPR for the transport : http");
          }


*** AxisServlet.java.~1~	2008-08-06 17:12:26.000000000 +0100
--- AxisServlet.java	2009-05-15 09:18:37.000000000 +0100
*************** public class AxisServlet extends HttpSer
*** 566,596 ****
      }
  
      public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault {
!         //RUNNING_PORT
!         String port = (String) configContext.getProperty(ListingAgent.RUNNING_PORT);
!         if (port == null) {
!             port = "8080";
!         }
!         if (ip == null) {
!             try {
!                 ip = HttpUtils.getIpAddress(axisConfiguration);
!                 if (ip == null) {
!                     ip = "localhost";
                  }
-             } catch (SocketException e) {
-                 throw AxisFault.makeFault(e);
              }
-         }
  
!         String endpointRefernce = "http://" + ip + ":" + port;
!         if (configContext.getServiceContextPath().startsWith("/")) {
!             endpointRefernce = endpointRefernce +
                      configContext.getServiceContextPath() + "/" + serviceName;
!         } else {
!             endpointRefernce = endpointRefernce + '/' +
                      configContext.getServiceContextPath() + "/" + serviceName;
          }
!         EndpointReference endpoint = new EndpointReference(endpointRefernce + "/");
  
          return new EndpointReference[]{endpoint};
      }
--- 566,605 ----
      }
  
      public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault {
!         String endpointReference;
!         Parameter frontEndHostParam = configContext.getAxisConfiguration().getParameter(
!             Constants.HTTP_FRONTEND_HOST_URL);
!         if (frontEndHostParam != null) {
!             endpointReference = (String) frontEndHostParam.getValue() + "/" + serviceName;
!         } else {
!             //RUNNING_PORT
!             String port = (String)
!                 configContext.getProperty(ListingAgent.RUNNING_PORT);
!             if (port == null) {
!                 port = "8080";
!             }
!             if (ip == null) {
!                 try {
!                     ip = HttpUtils.getIpAddress(axisConfiguration);
!                     if (ip == null) {
!                         ip = "localhost";
!                     }
!                 } catch (SocketException e) {
!                     throw AxisFault.makeFault(e);
                  }
              }
  
!             endpointReference = "http://" + ip + ":" + port;
!             if (configContext.getServiceContextPath().startsWith("/")) {
!                 endpointReference = endpointReference +
                      configContext.getServiceContextPath() + "/" + serviceName;
!             } else {
!                 endpointReference = endpointReference + '/' +
                      configContext.getServiceContextPath() + "/" + serviceName;
+             }
          }
! 
!         EndpointReference endpoint = new EndpointReference(endpointReference + "/");
  
          return new EndpointReference[]{endpoint};
      }

It seems to work as I would expect, but it hasn't been extensively tested.

Note that some of the changes are simply a spelling correction from endpointRefernce to endpointReference

      was (Author: swordfish):
    What I now have locally is patched as follows:

*** SimpleHTTPServer.java.~1~	2008-08-06 17:12:26.000000000 +0100
--- SimpleHTTPServer.java	2009-05-15 09:29:33.000000000 +0100
*************** public class SimpleHTTPServer implements
*** 251,268 ****
       * @see org.apache.axis2.transport.TransportListener#getEPRForService(String,String)
       */
      public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault {
          //if host address is present
          if (hostAddress != null) {
              if (embedded != null) {
!                 String endpointRefernce = hostAddress ;
                  if(configurationContext.getServiceContextPath().startsWith("/")){
!                     endpointRefernce =  endpointRefernce +
!                             configurationContext.getServiceContextPath() + "/" + serviceName;
                  } else {
!                     endpointRefernce = endpointRefernce + '/' +
!                             configurationContext.getServiceContextPath() + "/" + serviceName;
                  }
!                 return new EndpointReference[]{new EndpointReference(endpointRefernce + "/")};
              } else {
                  throw new AxisFault("Unable to generate EPR for the transport : http");
              }
--- 251,275 ----
       * @see org.apache.axis2.transport.TransportListener#getEPRForService(String,String)
       */
      public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault {
+         Parameter frontEndHostParam = configurationContext.getAxisConfiguration().getParameter(
+             Constants.HTTP_FRONTEND_HOST_URL);
+         if (frontEndHostParam != null) {
+             return new EndpointReference[]
+             {new EndpointReference((String) frontEndHostParam.getValue() + "/" + serviceName + "/")};
+         }
+ 
          //if host address is present
          if (hostAddress != null) {
              if (embedded != null) {
!                 String endpointReference = hostAddress ;
                  if(configurationContext.getServiceContextPath().startsWith("/")){
!                     endpointReference =  endpointReference +
!                         configurationContext.getServiceContextPath() + "/" + serviceName;
                  } else {
!                     endpointReference = endpointReference + '/' +
!                         configurationContext.getServiceContextPath() + "/" + serviceName;
                  }
!                 return new EndpointReference[]{new EndpointReference(endpointReference + "/")};
              } else {
                  throw new AxisFault("Unable to generate EPR for the transport : http");
              }
*************** public class SimpleHTTPServer implements
*** 277,302 ****
                      localAddress = HttpUtils.getIpAddress(configurationContext.getAxisConfiguration());
                  }
                  if (localAddress == null) {
!                    ipAddress = "127.0.0.1";
!                  } else {
                      ipAddress = localAddress;
!                  }
              } catch (SocketException e) {
                  throw AxisFault.makeFault(e);
              }
          }
          if (embedded != null) {
!             String endpointRefernce = "http://" + ipAddress + ":" + embedded.getPort() ;
              if(configurationContext.getServiceContextPath().startsWith("/")){
!                 endpointRefernce =  endpointRefernce +
!                         configurationContext.getServiceContextPath() + "/" + serviceName;
              } else {
!                 endpointRefernce = endpointRefernce + '/' +
!                         configurationContext.getServiceContextPath() + "/" + serviceName;
              }
  
! 
!             return new EndpointReference[]{new EndpointReference(endpointRefernce + "/")};
          } else {
              throw new AxisFault("Unable to generate EPR for the transport : http");
          }
--- 284,308 ----
                      localAddress = HttpUtils.getIpAddress(configurationContext.getAxisConfiguration());
                  }
                  if (localAddress == null) {
!                     ipAddress = "127.0.0.1";
!                 } else {
                      ipAddress = localAddress;
!                 }
              } catch (SocketException e) {
                  throw AxisFault.makeFault(e);
              }
          }
          if (embedded != null) {
!             String endpointReference = "http://" + ipAddress + ":" + embedded.getPort() ;
              if(configurationContext.getServiceContextPath().startsWith("/")){
!                 endpointReference =  endpointReference +
!                     configurationContext.getServiceContextPath() + "/" + serviceName;
              } else {
!                 endpointReference = endpointReference + '/' +
!                     configurationContext.getServiceContextPath() + "/" + serviceName;
              }
  
!             return new EndpointReference[]{new EndpointReference(endpointReference + "/")};
          } else {
              throw new AxisFault("Unable to generate EPR for the transport : http");
          }


*** AxisServlet.java.~1~	2008-08-06 17:12:26.000000000 +0100
--- AxisServlet.java	2009-05-15 09:18:37.000000000 +0100
*************** public class AxisServlet extends HttpSer
*** 566,596 ****
      }
  
      public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault {
!         //RUNNING_PORT
!         String port = (String) configContext.getProperty(ListingAgent.RUNNING_PORT);
!         if (port == null) {
!             port = "8080";
!         }
!         if (ip == null) {
!             try {
!                 ip = HttpUtils.getIpAddress(axisConfiguration);
!                 if (ip == null) {
!                     ip = "localhost";
                  }
-             } catch (SocketException e) {
-                 throw AxisFault.makeFault(e);
              }
-         }
  
!         String endpointRefernce = "http://" + ip + ":" + port;
!         if (configContext.getServiceContextPath().startsWith("/")) {
!             endpointRefernce = endpointRefernce +
                      configContext.getServiceContextPath() + "/" + serviceName;
!         } else {
!             endpointRefernce = endpointRefernce + '/' +
                      configContext.getServiceContextPath() + "/" + serviceName;
          }
!         EndpointReference endpoint = new EndpointReference(endpointRefernce + "/");
  
          return new EndpointReference[]{endpoint};
      }
--- 566,605 ----
      }
  
      public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault {
!         String endpointReference;
!         Parameter frontEndHostParam = configContext.getAxisConfiguration().getParameter(
!             Constants.HTTP_FRONTEND_HOST_URL);
!         if (frontEndHostParam != null) {
!             endpointReference = (String) frontEndHostParam.getValue() + "/" + serviceName;
!         } else {
!             //RUNNING_PORT
!             String port = (String)
!                 configContext.getProperty(ListingAgent.RUNNING_PORT);
!             if (port == null) {
!                 port = "8080";
!             }
!             if (ip == null) {
!                 try {
!                     ip = HttpUtils.getIpAddress(axisConfiguration);
!                     if (ip == null) {
!                         ip = "localhost";
!                     }
!                 } catch (SocketException e) {
!                     throw AxisFault.makeFault(e);
                  }
              }
  
!             endpointReference = "http://" + ip + ":" + port;
!             if (configContext.getServiceContextPath().startsWith("/")) {
!                 endpointReference = endpointReference +
                      configContext.getServiceContextPath() + "/" + serviceName;
!             } else {
!                 endpointReference = endpointReference + '/' +
                      configContext.getServiceContextPath() + "/" + serviceName;
+             }
          }
! 
!         EndpointReference endpoint = new EndpointReference(endpointReference + "/");
  
          return new EndpointReference[]{endpoint};
      }

It seems to work as I would expect, but it hasn't been extensively tested.
  
> httpFrontendHostUrl does not affect auto-generated WSDL
> -------------------------------------------------------
>
>                 Key: AXIS2-3843
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3843
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: wsdl
>    Affects Versions: 1.4
>         Environment: Windows 2003 Server, Tomcat 6.0, Axis2 1.4
>            Reporter: Alexander Stockinger
>
> Setting the "httpFrontendHostUrl" parameter in the "axis2.conf" config file does not affect endpoint URL in auto-generated WSDL.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.