Author: veithen
Date: Fri Mar 9 09:46:19 2012
New Revision: 1298772
URL: http://svn.apache.org/viewvc?rev=1298772&view=rev
Log:
Added an alternative client-side HTTP transport based on the
java.net.HttpURLConnection API. It supports keep-alive connections, but doesn't
impose additional constraints on application code (such as singleton service
locators).
Although it contains only a couple of classes, it is implemented as a separate
Maven module because
- it requires Java 1.5 (while the Axis core should still continue to support
Java 1.4);
- the current code can be used with earlier versions of Axis (it was tested
with Axis 1.3 and 1.4).
Added:
axis/axis1/java/trunk/axis-rt-transports-http-javanet/ (with props)
axis/axis1/java/trunk/axis-rt-transports-http-javanet/pom.xml
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/main/
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/main/java/
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/main/java/org/
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/main/java/org/apache/
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/main/java/org/apache/axis/
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/main/java/org/apache/axis/transport/
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/main/java/org/apache/axis/transport/http/
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/main/java/org/apache/axis/transport/http/javanet/
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/main/java/org/apache/axis/transport/http/javanet/JavaNetHTTPSender.java
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/main/java/org/apache/axis/transport/http/javanet/Messages.java
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/main/resources/
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/main/resources/org/
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/main/resources/org/apache/
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/main/resources/org/apache/axis/
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/main/resources/org/apache/axis/transport/
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/main/resources/org/apache/axis/transport/http/
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/main/resources/org/apache/axis/transport/http/javanet/
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/main/resources/org/apache/axis/transport/http/javanet/resource.properties
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/site/
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/site/apt/
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/java/
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/java/org/
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/java/org/apache/
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/java/org/apache/axis/
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/java/org/apache/axis/transport/
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/java/org/apache/axis/transport/http/
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/java/org/apache/axis/transport/http/javanet/
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/java/org/apache/axis/transport/http/javanet/DummySOAPImpl.java
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/java/org/apache/axis/transport/http/javanet/TestErrors.java
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/java/org/apache/axis/transport/http/javanet/TestSOAPService.java
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/resources/
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/resources/client-config.wsdd
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/wsdl/
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/wsdl/test.wsdl
Modified:
axis/axis1/java/trunk/pom.xml
axis/axis1/java/trunk/src/site/apt/changelogs/1_4_1.apt
axis/axis1/java/trunk/src/site/site.xml
Propchange: axis/axis1/java/trunk/axis-rt-transports-http-javanet/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Mar 9 09:46:19 2012
@@ -0,0 +1,4 @@
+.classpath
+.project
+target
+.settings
Added: axis/axis1/java/trunk/axis-rt-transports-http-javanet/pom.xml
URL:
http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-rt-transports-http-javanet/pom.xml?rev=1298772&view=auto
==============================================================================
--- axis/axis1/java/trunk/axis-rt-transports-http-javanet/pom.xml (added)
+++ axis/axis1/java/trunk/axis-rt-transports-http-javanet/pom.xml Fri Mar 9
09:46:19 2012
@@ -0,0 +1,182 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.axis</groupId>
+ <artifactId>axis-project</artifactId>
+ <version>1.4.1-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>axis-rt-transports-http-javanet</artifactId>
+ <name>java.net HTTP Transport</name>
+ <description>
+ An alternative HTTP transport that uses the java.net.HttpURLConnection
API. This transport only works with Java 1.5.
+ </description>
+ <properties>
+ <!-- Used by the site -->
+ <jarName>${project.artifactId}-${project.version}.jar</jarName>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axis</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axis-standalone-server</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>maven-wsdl2java-plugin</artifactId>
+ <version>${project.version}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>wsdl2java-test</goal>
+ </goals>
+ <configuration>
+ <file>src/test/wsdl/test.wsdl</file>
+
<output>${project.build.directory}/work</output>
+ <serverSide>true</serverSide>
+ <mappings>
+ <mapping>
+
<namespace>http://www.example.org/test/</namespace>
+
<package>org.apache.axis.transport.http.javanet</package>
+ </mapping>
+ </mappings>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-test</id>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>reserve-network-port</id>
+ <goals>
+ <goal>reserve-network-port</goal>
+ </goals>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <portNames>
+ <portName>testPort</portName>
+ </portNames>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>maven-axis-server-plugin</artifactId>
+ <version>${project.version}</version>
+ <executions>
+ <execution>
+ <id>start-server</id>
+ <goals>
+ <goal>start-server</goal>
+ </goals>
+ <configuration>
+ <port>${testPort}</port>
+ <wsdds>
+ <wsdd>
+
<directory>${project.build.directory}/work</directory>
+ <includes>
+ <include>**/deploy.wsdd</include>
+ </includes>
+ </wsdd>
+ </wsdds>
+ </configuration>
+ </execution>
+ <execution>
+ <id>stop-server</id>
+ <goals>
+ <goal>stop-all</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ <configuration>
+ <includes>
+ <include>**/Test*.java</include>
+ </includes>
+ <systemPropertyVariables>
+ <testPort>${testPort}</testPort>
+ </systemPropertyVariables>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <reporting>
+ <plugins>
+ <plugin>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <version>2.4</version>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>index</report>
+ <report>dependencies</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ </plugins>
+ </reporting>
+</project>
Added:
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/main/java/org/apache/axis/transport/http/javanet/JavaNetHTTPSender.java
URL:
http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/main/java/org/apache/axis/transport/http/javanet/JavaNetHTTPSender.java?rev=1298772&view=auto
==============================================================================
---
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/main/java/org/apache/axis/transport/http/javanet/JavaNetHTTPSender.java
(added)
+++
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/main/java/org/apache/axis/transport/http/javanet/JavaNetHTTPSender.java
Fri Mar 9 09:46:19 2012
@@ -0,0 +1,172 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis.transport.http.javanet;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPException;
+
+import org.apache.axis.AxisFault;
+import org.apache.axis.Constants;
+import org.apache.axis.Message;
+import org.apache.axis.MessageContext;
+import org.apache.axis.components.logger.LogFactory;
+import org.apache.axis.encoding.Base64;
+import org.apache.axis.handlers.BasicHandler;
+import org.apache.axis.soap.SOAPConstants;
+import org.apache.axis.transport.http.HTTPConstants;
+import org.apache.commons.logging.Log;
+
+/**
+ * Pivot handler for the HTTP transport based on the {@link HttpURLConnection}
API.
+ *
+ * @author Andreas Veithen
+ */
+public class JavaNetHTTPSender extends BasicHandler {
+ private static final long serialVersionUID = 1L;
+
+ private static final Log log =
LogFactory.getLog(JavaNetHTTPSender.class.getName());
+
+ /**
+ * The value of the <tt>User-Agent</tt> header. It is composed of the Axis
version, the version
+ * of JavaNetHTTPSender (which may be different, because it may work with
older Axis versions as
+ * well) and the Java version (which is important because we are using the
HTTP client of the
+ * JRE).
+ */
+ private static final String userAgent =
Messages.getMessage("axisUserAgent") + " "
+ + Messages.getMessage("userAgentToken") + " Java/" +
System.getProperty("java.version");
+
+ public void invoke(MessageContext msgContext) throws AxisFault {
+ try {
+ Message request = msgContext.getRequestMessage();
+ URL url = new URL(msgContext.getStrProp(MessageContext.TRANS_URL));
+
+ // Create and configure HttpURLConnection
+ HttpURLConnection connection =
(HttpURLConnection)url.openConnection();
+ connection.setDoInput(true);
+ connection.setDoOutput(true);
+ connection.setChunkedStreamingMode(0); // 0 means default chunk
size
+ int timeout = msgContext.getTimeout();
+ connection.setConnectTimeout(timeout);
+ connection.setReadTimeout(timeout);
+ connection.setUseCaches(false);
+ connection.addRequestProperty(HTTPConstants.HEADER_USER_AGENT,
userAgent);
+ connection.addRequestProperty(HTTPConstants.HEADER_ACCEPT,
+ HTTPConstants.HEADER_ACCEPT_APPL_SOAP + ", "
+ + HTTPConstants.HEADER_ACCEPT_APPLICATION_DIME +
", "
+ + HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED +
", "
+ + HTTPConstants.HEADER_ACCEPT_TEXT_ALL);
+
+ // Set "SOAPAction" header
+ String action = null;
+ if (msgContext.useSOAPAction()) {
+ action = msgContext.getSOAPActionURI();
+ }
+ if (action == null) {
+ action = "";
+ }
+ connection.addRequestProperty(HTTPConstants.HEADER_SOAP_ACTION,
action);
+
+ // Set "Authorization" header
+ String userID = msgContext.getUsername();
+ if (userID != null) {
+ String passwd = msgContext.getPassword();
+ byte[] token = (userID + ":" + (passwd == null ? "" :
passwd)).getBytes("UTF-8");
+
connection.addRequestProperty(HTTPConstants.HEADER_AUTHORIZATION, "Basic " +
Base64.encode(token));
+ }
+
+ // Set "Content-Type" header
+ connection.setRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE,
+ request.getContentType(msgContext.getSOAPConstants()));
+
+ // Send request
+ OutputStream out = connection.getOutputStream();
+ request.writeTo(out);
+ out.close();
+
+ // Process response
+ int statusCode = connection.getResponseCode();
+ String responseContentType =
connection.getHeaderField(HTTPConstants.HEADER_CONTENT_TYPE);
+ String rawResponseContentType;
+ if (responseContentType == null) {
+ rawResponseContentType = null;
+ } else {
+ int idx = responseContentType.indexOf(';');
+ rawResponseContentType = idx == -1 ? responseContentType :
responseContentType.substring(0, idx);
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("Status code: " + statusCode);
+ log.debug("Content type: " + responseContentType);
+ log.debug("Raw content type: " + rawResponseContentType);
+ }
+ InputStream in;
+ // TODO: need to recognize at least 202 here!
+ // TODO: if we enable chunkedStreamingMode, then redirection is
not handled transparently
+ if (statusCode == 200) {
+ in = connection.getInputStream();
+ } else if (statusCode == 500 && rawResponseContentType != null
+ &&
(rawResponseContentType.equalsIgnoreCase(SOAPConstants.SOAP11_CONSTANTS.getContentType())
+ ||
rawResponseContentType.equalsIgnoreCase(SOAPConstants.SOAP12_CONSTANTS.getContentType())))
{
+ in = connection.getErrorStream();
+ } else {
+ // TODO: extract charset encoding from document type (reuse
the code in org.apache.axisMessage?)
+ Reader reader = new
InputStreamReader(connection.getErrorStream(), "UTF-8");
+ StringBuffer content = new StringBuffer();
+ char[] buffer = new char[4096];
+ int c;
+ while ((c = reader.read(buffer)) != -1) {
+ content.append(buffer, 0, c);
+ }
+ reader.close();
+ AxisFault fault = new AxisFault("HTTP", statusCode + " " +
connection.getResponseMessage(), null, null);
+ fault.setFaultDetailString(content.toString());
+
fault.addFaultDetail(Constants.QNAME_FAULTDETAIL_HTTPERRORCODE,
Integer.toString(statusCode));
+ throw fault;
+ }
+
+ Message response = new Message(in, false, responseContentType,
+
connection.getHeaderField(HTTPConstants.HEADER_CONTENT_LOCATION));
+ MimeHeaders mimeHeaders = response.getMimeHeaders();
+ String key;
+ for (int i=0; (key = connection.getHeaderField(i)) != null; i++) {
+ mimeHeaders.addHeader(key, connection.getHeaderField(i));
+ }
+ response.setMessageType(Message.RESPONSE);
+ msgContext.setResponseMessage(response);
+
+ // Note: the JRE seems to automatically release/recycle the
connection when the response stream has
+ // been consumed; therefore we don't need to do anything to
explicitly close the connection
+
+ } catch (IOException ex) {
+ if (log.isDebugEnabled()) {
+ log.debug("Failed to send to " +
msgContext.getStrProp(MessageContext.TRANS_URL), ex);
+ }
+ throw AxisFault.makeFault(ex);
+ } catch (SOAPException ex) {
+ throw AxisFault.makeFault(ex);
+ }
+ }
+}
Added:
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/main/java/org/apache/axis/transport/http/javanet/Messages.java
URL:
http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/main/java/org/apache/axis/transport/http/javanet/Messages.java?rev=1298772&view=auto
==============================================================================
---
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/main/java/org/apache/axis/transport/http/javanet/Messages.java
(added)
+++
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/main/java/org/apache/axis/transport/http/javanet/Messages.java
Fri Mar 9 09:46:19 2012
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis.transport.http.javanet;
+
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.apache.axis.i18n.MessageBundle;
+import org.apache.axis.i18n.MessagesConstants;
+
+/**
+ * Message resources for the
<code>org.apache.axis.transport.http.javanet</code> package.
+ *
+ * @see org.apache.axis.i18n.Messages
+ */
+public class Messages {
+ private static final Class thisClass = Messages.class;
+
+ private static final String projectName = MessagesConstants.projectName;
+
+ private static final String resourceName = MessagesConstants.resourceName;
+ private static final Locale locale = MessagesConstants.locale;
+
+ private static final String packageName = getPackage(thisClass.getName());
+ private static final ClassLoader classLoader = thisClass.getClassLoader();
+
+ private static final ResourceBundle parent =
+ (MessagesConstants.rootPackageName == packageName)
+ ? null
+ : MessagesConstants.rootBundle;
+
+
+ /***** NO NEED TO CHANGE ANYTHING BELOW *****/
+
+ private static final MessageBundle messageBundle =
+ new MessageBundle(projectName, packageName, resourceName,
+ locale, classLoader, parent);
+
+ /**
+ * Get a message from resource.properties from the package of the given
object.
+ * @param key The resource key
+ * @return The formatted message
+ */
+ public static String getMessage(String key)
+ throws MissingResourceException
+ {
+ return messageBundle.getMessage(key);
+ }
+
+ /**
+ * Get a message from resource.properties from the package of the given
object.
+ * @param key The resource key
+ * @param arg0 The argument to place in variable {0}
+ * @return The formatted message
+ */
+ public static String getMessage(String key, String arg0)
+ throws MissingResourceException
+ {
+ return messageBundle.getMessage(key, arg0);
+ }
+
+ /**
+ * Get a message from resource.properties from the package of the given
object.
+ * @param key The resource key
+ * @param arg0 The argument to place in variable {0}
+ * @param arg1 The argument to place in variable {1}
+ * @return The formatted message
+ */
+ public static String getMessage(String key, String arg0, String arg1)
+ throws MissingResourceException
+ {
+ return messageBundle.getMessage(key, arg0, arg1);
+ }
+
+ /**
+ * Get a message from resource.properties from the package of the given
object.
+ * @param key The resource key
+ * @param arg0 The argument to place in variable {0}
+ * @param arg1 The argument to place in variable {1}
+ * @param arg2 The argument to place in variable {2}
+ * @return The formatted message
+ */
+ public static String getMessage(String key, String arg0, String arg1,
String arg2)
+ throws MissingResourceException
+ {
+ return messageBundle.getMessage(key, arg0, arg1, arg2);
+ }
+
+ /**
+ * Get a message from resource.properties from the package of the given
object.
+ * @param key The resource key
+ * @param arg0 The argument to place in variable {0}
+ * @param arg1 The argument to place in variable {1}
+ * @param arg2 The argument to place in variable {2}
+ * @param arg3 The argument to place in variable {3}
+ * @return The formatted message
+ */
+ public static String getMessage(String key, String arg0, String arg1,
String arg2, String arg3)
+ throws MissingResourceException
+ {
+ return messageBundle.getMessage(key, arg0, arg1, arg2, arg3);
+ }
+
+ /**
+ * Get a message from resource.properties from the package of the given
object.
+ * @param key The resource key
+ * @param arg0 The argument to place in variable {0}
+ * @param arg1 The argument to place in variable {1}
+ * @param arg2 The argument to place in variable {2}
+ * @param arg3 The argument to place in variable {3}
+ * @param arg4 The argument to place in variable {4}
+ * @return The formatted message
+ */
+ public static String getMessage(String key, String arg0, String arg1,
String arg2, String arg3, String arg4)
+ throws MissingResourceException
+ {
+ return messageBundle.getMessage(key, arg0, arg1, arg2, arg3, arg4);
+ }
+
+ /**
+ * Get a message from resource.properties from the package of the given
object.
+ * @param key The resource key
+ * @param args An array of objects to place in corresponding variables
+ * @return The formatted message
+ */
+ public static String getMessage(String key, String[] args)
+ throws MissingResourceException
+ {
+ return messageBundle.getMessage(key, args);
+ }
+
+ public static ResourceBundle getResourceBundle() {
+ return messageBundle.getResourceBundle();
+ }
+
+ public static MessageBundle getMessageBundle() {
+ return messageBundle;
+ }
+
+ private static final String getPackage(String name) {
+ return name.substring(0, name.lastIndexOf('.')).intern();
+ }
+}
Added:
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/main/resources/org/apache/axis/transport/http/javanet/resource.properties
URL:
http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/main/resources/org/apache/axis/transport/http/javanet/resource.properties?rev=1298772&view=auto
==============================================================================
---
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/main/resources/org/apache/axis/transport/http/javanet/resource.properties
(added)
+++
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/main/resources/org/apache/axis/transport/http/javanet/resource.properties
Fri Mar 9 09:46:19 2012
@@ -0,0 +1,17 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+userAgentToken=JavaNetHTTPSender/${project.version}
Added:
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/java/org/apache/axis/transport/http/javanet/DummySOAPImpl.java
URL:
http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/java/org/apache/axis/transport/http/javanet/DummySOAPImpl.java?rev=1298772&view=auto
==============================================================================
---
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/java/org/apache/axis/transport/http/javanet/DummySOAPImpl.java
(added)
+++
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/java/org/apache/axis/transport/http/javanet/DummySOAPImpl.java
Fri Mar 9 09:46:19 2012
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis.transport.http.javanet;
+
+import java.rmi.RemoteException;
+
+public class DummySOAPImpl implements Dummy {
+ public String echo(String in) throws RemoteException {
+ return in;
+ }
+
+ public void faultTest() throws RemoteException, Fault {
+ throw new Fault();
+ }
+}
Added:
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/java/org/apache/axis/transport/http/javanet/TestErrors.java
URL:
http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/java/org/apache/axis/transport/http/javanet/TestErrors.java?rev=1298772&view=auto
==============================================================================
---
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/java/org/apache/axis/transport/http/javanet/TestErrors.java
(added)
+++
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/java/org/apache/axis/transport/http/javanet/TestErrors.java
Fri Mar 9 09:46:19 2012
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis.transport.http.javanet;
+
+import junit.framework.TestCase;
+
+import org.apache.axis.AxisFault;
+import org.apache.axis.Constants;
+import org.apache.axis.client.Call;
+import org.w3c.dom.Element;
+
+public class TestErrors extends TestCase {
+ public void test404() throws Exception {
+ Call call = new Call("http://localhost:" +
System.getProperty("testPort", "8080") + "/doesnt-exist");
+ call.setOperationName("test");
+ try {
+ call.invoke(new Object[0]);
+ fail("Expected AxisFault");
+ } catch (AxisFault fault) {
+ Element[] details = fault.getFaultDetails();
+ assertEquals(2, details.length);
+ Element detail = details[1];
+
assertEquals(Constants.QNAME_FAULTDETAIL_HTTPERRORCODE.getNamespaceURI(),
detail.getNamespaceURI());
+
assertEquals(Constants.QNAME_FAULTDETAIL_HTTPERRORCODE.getLocalPart(),
detail.getLocalName());
+ assertEquals("404", detail.getFirstChild().getNodeValue());
+ }
+ }
+}
Added:
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/java/org/apache/axis/transport/http/javanet/TestSOAPService.java
URL:
http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/java/org/apache/axis/transport/http/javanet/TestSOAPService.java?rev=1298772&view=auto
==============================================================================
---
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/java/org/apache/axis/transport/http/javanet/TestSOAPService.java
(added)
+++
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/java/org/apache/axis/transport/http/javanet/TestSOAPService.java
Fri Mar 9 09:46:19 2012
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis.transport.http.javanet;
+
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+public class TestSOAPService extends TestCase {
+ private Dummy dummy;
+
+ protected void setUp() throws Exception {
+ dummy = new DummyServiceLocator().getDummy(new URL(
+ "http://localhost:" + System.getProperty("testPort", "8080") +
"/axis/services/Dummy"));
+ }
+
+ public void testTwoWay() throws Exception {
+ assertEquals("Hi there!", dummy.echo("Hi there!"));
+ }
+
+ public void testFault() throws Exception {
+ try {
+ dummy.faultTest();
+ fail("Expected SOAP fault");
+ } catch (Fault fault) {
+ // OK
+ }
+ }
+}
Added:
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/resources/client-config.wsdd
URL:
http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/resources/client-config.wsdd?rev=1298772&view=auto
==============================================================================
---
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/resources/client-config.wsdd
(added)
+++
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/resources/client-config.wsdd
Fri Mar 9 09:46:19 2012
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<!-- START SNIPPET: deployment -->
+<deployment name="testClientConfig"
+ xmlns="http://xml.apache.org/axis/wsdd/"
+ xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
+ <globalConfiguration>
+ <parameter name="disablePrettyXML" value="true"/>
+ <parameter name="enableNamespacePrefixOptimization" value="false"/>
+ </globalConfiguration>
+ <transport name="http"
pivot="java:org.apache.axis.transport.http.javanet.JavaNetHTTPSender"/>
+</deployment>
+<!-- END SNIPPET: deployment -->
Added:
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/wsdl/test.wsdl
URL:
http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/wsdl/test.wsdl?rev=1298772&view=auto
==============================================================================
---
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/wsdl/test.wsdl
(added)
+++
axis/axis1/java/trunk/axis-rt-transports-http-javanet/src/test/wsdl/test.wsdl
Fri Mar 9 09:46:19 2012
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.example.org/test/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="test"
targetNamespace="http://www.example.org/test/">
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.example.org/test/">
+ <xsd:element name="echo">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="in" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="echoResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="out" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="faultTest">
+ <xsd:complexType>
+ <xsd:sequence/>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="faultTestResponse">
+ <xsd:complexType>
+ <xsd:sequence/>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="fault">
+ <xsd:complexType>
+ <xsd:sequence/>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="echoRequest">
+ <wsdl:part element="tns:echo" name="parameters"/>
+ </wsdl:message>
+ <wsdl:message name="echoResponse">
+ <wsdl:part element="tns:echoResponse" name="parameters"/>
+ </wsdl:message>
+ <wsdl:message name="faultTestRequest">
+ <wsdl:part element="tns:faultTest" name="parameters"/>
+ </wsdl:message>
+ <wsdl:message name="faultTestResponse">
+ <wsdl:part element="tns:faultTestResponse" name="parameters"/>
+ </wsdl:message>
+ <!-- TODO: calling the message "fault" generates uncompilable code! -->
+ <wsdl:message name="faultMsg">
+ <wsdl:part element="tns:fault" name="parameters"/>
+ </wsdl:message>
+ <wsdl:portType name="Dummy">
+ <wsdl:operation name="echo">
+ <wsdl:input message="tns:echoRequest"/>
+ <wsdl:output message="tns:echoResponse"/>
+ </wsdl:operation>
+ <wsdl:operation name="faultTest">
+ <wsdl:input message="tns:faultTestRequest"/>
+ <wsdl:output message="tns:faultTestResponse"/>
+ <wsdl:fault name="fault" message="tns:faultMsg"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="DummySOAP" type="tns:Dummy">
+ <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="echo">
+ <soap:operation soapAction="http://www.example.org/test/echo"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="faultTest">
+ <soap:operation soapAction="http://www.example.org/test/faultTest"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="fault">
+ <soap:fault name="fault" use="literal"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="DummyService">
+ <wsdl:port binding="tns:DummySOAP" name="Dummy">
+ <soap:address location="http://localhost:8080/test"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
Modified: axis/axis1/java/trunk/pom.xml
URL:
http://svn.apache.org/viewvc/axis/axis1/java/trunk/pom.xml?rev=1298772&r1=1298771&r2=1298772&view=diff
==============================================================================
--- axis/axis1/java/trunk/pom.xml (original)
+++ axis/axis1/java/trunk/pom.xml Fri Mar 9 09:46:19 2012
@@ -64,6 +64,7 @@
<module>maven</module>
<module>axis-standalone-server</module>
<module>axis-castor</module>
+ <module>axis-rt-transports-http-javanet</module>
<module>axis-jms</module>
<module>integration</module>
<module>axis-war</module>
Modified: axis/axis1/java/trunk/src/site/apt/changelogs/1_4_1.apt
URL:
http://svn.apache.org/viewvc/axis/axis1/java/trunk/src/site/apt/changelogs/1_4_1.apt?rev=1298772&r1=1298771&r2=1298772&view=diff
==============================================================================
--- axis/axis1/java/trunk/src/site/apt/changelogs/1_4_1.apt (original)
+++ axis/axis1/java/trunk/src/site/apt/changelogs/1_4_1.apt Fri Mar 9 09:46:19
2012
@@ -29,3 +29,13 @@ Changes from 1.4 final
* A new stand-alone server has been added. It uses an embedded Jetty
server and superseded the old
SimpleAxisServer. The Maven plugin has goals to start/stop stand-alone
server instances so that the new
stand-alone server can be easily integrated into integration tests
executed using Maven.
+
+ * A new HTTP transport has been added. It can be used as an alternative to
the default <<<HTTPSender>>>
+ or the Commons HttpClient based transport (<<<CommonsHTTPSender>>>). It
uses the
+ <<<java.net.HttpURLConnection>>> API which supports HTTP 1.1 keep-alive
connections. In contrast to
+ <<<CommonsHTTPSender>>>, it doesn't impose any additional requirements
on the application code
+ (see the
{{{http://wiki.apache.org/ws/FrontPage/Axis/AxisCommonsHTTP}AxisCommonsHTTP
how-to}}) and can therefore be used
+ as a drop-in replacement for <<<HTTPSender>>>. However, it requires Java
1.5
+ because it relies on features of the <<<java.net.HttpURLConnection>>>
API that were not available in
+ earlier Java versions.
+
Modified: axis/axis1/java/trunk/src/site/site.xml
URL:
http://svn.apache.org/viewvc/axis/axis1/java/trunk/src/site/site.xml?rev=1298772&r1=1298771&r2=1298772&view=diff
==============================================================================
--- axis/axis1/java/trunk/src/site/site.xml (original)
+++ axis/axis1/java/trunk/src/site/site.xml Fri Mar 9 09:46:19 2012
@@ -62,7 +62,8 @@
<item name="Ant tasks" href="axis-ant/index.html"/>
<item name="Maven plugin" href="axis-maven-plugin/index.html"/>
<item name="Castor support" href="axis-castor/index.html"/>
- <item name="JMS support" href="axis-jms/index.html"/>
+ <item name="JMS transport" href="axis-jms/index.html"/>
+ <item name="java.net HTTP transport"
href="axis-rt-transports-http-javanet/index.html"/>
</menu>
<menu ref="reports" inherit="bottom"/>
<menu name="Apache" inherit="bottom">