axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r558602 - in /webservices/axis2/branches/java/1_3/modules: kernel/src/org/apache/axis2/description/ kernel/src/org/apache/axis2/transport/http/ kernel/src/org/apache/axis2/transport/nhttp/ kernel/src/org/apache/axis2/util/ saaj/src/org/apac...
Date Mon, 23 Jul 2007 05:18:15 GMT
Author: dims
Date: Sun Jul 22 22:18:14 2007
New Revision: 558602

URL: http://svn.apache.org/viewvc?view=rev&rev=558602
Log:
Checking in the following changes from trunk.

558220	gawor	2007-07-21 01:21:46 +0000
respect character encoding, chain exceptions, and handle null prefix

558240	dims	2007-07-21 04:37:02 +0000
Handle the case when we start axis servlet with both http and https on in tomcat's conf/server.xml
(say 5050 for http and 5443 for https) and the user types in the url for dynamic wsdl - https://localhost:5443/axis2/services/Version?wsdl
in the browser. W/O this patch we were returning just one wsdl:port and that too pointing
to http://localhost:8080/

558256	dims	2007-07-21 06:28:53 +0000
- Use the host http header for simple axis server if it is present
- Drop the extra slash for https (was generating http://localhost:8443//axis2/services/Version,
now will generate http://localhost:8443/axis2/services/Version)

558262	dims	2007-07-21 07:00:46 +0000
- Get WSDL2.0 generator to honot the host http header

558374	ruchithf	2007-07-21 19:40:31 +0000
These samples are now in Apache Rampart 


Removed:
    webservices/axis2/branches/java/1_3/modules/samples/security/
Modified:
    webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/description/AxisService.java
    webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java
    webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java
    webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java
    webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java
    webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/transport/nhttp/ServerWorker.java
    webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java
    webservices/axis2/branches/java/1_3/modules/saaj/src/org/apache/axis2/saaj/SOAPBodyImpl.java
    webservices/axis2/branches/java/1_3/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java

Modified: webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/description/AxisService.java?view=diff&rev=558602&r1=558601&r2=558602
==============================================================================
--- webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/description/AxisService.java
(original)
+++ webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/description/AxisService.java
Sun Jul 22 22:18:14 2007
@@ -1146,10 +1146,22 @@
         }
     }
 
-    //WSDL 2.0
+    /**
+     * Print the WSDL2.0 with a default URL. This will be called only during codegen time.
+     *
+     * @param out
+     * @throws AxisFault
+     */
     public void printWSDL2(OutputStream out) throws AxisFault {
+        printWSDL2(out, null);
+    }
+
+    public void printWSDL2(OutputStream out, String requestIP) throws AxisFault {
         AxisService2WSDL20 axisService2WSDL2 = new AxisService2WSDL20(this);
         try {
+            if(requestIP != null) {
+                axisService2WSDL2.setEPRs(calculateEPRs(requestIP));
+            }
             OMElement wsdlElement = axisService2WSDL2.generateOM();
             wsdlElement.serialize(out);
             out.flush();

Modified: webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java?view=diff&rev=558602&r1=558601&r2=558602
==============================================================================
--- webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java
(original)
+++ webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java
Sun Jul 22 22:18:14 2007
@@ -48,6 +48,7 @@
 public class AxisService2WSDL20 implements WSDL2Constants {
 
     private AxisService axisService;
+    private String[] eprs = null;
 
     public AxisService2WSDL20(AxisService service) {
         this.axisService = service;
@@ -268,7 +269,7 @@
             }
             descriptionElement
                     .addChild(WSDLSerializationUtil.generateServiceElement(omFactory, wsdl,
tns,
-                                                                           axisService, disableREST));
+                                                                           axisService, disableREST,
eprs));
         }
 
         return descriptionElement;
@@ -428,5 +429,9 @@
             }
         }
         return axisOperationElement;
+    }
+
+    public void setEPRs(String[] eprs) {
+        this.eprs = eprs;
     }
 }

Modified: webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java?view=diff&rev=558602&r1=558601&r2=558602
==============================================================================
--- webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java
(original)
+++ webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java
Sun Jul 22 22:18:14 2007
@@ -221,6 +221,7 @@
                 query.indexOf("wsdl") >= 0 || query.indexOf("xsd") >= 0 ||
                 query.indexOf("policy") >= 0)) {
             // handling meta data exchange stuff
+            agent.initTransportListener(request);
             agent.processListService(request, response);
         } else if (requestURI.endsWith(".xsd") ||
                 requestURI.endsWith(".wsdl")) {

Modified: webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java?view=diff&rev=558602&r1=558601&r2=558602
==============================================================================
--- webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java
(original)
+++ webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java
Sun Jul 22 22:18:14 2007
@@ -131,7 +131,7 @@
                 if (service != null) {
                     response.setStatus(HttpStatus.SC_OK);
                     response.setContentType("text/xml");
-                    service.printWSDL2(response.getOutputStream());
+                    service.printWSDL2(response.getOutputStream(), getHost(request));
                     return;
                 }
             }
