You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Davanum Srinivas <da...@gmail.com> on 2007/01/17 04:34:50 UTC

Re: svn commit: r496446 - /geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java

Hi,

See enclosed diff. Specifically the url :)

thanks,
dims

On 1/16/07, Lin Sun <li...@gmail.com> wrote:
> Hi Dims, just curious... how were you able to verify '?wsdl' working?  I
> haven't been able to get '?wsdl' working with the cxfpojows test case.
>
> Thanks, Lin
>
> -----Original Message-----
> From: dims@apache.org [mailto:dims@apache.org]
> Sent: Monday, January 15, 2007 2:08 PM
> To: scm@geronimo.apache.org
> Subject: svn commit: r496446 -
> /geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geron
> imo/axis2/Axis2WebServiceContainer.java
>
> Author: dims
> Date: Mon Jan 15 11:07:43 2007
> New Revision: 496446
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=496446
> Log:
> get ?wsdl working. next step is to get the actual call working
>
> Modified:
>
> geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geroni
> mo/axis2/Axis2WebServiceContainer.java
>
> Modified:
> geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geroni
> mo/axis2/Axis2WebServiceContainer.java
> URL:
> http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/sr
> c/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java?view=dif
> f&rev=496446&r1=496445&r2=496446
> ============================================================================
> ==
> ---
> geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geroni
> mo/axis2/Axis2WebServiceContainer.java (original)
> +++
> geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geroni
> mo/axis2/Axis2WebServiceContainer.java Mon Jan 15 11:07:43 2007
> @@ -44,6 +44,7 @@
>  import javax.xml.namespace.QName;
>  import java.io.PrintWriter;
>  import java.net.SocketException;
> +import java.net.URI;
>  import java.util.HashMap;
>  import java.util.Map;
>
> @@ -58,7 +59,7 @@
>      private transient final ClassLoader classLoader;
>      private final String endpointClassName;
>      private final PortInfo portInfo;
> -    ConfigurationContext configurationContext =
> ConfigurationContextFactory.createEmptyConfigurationContext();
> +    private ConfigurationContext configurationContext;
>      private String contextRoot = null;
>
>      public Axis2WebServiceContainer(PortInfo portInfo, String
> endpointClassName, ClassLoader classLoader) {
> @@ -66,10 +67,13 @@
>          this.endpointClassName = endpointClassName;
>          this.portInfo = portInfo;
>          try {
> +            configurationContext =
> ConfigurationContextFactory.createDefaultConfigurationContext();
>              AxisService service =
> AxisService.createService(endpointClassName,
> configurationContext.getAxisConfiguration(), RPCMessageReceiver.class);
>
> configurationContext.getAxisConfiguration().addService(service);
>          } catch (AxisFault af) {
>              throw new RuntimeException(af);
> +        } catch (Exception e) {
> +            throw new RuntimeException(e);
>          }
>      }
>
> @@ -144,12 +148,9 @@
>                  } else {
>                      response.setStatusCode(500);
>                      String msg = ex.getMessage();
> -                    if (msg == null || msg.trim().length() == 0) {
> -                        msg = "Exception message unknown";
> -                    }
>                      response.setHeader(HTTPConstants.HEADER_CONTENT_TYPE,
> "text/plain");
>                      PrintWriter pw = new
> PrintWriter(response.getOutputStream());
> -                    pw.write(msg);
> +                    ex.printStackTrace(pw);
>                      pw.flush();
>                  }
>              }
> @@ -184,7 +185,8 @@
>          final String servicePath =
> configurationContext.getServiceContextPath();
>          final String contextPath = (servicePath.startsWith("/") ?
> servicePath : "/" + servicePath) + "/";
>
> -        String uri = request.getURI().toString();
> +        URI uri = request.getURI();
> +        String path = uri.getPath();
>          String soapAction =
> request.getHeader(HTTPConstants.HEADER_SOAP_ACTION);
>
>          // TODO: Port this section
> @@ -209,14 +211,14 @@
>  //        }
>
>          if (request.getMethod() == Request.GET) {
> -            if (!uri.startsWith(contextPath)) {
> +            if (!path.startsWith(contextPath)) {
>                  response.setStatusCode(301);
>                  response.setHeader("Location", contextPath);
>                  return;
>              }
> -            if (uri.indexOf("?") < 0) {
> -                if (!uri.endsWith(contextPath)) {
> -                    String serviceName = uri.replaceAll(contextPath, "");
> +            if (uri.toString().indexOf("?") < 0) {
> +                if (!path.endsWith(contextPath)) {
> +                    String serviceName = path.replaceAll(contextPath, "");
>                      if (serviceName.indexOf("/") < 0) {
>                          String res =
> HTTPTransportReceiver.printServiceHTML(serviceName, configurationContext);
>                          PrintWriter pw = new
> PrintWriter(response.getOutputStream());
> @@ -225,28 +227,26 @@
>                      }
>                  }
>              }
> -            if (uri.endsWith("?wsdl2")) {
> -                String serviceName = uri.substring(uri.lastIndexOf("/") +
> 1, uri.length() - 6);
> +            if (uri.getQuery().startsWith("wsdl2")) {
> +                String serviceName = path.substring(path.lastIndexOf("/") +
> 1, path.length() - 6);
>                  HashMap services =
> configurationContext.getAxisConfiguration().getServices();
>                  final AxisService service = (AxisService)
> services.get(serviceName);
>                  if (service != null) {
> -                    final String ip = HttpUtils.getIpAddress();
> -                    service.printWSDL2(response.getOutputStream(), ip,
> servicePath);
> +                    service.printWSDL2(response.getOutputStream(),
> uri.getHost(), servicePath);
>                      return;
>                  }
>              }
> -            if (uri.endsWith("?wsdl")) {
> -                String serviceName = uri.substring(uri.lastIndexOf("/") +
> 1, uri.length() - 5);
> +            if (uri.getQuery().startsWith("wsdl")) {
> +                String serviceName = path.substring(path.lastIndexOf("/") +
> 1);
>                  HashMap services =
> configurationContext.getAxisConfiguration().getServices();
>                  final AxisService service = (AxisService)
> services.get(serviceName);
>                  if (service != null) {
> -                    final String ip = HttpUtils.getIpAddress();
> -                    service.printWSDL(response.getOutputStream(), ip,
> servicePath);
> +                    service.printWSDL(response.getOutputStream(),
> uri.getHost(), servicePath);
>                      return;
>                  }
>              }
> -            if (uri.endsWith("?xsd")) {
> -                String serviceName = uri.substring(uri.lastIndexOf("/") +
> 1, uri.length() - 4);
> +            if (uri.getQuery().startsWith("xsd=")) {
> +                String serviceName = path.substring(path.lastIndexOf("/") +
> 1);
>                  HashMap services =
> configurationContext.getAxisConfiguration().getServices();
>                  final AxisService service = (AxisService)
> services.get(serviceName);
>                  if (service != null) {
> @@ -255,9 +255,9 @@
>                  }
>              }
>              //cater for named xsds - check for the xsd name
> -            if (uri.indexOf("?xsd=") > 0) {
> -                String serviceName = uri.substring(uri.lastIndexOf("/") +
> 1, uri.lastIndexOf("?xsd="));
> -                String schemaName = uri.substring(uri.lastIndexOf("=") +
> 1);
> +            if (uri.getQuery().startsWith("xsd")) {
> +                String serviceName = path.substring(path.lastIndexOf("/") +
> 1);
> +                String schemaName =
> uri.getQuery().substring(uri.getQuery().lastIndexOf("=") + 1);
>
>                  HashMap services =
> configurationContext.getAxisConfiguration().getServices();
>                  AxisService service = (AxisService)
> services.get(serviceName);
> @@ -287,9 +287,9 @@
>                      msgContext,
>                      response.getOutputStream(),
>                      soapAction,
> -                    uri,
> +                    path,
>                      configurationContext,
> -                    HTTPTransportReceiver.getGetRequestParameters(uri));
> +                    HTTPTransportReceiver.getGetRequestParameters(path));
>
>              if (!processed) {
>                  response.setStatusCode(200);
> @@ -303,7 +303,7 @@
>              // deal with POST request
>
>              msgContext.setProperty(MessageContext.TRANSPORT_OUT,
> response.getOutputStream());
> -            msgContext.setProperty(Constants.OUT_TRANSPORT_INFO,
> response.getOutputStream());
> +            msgContext.setProperty(Constants.OUT_TRANSPORT_INFO, new
> Axis2TransportInfo(response));
>
>              String contenttype =
> request.getHeader(HTTPConstants.HEADER_CONTENT_TYPE);
>              HTTPTransportUtils.processHTTPPostRequest(
> @@ -312,7 +312,7 @@
>                      response.getOutputStream(),
>                      contenttype,
>                      soapAction,
> -                    uri);
> +                    path);
>
>          } else {
>              throw new UnsupportedOperationException("[" +
> request.getMethod() + " ] method not supported");
>
>
>


-- 
Davanum Srinivas : http://www.wso2.net (Oxygen for Web Service Developers)

RE: svn commit: r496446 - /geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java

Posted by Lin Sun <li...@gmail.com>.
Thanks - will load it up and see if I can get it working.  Lin

-----Original Message-----
From: Davanum Srinivas [mailto:davanum@gmail.com] 
Sent: Tuesday, January 16, 2007 10:35 PM
To: Geronimo Dev
Subject: Re: svn commit: r496446 -
/geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geron
imo/axis2/Axis2WebServiceContainer.java

Hi,

See enclosed diff. Specifically the url :)

thanks,
dims

On 1/16/07, Lin Sun <li...@gmail.com> wrote:
> Hi Dims, just curious... how were you able to verify '?wsdl' working?  I
> haven't been able to get '?wsdl' working with the cxfpojows test case.
>
> Thanks, Lin
>
> -----Original Message-----
> From: dims@apache.org [mailto:dims@apache.org]
> Sent: Monday, January 15, 2007 2:08 PM
> To: scm@geronimo.apache.org
> Subject: svn commit: r496446 -
>
/geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geron
> imo/axis2/Axis2WebServiceContainer.java
>
> Author: dims
> Date: Mon Jan 15 11:07:43 2007
> New Revision: 496446
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=496446
> Log:
> get ?wsdl working. next step is to get the actual call working
>
> Modified:
>
>
geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geroni
> mo/axis2/Axis2WebServiceContainer.java
>
> Modified:
>
geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geroni
> mo/axis2/Axis2WebServiceContainer.java
> URL:
>
http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/sr
>
c/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java?view=dif
> f&rev=496446&r1=496445&r2=496446
>
============================================================================
> ==
> ---
>
geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geroni
> mo/axis2/Axis2WebServiceContainer.java (original)
> +++
>
geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geroni
> mo/axis2/Axis2WebServiceContainer.java Mon Jan 15 11:07:43 2007
> @@ -44,6 +44,7 @@
>  import javax.xml.namespace.QName;
>  import java.io.PrintWriter;
>  import java.net.SocketException;
> +import java.net.URI;
>  import java.util.HashMap;
>  import java.util.Map;
>
> @@ -58,7 +59,7 @@
>      private transient final ClassLoader classLoader;
>      private final String endpointClassName;
>      private final PortInfo portInfo;
> -    ConfigurationContext configurationContext =
> ConfigurationContextFactory.createEmptyConfigurationContext();
> +    private ConfigurationContext configurationContext;
>      private String contextRoot = null;
>
>      public Axis2WebServiceContainer(PortInfo portInfo, String
> endpointClassName, ClassLoader classLoader) {
> @@ -66,10 +67,13 @@
>          this.endpointClassName = endpointClassName;
>          this.portInfo = portInfo;
>          try {
> +            configurationContext =
> ConfigurationContextFactory.createDefaultConfigurationContext();
>              AxisService service =
> AxisService.createService(endpointClassName,
> configurationContext.getAxisConfiguration(), RPCMessageReceiver.class);
>
> configurationContext.getAxisConfiguration().addService(service);
>          } catch (AxisFault af) {
>              throw new RuntimeException(af);
> +        } catch (Exception e) {
> +            throw new RuntimeException(e);
>          }
>      }
>
> @@ -144,12 +148,9 @@
>                  } else {
>                      response.setStatusCode(500);
>                      String msg = ex.getMessage();
> -                    if (msg == null || msg.trim().length() == 0) {
> -                        msg = "Exception message unknown";
> -                    }
>                      response.setHeader(HTTPConstants.HEADER_CONTENT_TYPE,
> "text/plain");
>                      PrintWriter pw = new
> PrintWriter(response.getOutputStream());
> -                    pw.write(msg);
> +                    ex.printStackTrace(pw);
>                      pw.flush();
>                  }
>              }
> @@ -184,7 +185,8 @@
>          final String servicePath =
> configurationContext.getServiceContextPath();
>          final String contextPath = (servicePath.startsWith("/") ?
> servicePath : "/" + servicePath) + "/";
>
> -        String uri = request.getURI().toString();
> +        URI uri = request.getURI();
> +        String path = uri.getPath();
>          String soapAction =
> request.getHeader(HTTPConstants.HEADER_SOAP_ACTION);
>
>          // TODO: Port this section
> @@ -209,14 +211,14 @@
>  //        }
>
>          if (request.getMethod() == Request.GET) {
> -            if (!uri.startsWith(contextPath)) {
> +            if (!path.startsWith(contextPath)) {
>                  response.setStatusCode(301);
>                  response.setHeader("Location", contextPath);
>                  return;
>              }
> -            if (uri.indexOf("?") < 0) {
> -                if (!uri.endsWith(contextPath)) {
> -                    String serviceName = uri.replaceAll(contextPath, "");
> +            if (uri.toString().indexOf("?") < 0) {
> +                if (!path.endsWith(contextPath)) {
> +                    String serviceName = path.replaceAll(contextPath,
"");
>                      if (serviceName.indexOf("/") < 0) {
>                          String res =
> HTTPTransportReceiver.printServiceHTML(serviceName, configurationContext);
>                          PrintWriter pw = new
> PrintWriter(response.getOutputStream());
> @@ -225,28 +227,26 @@
>                      }
>                  }
>              }
> -            if (uri.endsWith("?wsdl2")) {
> -                String serviceName = uri.substring(uri.lastIndexOf("/") +
> 1, uri.length() - 6);
> +            if (uri.getQuery().startsWith("wsdl2")) {
> +                String serviceName = path.substring(path.lastIndexOf("/")
+
> 1, path.length() - 6);
>                  HashMap services =
> configurationContext.getAxisConfiguration().getServices();
>                  final AxisService service = (AxisService)
> services.get(serviceName);
>                  if (service != null) {
> -                    final String ip = HttpUtils.getIpAddress();
> -                    service.printWSDL2(response.getOutputStream(), ip,
> servicePath);
> +                    service.printWSDL2(response.getOutputStream(),
> uri.getHost(), servicePath);
>                      return;
>                  }
>              }
> -            if (uri.endsWith("?wsdl")) {
> -                String serviceName = uri.substring(uri.lastIndexOf("/") +
> 1, uri.length() - 5);
> +            if (uri.getQuery().startsWith("wsdl")) {
> +                String serviceName = path.substring(path.lastIndexOf("/")
+
> 1);
>                  HashMap services =
> configurationContext.getAxisConfiguration().getServices();
>                  final AxisService service = (AxisService)
> services.get(serviceName);
>                  if (service != null) {
> -                    final String ip = HttpUtils.getIpAddress();
> -                    service.printWSDL(response.getOutputStream(), ip,
> servicePath);
> +                    service.printWSDL(response.getOutputStream(),
> uri.getHost(), servicePath);
>                      return;
>                  }
>              }
> -            if (uri.endsWith("?xsd")) {
> -                String serviceName = uri.substring(uri.lastIndexOf("/") +
> 1, uri.length() - 4);
> +            if (uri.getQuery().startsWith("xsd=")) {
> +                String serviceName = path.substring(path.lastIndexOf("/")
+
> 1);
>                  HashMap services =
> configurationContext.getAxisConfiguration().getServices();
>                  final AxisService service = (AxisService)
> services.get(serviceName);
>                  if (service != null) {
> @@ -255,9 +255,9 @@
>                  }
>              }
>              //cater for named xsds - check for the xsd name
> -            if (uri.indexOf("?xsd=") > 0) {
> -                String serviceName = uri.substring(uri.lastIndexOf("/") +
> 1, uri.lastIndexOf("?xsd="));
> -                String schemaName = uri.substring(uri.lastIndexOf("=") +
> 1);
> +            if (uri.getQuery().startsWith("xsd")) {
> +                String serviceName = path.substring(path.lastIndexOf("/")
+
> 1);
> +                String schemaName =
> uri.getQuery().substring(uri.getQuery().lastIndexOf("=") + 1);
>
>                  HashMap services =
> configurationContext.getAxisConfiguration().getServices();
>                  AxisService service = (AxisService)
> services.get(serviceName);
> @@ -287,9 +287,9 @@
>                      msgContext,
>                      response.getOutputStream(),
>                      soapAction,
> -                    uri,
> +                    path,
>                      configurationContext,
> -                    HTTPTransportReceiver.getGetRequestParameters(uri));
> +                    HTTPTransportReceiver.getGetRequestParameters(path));
>
>              if (!processed) {
>                  response.setStatusCode(200);
> @@ -303,7 +303,7 @@
>              // deal with POST request
>
>              msgContext.setProperty(MessageContext.TRANSPORT_OUT,
> response.getOutputStream());
> -            msgContext.setProperty(Constants.OUT_TRANSPORT_INFO,
> response.getOutputStream());
> +            msgContext.setProperty(Constants.OUT_TRANSPORT_INFO, new
> Axis2TransportInfo(response));
>
>              String contenttype =
> request.getHeader(HTTPConstants.HEADER_CONTENT_TYPE);
>              HTTPTransportUtils.processHTTPPostRequest(
> @@ -312,7 +312,7 @@
>                      response.getOutputStream(),
>                      contenttype,
>                      soapAction,
> -                    uri);
> +                    path);
>
>          } else {
>              throw new UnsupportedOperationException("[" +
> request.getMethod() + " ] method not supported");
>
>
>


-- 
Davanum Srinivas : http://www.wso2.net (Oxygen for Web Service Developers)