@@ -142,7 +142,7 @@
                 if (service != null) {
                     response.setStatus(HttpStatus.SC_OK);
                     response.setContentType("text/xml");
-                    service.printWSDL(response.getOutputStream());
+                    service.printWSDL(response.getOutputStream(), getHost(request));
                     return;
                 }
             }
@@ -329,17 +329,16 @@
 
     }
 
-    public String getHostAddress(AxisHttpRequest request) throws java.net.SocketException
{
-        try {
-            Header hostHeader = request.getFirstHeader("host");
-            if (hostHeader != null) {
-                String host = hostHeader.getValue();
-                return new URI("http://" + host).getHost();
+    public String getHost(AxisHttpRequest request) throws java.net.SocketException {
+        String host = null;
+        Header hostHeader = request.getFirstHeader("host");
+        if (hostHeader != null) {
+            String parts[] = hostHeader.getValue().split("[:]");
+            if (parts.length > 0) {
+                host = parts[0].trim();
             }
-        } catch (Exception e) {
-
         }
-        return HttpUtils.getIpAddress();
+        return host;
     }
 
 }

Modified: webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java?view=diff&rev=558602&r1=558601&r2=558602
==============================================================================
--- webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java
(original)
+++ webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java
Sun Jul 22 22:18:14 2007
@@ -37,6 +37,8 @@
 import org.apache.neethi.Policy;
 import org.apache.neethi.PolicyRegistry;
 import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
@@ -53,6 +55,8 @@
 
 public class ListingAgent extends AbstractAgent {
 
+    private static final Log log = LogFactory.getLog(ListingAgent.class);
+
     private static final String LIST_MULTIPLE_SERVICE_JSP_NAME =
             "listServices.jsp";
     private static final String LIST_SINGLE_SERVICE_JSP_NAME =
@@ -84,6 +88,23 @@
     public void handle(HttpServletRequest httpServletRequest,
                        HttpServletResponse httpServletResponse)
             throws IOException, ServletException {
+
+        initTransportListener(httpServletRequest);
+
+        String query = httpServletRequest.getQueryString();
+        if (query != null) {
+            if (query.indexOf("wsdl2") > 0 || query.indexOf("wsdl") > 0 ||
+                query.indexOf("xsd") > 0 || query.indexOf("policy") > 0) {
+                processListService(httpServletRequest, httpServletResponse);
+            } else {
+                super.handle(httpServletRequest, httpServletResponse);
+            }
+        } else {
+            super.handle(httpServletRequest, httpServletResponse);
+        }
+    }
+
+    protected void initTransportListener(HttpServletRequest httpServletRequest) {
         // httpServletRequest.getLocalPort() , giving me a build error so I had to use the
followin
         String filePart = httpServletRequest.getRequestURL().toString();
         int ipindex = filePart.indexOf("//");
@@ -97,19 +118,8 @@
             try {
                 addTransportListner(httpServletRequest.getScheme(), Integer.parseInt(portstr));
             } catch (NumberFormatException e) {
-                //
-            }
-        }
-        String query = httpServletRequest.getQueryString();
-        if (query != null) {
-            if (query.indexOf("?wsdl2") > 0 || query.indexOf("?wsdl") > 0 ||
-                query.indexOf("?xsd") > 0) {
-                processListService(httpServletRequest, httpServletResponse);
-            } else {
-                super.handle(httpServletRequest, httpServletResponse);
+                log.debug(e.toString(), e);
             }
-        } else {
-            super.handle(httpServletRequest, httpServletResponse);
         }
     }
 
@@ -211,6 +221,7 @@
                 if (wsdl2 >= 0) {
                     OutputStream out = res.getOutputStream();
                     res.setContentType("text/xml");
+                    String ip = extractHostAndPort(filePart, isHttp);
                     String wsdlName = req.getParameter("wsdl2");
                     if (!"".equals(wsdlName)) {
                         InputStream in = ((AxisService) serviceObj).getClassLoader()
@@ -224,7 +235,7 @@
                         }
                     } else {
                         ((AxisService) serviceObj)
-                                .printWSDL2(out);
+                                .printWSDL2(out, ip);
                         out.flush();
                         out.close();
                     }
@@ -477,9 +488,11 @@
 
         public EndpointReference[] getEPRsForService(String serviceName, String ip)
                 throws AxisFault {
-            return new EndpointReference[]{new EndpointReference(schema + "://" + ip + ":"
+ port +
-                                                                 "/" + axisConf.getServiceContextPath()
+ "/" +
-                                                                 serviceName)};  //To change
body of implemented methods use File | Settings | File Templates.
+            String path = axisConf.getServiceContextPath() + "/" + serviceName;
+            if(path.charAt(0)!='/'){
+                path = '/' + path;
+            }
+            return new EndpointReference[]{new EndpointReference(schema + "://" + ip + ":"
+ port + path )};
         }
 
         public EndpointReference getEPRForService(String serviceName, String ip) throws AxisFault
{

Modified: webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/transport/nhttp/ServerWorker.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/transport/nhttp/ServerWorker.java?view=diff&rev=558602&r1=558601&r2=558602
==============================================================================
--- webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/transport/nhttp/ServerWorker.java
(original)
+++ webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/transport/nhttp/ServerWorker.java
Sun Jul 22 22:18:14 2007
@@ -296,9 +296,11 @@
                 try {
                     response.addHeader(CONTENT_TYPE, TEXT_XML);
                     serverHandler.commitResponse(conn, response);
-                    service.printWSDL2(os);
-
+                    service.printWSDL2(os, getIpAddress());
                 } catch (AxisFault e) {
+                    handleException("Axis2 fault writing ?wsdl2 output", e);
+                    return;
+                } catch (SocketException e) {
                     handleException("Axis2 fault writing ?wsdl2 output", e);
                     return;
                 }

Modified: webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java?view=diff&rev=558602&r1=558601&r2=558602
==============================================================================
--- webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java
(original)
+++ webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java
Sun Jul 22 22:18:14 2007
@@ -282,9 +282,28 @@
                                                    OMNamespace tns, AxisService axisService,
                                                    boolean disableREST)
             throws AxisFault {
-        String[] eprs = axisService.getEPRs();
-        if (eprs == null) {
-            eprs = new String[]{axisService.getName()};
+        return generateServiceElement(omFactory, wsdl, tns, axisService, disableREST, null);
+    }
+    
+    /**
+     * Generates a default service element
+     * @param omFactory - The OMFactory
+     * @param wsdl the WSDL namespace
+     * @param tns - The targetnamespace
+     * @param axisService - The AxisService
+     * @param disableREST only generate REST endpoint if this is false
+     * @return - The generated service element
+     * @throws AxisFault - Thrown in case an exception occurs
+     */
+    public static OMElement generateServiceElement(OMFactory omFactory, OMNamespace wsdl,
+                                                   OMNamespace tns, AxisService axisService,
+                                                   boolean disableREST, String[] eprs)
+            throws AxisFault {
+        if(eprs == null){
+            eprs = axisService.getEPRs();
+            if (eprs == null) {
+                eprs = new String[]{axisService.getName()};
+            }
         }
         OMElement serviceElement;
         serviceElement = omFactory.createOMElement(WSDL2Constants.SERVICE_LOCAL_NAME, wsdl);

Modified: webservices/axis2/branches/java/1_3/modules/saaj/src/org/apache/axis2/saaj/SOAPBodyImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_3/modules/saaj/src/org/apache/axis2/saaj/SOAPBodyImpl.java?view=diff&rev=558602&r1=558601&r2=558602
==============================================================================
--- webservices/axis2/branches/java/1_3/modules/saaj/src/org/apache/axis2/saaj/SOAPBodyImpl.java
(original)
+++ webservices/axis2/branches/java/1_3/modules/saaj/src/org/apache/axis2/saaj/SOAPBodyImpl.java
Sun Jul 22 22:18:14 2007
@@ -148,6 +148,10 @@
         if (uri == null || "".equals(uri)) {
             childEle = new SOAPBodyElementImpl(
                     (ElementImpl)getOwnerDocument().createElement(localName));
+        } else if (prefix == null || "".equals(prefix)) {
+            childEle = new SOAPBodyElementImpl(
+                (ElementImpl)getOwnerDocument().createElementNS(uri,
+                                                                localName));
         } else {
             childEle = new SOAPBodyElementImpl(
                     (ElementImpl)getOwnerDocument().createElementNS(uri,

Modified: webservices/axis2/branches/java/1_3/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_3/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java?view=diff&rev=558602&r1=558601&r2=558602
==============================================================================
--- webservices/axis2/branches/java/1_3/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java
(original)
+++ webservices/axis2/branches/java/1_3/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java
Sun Jul 22 22:18:14 2007
@@ -115,6 +115,10 @@
         } catch (AxisFault e) {
             throw new SOAPException(e);
         }
+
+        options.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, 
+                            request.getProperty(SOAPMessage.CHARACTER_SET_ENCODING));
+
         opClient.setOptions(options);
 
         if (request.countAttachments() != 0) { // SOAPMessage with attachments
@@ -185,8 +189,8 @@
             MessageContext msgCtx =
                     opClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
             return getSOAPMessage(msgCtx.getEnvelope());
-        } catch (AxisFault e) {
-            throw new SOAPException(e.getMessage());
+        } catch (Exception e) {
+            throw new SOAPException(e.getMessage(), e);
         }
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message