You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by th...@apache.org on 2007/03/25 20:41:36 UTC
svn commit: r522322 [1/3] - in /webservices/axis2/trunk/java/modules:
fastinfoset/ fastinfoset/src/ fastinfoset/src/org/
fastinfoset/src/org/apache/ fastinfoset/src/org/apache/axis2/
fastinfoset/src/org/apache/axis2/fastinfoset/ fastinfoset/test-resour...
Author: thilina
Date: Sun Mar 25 11:41:35 2007
New Revision: 522322
URL: http://svn.apache.org/viewvc?view=rev&rev=522322
Log:
Applying the patch given at https://issues.apache.org/jira/browse/AXIS2-2372
Thanx Sanjaya for helping us to get in a much awaited feature...
Added:
webservices/axis2/trunk/java/modules/fastinfoset/
webservices/axis2/trunk/java/modules/fastinfoset/maven.xml
webservices/axis2/trunk/java/modules/fastinfoset/pom.xml
webservices/axis2/trunk/java/modules/fastinfoset/project.properties
webservices/axis2/trunk/java/modules/fastinfoset/project.xml
webservices/axis2/trunk/java/modules/fastinfoset/src/
webservices/axis2/trunk/java/modules/fastinfoset/src/org/
webservices/axis2/trunk/java/modules/fastinfoset/src/org/apache/
webservices/axis2/trunk/java/modules/fastinfoset/src/org/apache/axis2/
webservices/axis2/trunk/java/modules/fastinfoset/src/org/apache/axis2/fastinfoset/
webservices/axis2/trunk/java/modules/fastinfoset/src/org/apache/axis2/fastinfoset/FastInfosetBuilder.java
webservices/axis2/trunk/java/modules/fastinfoset/src/org/apache/axis2/fastinfoset/FastInfosetMessageFormatter.java
webservices/axis2/trunk/java/modules/fastinfoset/test/
webservices/axis2/trunk/java/modules/fastinfoset/test-resources/
webservices/axis2/trunk/java/modules/fastinfoset/test-resources/axis2.xml
webservices/axis2/trunk/java/modules/fastinfoset/test/org/
webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/
webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/
webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/
webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/FastInfosetTest.java
webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/SimpleAddService.java
webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/SimpleAddServiceClient.java
webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/xsd/
webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/xsd/SimpleAddServiceCallbackHandler.java
webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/xsd/SimpleAddServiceStub.java
Modified:
webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/SchemaGenerator.java
Added: webservices/axis2/trunk/java/modules/fastinfoset/maven.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/fastinfoset/maven.xml?view=auto&rev=522322
==============================================================================
--- webservices/axis2/trunk/java/modules/fastinfoset/maven.xml (added)
+++ webservices/axis2/trunk/java/modules/fastinfoset/maven.xml Sun Mar 25 11:41:35 2007
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project default="jar"
+ xmlns:j="jelly:core"
+ xmlns:u="jelly:util"
+ xmlns:maven="jelly:maven"
+ xmlns:deploy="deploy"
+ xmlns:ant="jelly:ant">
+ <preGoal name="test:compile">
+ <!-- copy the required mars so that they are available on the test path -->
+ <copy file="../addressing/target/addressing-${addressing_version}.mar"
+ tofile="target/test-classes/modules/addressing-${addressing_version}.mar"/>
+ </preGoal>
+</project>
Added: webservices/axis2/trunk/java/modules/fastinfoset/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/fastinfoset/pom.xml?view=auto&rev=522322
==============================================================================
--- webservices/axis2/trunk/java/modules/fastinfoset/pom.xml (added)
+++ webservices/axis2/trunk/java/modules/fastinfoset/pom.xml Sun Mar 25 11:41:35 2007
@@ -0,0 +1,192 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ !
+ ! Copyright 2006 The Apache Software Foundation.
+ !
+ ! Licensed 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.axis2</groupId>
+ <artifactId>axis2-parent</artifactId>
+ <version>SNAPSHOT</version>
+ <relativePath>../parent/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>axis2-fastinfoset</artifactId>
+ <name>Apache Axis 2.0 - Fast Infoset</name>
+ <description>Axis2 Fast Infoset module</description>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/webservices/axis2/trunk/java/modules/fastinfoset</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/webservices/axis2/trunk/java/modules/fastinfoset</developerConnection>
+ <url>http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/fastinfoset</url>
+ </scm>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.xml.fastinfoset</groupId>
+ <artifactId>FastInfoset</artifactId>
+ <version>${fastinfoset.version}</version>
+ <type>jar</type>
+ <properties>
+ <module>true</module>
+ </properties>
+ <url>https://maven-repository.dev.java.net/nonav/repository/</url>
+ </dependency>
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>${stax.api.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ <url>http://dist.codehaus.org/stax/jars/</url>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>${axiom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>${axiom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-kernel</artifactId>
+ <version>${pom.currentVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-adb</artifactId>
+ <version>${pom.currentVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>wsdl4j</groupId>
+ <artifactId>wsdl4j</artifactId>
+ <version>${wsdl4j.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>javax.activation</groupId>
+ <artifactId>activation</artifactId>
+ <version>${activation.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>${commons.logging.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>${stax.impl.groupid}</groupId>
+ <artifactId>${stax.impl.artifactid}</artifactId>
+ <version>${stax.impl.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ <url>http://dist.codehaus.org/stax/jars/</url>
+ </dependency>
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>${commons.httpclient.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ <version>${commons.fileupload.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.schema</groupId>
+ <artifactId>XmlSchema</artifactId>
+ <version>${XmlSchema.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-java2wsdl</artifactId>
+ <version>${pom.currentVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>annogen</groupId>
+ <artifactId>annogen</artifactId>
+ <version>${annogen.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ <url>http://dist.codehaus.org/annogen/jars/</url>
+ </dependency>
+ <dependency>
+ <groupId>httpcomponents-httpcore</groupId>
+ <artifactId>jakarta-httpcore</artifactId>
+ <version>${jakarta.httpcore.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>backport-util-concurrent</groupId>
+ <artifactId>backport-util-concurrent</artifactId>
+ <version>${backport_util_concurrent.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>${commons.codec.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <sourceDirectory>src</sourceDirectory>
+ <testSourceDirectory>test</testSourceDirectory>
+ <testResources>
+ <testResource>
+ <directory>test-resources</directory>
+ </testResource>
+ </testResources>
+
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: webservices/axis2/trunk/java/modules/fastinfoset/project.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/fastinfoset/project.properties?view=auto&rev=522322
==============================================================================
--- webservices/axis2/trunk/java/modules/fastinfoset/project.properties (added)
+++ webservices/axis2/trunk/java/modules/fastinfoset/project.properties Sun Mar 25 11:41:35 2007
@@ -0,0 +1,17 @@
+# -------------------------------------------------------------------
+# Copyright 2001-2004 The Apache Software Foundation.
+#
+# Licensed 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.
+# -------------------------------------------------------------------
+
+maven.multiproject.type=jar
Added: webservices/axis2/trunk/java/modules/fastinfoset/project.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/fastinfoset/project.xml?view=auto&rev=522322
==============================================================================
--- webservices/axis2/trunk/java/modules/fastinfoset/project.xml (added)
+++ webservices/axis2/trunk/java/modules/fastinfoset/project.xml Sun Mar 25 11:41:35 2007
@@ -0,0 +1,177 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed 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>
+ <pomVersion>3</pomVersion>
+ <extend>../../etc/project.xml</extend>
+
+ <id>axis2-fastinfoset</id>
+ <name>Apache Axis 2.0 - Fast Infoset</name>
+ <groupId>org.apache.axis2</groupId>
+ <description>Axis2 Fast Infoset module</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.xml.fastinfoset</groupId>
+ <artifactId>FastInfoset</artifactId>
+ <version>${fastinfoset.version}</version>
+ <type>jar</type>
+ <properties>
+ <module>true</module>
+ </properties>
+ <url>https://maven-repository.dev.java.net/nonav/repository/</url>
+ </dependency>
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>${stax.api.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ <url>http://dist.codehaus.org/stax/jars/</url>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>${axiom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>${axiom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-kernel</artifactId>
+ <version>${pom.currentVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-adb</artifactId>
+ <version>${pom.currentVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>wsdl4j</groupId>
+ <artifactId>wsdl4j</artifactId>
+ <version>${wsdl4j.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>javax.activation</groupId>
+ <artifactId>activation</artifactId>
+ <version>${activation.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>${commons.logging.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>${stax.impl.groupid}</groupId>
+ <artifactId>${stax.impl.artifactid}</artifactId>
+ <version>${stax.impl.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ <url>http://dist.codehaus.org/stax/jars/</url>
+ </dependency>
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>${commons.httpclient.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ <version>${commons.fileupload.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.schema</groupId>
+ <artifactId>XmlSchema</artifactId>
+ <version>${XmlSchema.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-java2wsdl</artifactId>
+ <version>${pom.currentVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>annogen</groupId>
+ <artifactId>annogen</artifactId>
+ <version>${annogen.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ <url>http://dist.codehaus.org/annogen/jars/</url>
+ </dependency>
+ <dependency>
+ <groupId>httpcomponents-httpcore</groupId>
+ <artifactId>jakarta-httpcore</artifactId>
+ <version>${jakarta.httpcore.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>backport-util-concurrent</groupId>
+ <artifactId>backport-util-concurrent</artifactId>
+ <version>${backport_util_concurrent.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>${commons.codec.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ </dependencies>
+
+ <reports/>
+ <!-- add the build properties-->
+ <build>
+ <resources>
+ <resource>
+ <directory>src</directory>
+ <includes>
+ <include>**/*.properties</include>
+ <include>**/*.xml</include>
+ <include>**/*.xsl</include>
+ <include>**/*.xsd</include>
+ </includes>
+ </resource>
+ </resources>
+ </build>
+</project>
Added: webservices/axis2/trunk/java/modules/fastinfoset/src/org/apache/axis2/fastinfoset/FastInfosetBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/fastinfoset/src/org/apache/axis2/fastinfoset/FastInfosetBuilder.java?view=auto&rev=522322
==============================================================================
--- webservices/axis2/trunk/java/modules/fastinfoset/src/org/apache/axis2/fastinfoset/FastInfosetBuilder.java (added)
+++ webservices/axis2/trunk/java/modules/fastinfoset/src/org/apache/axis2/fastinfoset/FastInfosetBuilder.java Sun Mar 25 11:41:35 2007
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.axis2.fastinfoset;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXBuilder;
+import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.builder.Builder;
+import org.apache.axis2.context.MessageContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import com.sun.xml.fastinfoset.stax.StAXDocumentParser;
+
+/**
+ *
+ *
+ */
+public class FastInfosetBuilder implements Builder {
+
+ private Log logger = LogFactory.getLog(FastInfosetBuilder.class);
+
+ /**
+ * Returns a OMElement handler to the document element of the Fast Infoset message.
+ *
+ * @param inputStream InputStream to the message
+ * @param contentType Content type of the message
+ * @param messageContext MessageContext to be used
+ *
+ * @return OMElement handler to the document element
+ *
+ * @see org.apache.axis2.builder.Builder#processDocument(InputStream, String, MessageContext)
+ */
+ public OMElement processDocument(InputStream inputStream, String contentType,
+ MessageContext messageContext) throws AxisFault {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Processing a Document with the content type: " + contentType);
+ }
+ XMLStreamReader streamReader = new StAXDocumentParser(inputStream);
+ //OMXMLParserWrapper builder = new StAXOMBuilder(streamReader);
+ StAXBuilder builder = new StAXSOAPModelBuilder(streamReader);
+ //TODO Check whether we need to perform any validations here...
+ return builder.getDocumentElement();
+ }
+}
Added: webservices/axis2/trunk/java/modules/fastinfoset/src/org/apache/axis2/fastinfoset/FastInfosetMessageFormatter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/fastinfoset/src/org/apache/axis2/fastinfoset/FastInfosetMessageFormatter.java?view=auto&rev=522322
==============================================================================
--- webservices/axis2/trunk/java/modules/fastinfoset/src/org/apache/axis2/fastinfoset/FastInfosetMessageFormatter.java (added)
+++ webservices/axis2/trunk/java/modules/fastinfoset/src/org/apache/axis2/fastinfoset/FastInfosetMessageFormatter.java Sun Mar 25 11:41:35 2007
@@ -0,0 +1,188 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.axis2.fastinfoset;
+
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Iterator;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMOutputFormat;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.transport.MessageFormatter;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import com.sun.xml.fastinfoset.stax.StAXDocumentSerializer;
+
+public class FastInfosetMessageFormatter implements MessageFormatter {
+
+ private Log logger = LogFactory.getLog(FastInfosetMessageFormatter.class);
+
+ /**
+ * Plain Fast Infoset message formatter doesn't need to handle SOAP. Hence do nothing.
+ *
+ * @see org.apache.axis2.transport.MessageFormatter#formatSOAPAction(org.apache.axis2.context.MessageContext, org.apache.axiom.om.OMOutputFormat, java.lang.String)
+ */
+ public String formatSOAPAction(MessageContext messageContext,
+ OMOutputFormat format, String soapAction) {
+
+ return null;
+ }
+
+ /**
+ * Retrieves the raw bytes from the SOAP envelop.
+ *
+ * @see org.apache.axis2.transport.MessageFormatter#getBytes(org.apache.axis2.context.MessageContext, org.apache.axiom.om.OMOutputFormat)
+ */
+ public byte[] getBytes(MessageContext messageContext, OMOutputFormat format)
+ throws AxisFault {
+// OMElement element = messageContext.getEnvelope().getBody().getFirstElement();
+ OMElement element = messageContext.getEnvelope();
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+
+ try {
+ //Creates StAX document serializer which actually implements the XMLStreamWriter
+ XMLStreamWriter streamWriter = new StAXDocumentSerializer(outStream);
+// streamWriter.writeStartDocument();
+ element.serializeAndConsume(streamWriter);
+ //TODO Looks like the SOAP envelop doesn't have a end document tag. Find out why?
+ streamWriter.writeEndDocument();
+
+ return outStream.toByteArray();
+
+ } catch (XMLStreamException xmlse) {
+ logger.error(xmlse.getMessage());
+ throw new AxisFault(xmlse.getMessage(), xmlse);
+ }
+ }
+
+ /**
+ * Returns the content type
+ *
+ * @see org.apache.axis2.transport.MessageFormatter#getContentType(org.apache.axis2.context.MessageContext, org.apache.axiom.om.OMOutputFormat, java.lang.String)
+ */
+ public String getContentType(MessageContext messageContext,
+ OMOutputFormat format, String soapAction) {
+ String contentType = (String) messageContext.getProperty(Constants.Configuration.CONTENT_TYPE);
+ String encoding = format.getCharSetEncoding();
+
+ //FIXME Is this a right thing to do? Need to clarify with a vetarant
+ if (contentType == null) {
+ contentType = (String) messageContext.getProperty(Constants.Configuration.MESSAGE_TYPE);
+ }
+
+ if (encoding != null) {
+ contentType += "; charset=" + encoding;
+ }
+
+ return contentType;
+ }
+
+ /**
+ * Returns the target address to send the response
+ * FIXME This is very HTTP specific. What about other transport?
+ *
+ * @see org.apache.axis2.transport.MessageFormatter#getTargetAddress(org.apache.axis2.context.MessageContext, org.apache.axiom.om.OMOutputFormat, java.net.URL)
+ */
+ public URL getTargetAddress(MessageContext messageContext,
+ OMOutputFormat format, URL targetURL) throws AxisFault {
+ String httpMethod =
+ (String) messageContext.getProperty(Constants.Configuration.HTTP_METHOD);
+
+ URL targetAddress = targetURL; //Let's initialize to this
+ //if the http method is GET, parameters are attached to the target URL
+ if ((httpMethod != null)
+ && Constants.Configuration.HTTP_METHOD_GET.equalsIgnoreCase(httpMethod)) {
+ String param = getParam(messageContext);
+
+ if (param.length() > 0) {
+ String returnURLFile = targetURL.getFile() + "?" + param;
+ try {
+ targetAddress =
+ new URL(targetURL.getProtocol(), targetURL.getHost(), targetURL.getPort(), returnURLFile);
+ } catch (MalformedURLException murle) {
+ logger.error(murle.getMessage());
+ throw new AxisFault(murle.getMessage(), murle);
+ }
+ }
+ }
+
+ return targetAddress;
+ }
+
+ /**
+ * Write the SOAP envelop to the given OutputStream.
+ *
+ * @see org.apache.axis2.transport.MessageFormatter#writeTo(org.apache.axis2.context.MessageContext, org.apache.axiom.om.OMOutputFormat, java.io.OutputStream, boolean)
+ */
+ public void writeTo(MessageContext messageContext, OMOutputFormat format,
+ OutputStream outputStream, boolean preserve) throws AxisFault {
+
+ //OMElement element = messageContext.getEnvelope().getBody().getFirstElement();
+ OMElement element = messageContext.getEnvelope();
+
+ try {
+ //Create the StAX document serializer
+ XMLStreamWriter streamWriter = new StAXDocumentSerializer(outputStream);
+// streamWriter.writeStartDocument();
+ if (preserve) {
+ element.serialize(streamWriter);
+ } else {
+ element.serializeAndConsume(streamWriter);
+ }
+// TODO Looks like the SOAP envelop doesn't have a end document tag. Find out why?
+ streamWriter.writeEndDocument();
+ } catch (XMLStreamException xmlse) {
+ logger.error(xmlse.getMessage());
+ throw new AxisFault(xmlse.getMessage(), xmlse);
+ }
+ }
+
+ /**
+ * Construct URL parameters like, "param1=value1¶m2=value2"
+ * FIXME This is very HTTP specific. What about other transports
+ *
+ * @param messageContext
+ * @return Formatted URL parameters
+ */
+ private String getParam(MessageContext messageContext) {
+
+ OMElement dataOut = messageContext.getEnvelope().getBody().getFirstElement();
+ Iterator it = dataOut.getChildElements();
+ StringBuffer paramBuffer = new StringBuffer();
+
+ while (it.hasNext()) {
+ OMElement element = (OMElement) it.next();
+ String parameter = element.getLocalName() + "=" + element.getText();
+ paramBuffer.append(parameter);
+ paramBuffer.append("&");
+ }
+ //We don't need a '&' at the end
+ paramBuffer.deleteCharAt(paramBuffer.length() - 1);
+
+ return paramBuffer.toString();
+ }
+
+}
Added: webservices/axis2/trunk/java/modules/fastinfoset/test-resources/axis2.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/fastinfoset/test-resources/axis2.xml?view=auto&rev=522322
==============================================================================
--- webservices/axis2/trunk/java/modules/fastinfoset/test-resources/axis2.xml (added)
+++ webservices/axis2/trunk/java/modules/fastinfoset/test-resources/axis2.xml Sun Mar 25 11:41:35 2007
@@ -0,0 +1,369 @@
+<!--
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+ -->
+
+<axisconfig name="AxisJava2.0">
+ <!-- ================================================= -->
+ <!-- Parameters -->
+ <!-- ================================================= -->
+ <parameter name="hotdeployment">true</parameter>
+ <parameter name="hotupdate">false</parameter>
+ <parameter name="enableMTOM">false</parameter>
+ <parameter name="enableSwA">false</parameter>
+
+ <!--Uncomment if you want to enable file caching for attachments -->
+ <!--parameter name="cacheAttachments">true</parameter>
+ <parameter name="attachmentDIR"></parameter>
+ <parameter name="sizeThreshold">4000</parameter-->
+
+ <!--This will give out the timout of the configuration contexts, in milliseconds-->
+ <parameter name="ConfigContextTimeoutInterval">30000</parameter>
+
+ <!--During a fault, stacktrace can be sent with the fault message. The following flag will control -->
+ <!--that behaviour.-->
+ <parameter name="sendStacktraceDetailsWithFaults">false</parameter>
+
+ <!--If there aren't any information available to find out the fault reason, we set the message of the expcetion-->
+ <!--as the faultreason/Reason. But when a fault is thrown from a service or some where, it will be -->
+ <!--wrapped by different levels. Due to this the initial exception message can be lost. If this flag-->
+ <!--is set then, Axis2 tries to get the first exception and set its message as the faultreason/Reason.-->
+ <parameter name="DrillDownToRootCauseForFaultReason">false</parameter>
+
+ <parameter name="userName">admin</parameter>
+ <parameter name="password">axis2</parameter>
+
+ <!--To override repository/services you need to uncomment following parameter and value SHOULD be absolute file path.-->
+ <!--<parameter name="ServicesDirectory">service</parameter>-->
+ <!--To override repository/modules you need to uncomment following parameter and value SHOULD be absolute file path-->
+ <!--<parameter name="ModulesDirectory">modules</parameter>-->
+
+
+
+ <!--Following params will set the proper context paths for invocations. All the endpoints will have a commons context-->
+ <!--root which can configured using the following contextRoot parameter-->
+ <!--<parameter name="contextRoot">axis2</parameter>-->
+
+ <!--Our HTTP endpoints can handle both REST and SOAP. Following parameters can be used to distingiush those endpoints-->
+ <!--In case of a servlet, if you change this you have to manually change the settings of your servlet container to map this -->
+ <!--context path to proper Axis2 servlets-->
+ <!--<parameter name="servicePath">services</parameter>-->
+ <!--<parameter name="restPath">rest</parameter>-->
+
+ <!-- Following parameter will completely disable REST handling in Axis2-->
+ <parameter name="disableREST" locked="true">false</parameter>
+
+ <!-- If you have a frontend host which exposes this webservice using a different public URL -->
+ <!-- use this parameter to override autodetected url -->
+ <!--<parameter name="httpFrontendHostUrl">https://someotherhost/context</parameter>-->
+
+
+ <!-- The way of adding listener to the system-->
+ <!-- <listener class="org.apache.axis2.ObserverIMPL">-->
+ <!-- <parameter name="RSS_URL">http://127.0.0.1/rss</parameter>-->
+ <!-- </listener>-->
+
+ <!-- ================================================= -->
+ <!-- Message Receivers -->
+ <!-- ================================================= -->
+ <!--This is the Deafult Message Receiver for the system , if you want to have MessageReceivers for -->
+ <!--all the other MEP implement it and add the correct entry to here , so that you can refer from-->
+ <!--any operation -->
+ <!--Note : You can ovride this for particular service by adding the same element with your requirement-->
+ <messageReceivers>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
+ class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
+ class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+ <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-only"
+ class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
+ <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-out"
+ class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+ </messageReceivers>
+
+ <!-- ================================================= -->
+ <!-- Message Formatter -->
+ <!-- ================================================= -->
+ <!--Following content type to message formatter mapping can be used to implement support for different message -->
+ <!--format serialization in Axis2. These message formats are expected to be resolved based on the content type. -->
+ <messageFormatters>
+ <messageFormatter contentType="application/x-www-form-urlencoded"
+ class="org.apache.axis2.transport.http.XFormURLEncodedFormatter"/>
+ <messageFormatter contentType="multipart/form-data"
+ class="org.apache.axis2.transport.http.MultipartFormDataFormatter"/>
+ <messageFormatter contentType="application/xml"
+ class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
+ <messageFormatter contentType="application/soap+fastinfoset"
+ class="org.apache.axis2.fastinfoset.FastInfosetMessageFormatter"/>
+ </messageFormatters>
+
+ <!-- ================================================= -->
+ <!-- Message Builders -->
+ <!-- ================================================= -->
+ <!--Following content type to builder mapping can be used to implement support for different message -->
+ <!--formats in Axis2. These message formats are expected to be resolved based on the content type. -->
+ <messageBuilders>
+ <messageBuilder contentType="application/xml"
+ class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
+ <messageBuilder contentType="application/x-www-form-urlencoded"
+ class="org.apache.axis2.builder.XFormURLEncodedBuilder"/>
+ <messageBuilder contentType="multipart/form-data"
+ class="org.apache.axis2.builder.MultipartFormDataBuilder"/>
+ <messageBuilder contentType="application/soap+fastinfoset"
+ class="org.apache.axis2.fastinfoset.FastInfosetBuilder"/>
+ </messageBuilders>
+
+ <!-- ================================================= -->
+ <!-- Transport Ins -->
+ <!-- ================================================= -->
+ <transportReceiver name="http"
+ class="org.apache.axis2.transport.http.SimpleHTTPServer">
+ <parameter name="port">8080</parameter>
+ <!-- Here is the complete list of supported parameters (see example settings further below):
+ port: the port to listen on (default 6060)
+ hostname: if non-null, url prefix used in reply-to endpoint references (default null)
+ originServer: value of http Server header in outgoing messages (default "Simple-Server/1.1")
+ requestTimeout: value in millis of time that requests can wait for data (default 20000)
+ requestTcpNoDelay: true to maximize performance and minimize latency (default true)
+ false to minimize bandwidth consumption by combining segments
+ requestCoreThreadPoolSize: number of threads available for request processing (unless queue fills up) (default 25)
+ requestMaxThreadPoolSize: number of threads available for request processing if queue fills us (default 150)
+ note that default queue never fills up: see HttpFactory
+ threadKeepAliveTime: time to keep threads in excess of core size alive while inactive (default 180)
+ note that no such threads can exist with default unbounded request queue
+ threadKeepAliveTimeUnit: TimeUnit of value in threadKeepAliveTime (default SECONDS) (default SECONDS)
+ -->
+ <!-- <parameter name="hostname">http://www.myApp.com/ws</parameter> -->
+ <!-- <parameter name="originServer">My-Server/1.1</parameter> -->
+ <!-- <parameter name="requestTimeout">10000</parameter> -->
+ <!-- <parameter name="requestTcpNoDelay">false</parameter> -->
+ <!-- <parameter name="requestCoreThreadPoolSize">50</parameter> -->
+ <!-- <parameter name="RequestMaxThreadPoolSize">100</parameter> -->
+ <!-- <parameter name="threadKeepAliveTime">240000</parameter> -->
+ <!-- <parameter name="threadKeepAliveTimeUnit">MILLISECONDS</parameter> -->
+ </transportReceiver>
+
+ <!--Uncomment this and configure as appropriate for JMS transport support, after setting up your JMS environment (e.g. ActiveMQ)
+ <transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
+ <parameter name="myTopicConnectionFactory">
+ <parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
+ <parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
+ <parameter name="transport.jms.ConnectionFactoryJNDIName">TopicConnectionFactory</parameter>
+ </parameter>
+
+ <parameter name="myQueueConnectionFactory">
+ <parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
+ <parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
+ <parameter name="transport.jms.ConnectionFactoryJNDIName">QueueConnectionFactory</parameter>
+ </parameter>
+
+ <parameter name="default">
+ <parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
+ <parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
+ <parameter name="transport.jms.ConnectionFactoryJNDIName">QueueConnectionFactory</parameter>
+ </parameter>
+ </transportReceiver>-->
+
+ <!--Uncomment if you want to have SMTP transport support-->
+ <!--<transportReceiver name="mail" class="org.apache.axis2.transport.mail.SimpleMailListener">-->
+ <!--<parameter name="transport.mail.pop3.host">127.0.0.1</parameter>-->
+ <!--<parameter name="transport.mail.pop3.user">axis2</parameter>-->
+ <!--<parameter name="transport.mail.pop3.password">axis2</parameter>-->
+ <!--<parameter name="transport.mail.pop3.port">110</parameter>-->
+ <!--<parameter name="transport.mail.replyToAddress">axis2@127.0.0.1</parameter>-->
+ <!--</transportReceiver>-->
+
+ <!--Uncomment if you want to have TCP transport support-->
+ <!--transportReceiver name="tcp"
+ class="org.apache.axis2.transport.tcp.TCPServer">
+ <parameter name="port">6060</parameter-->>
+ <!--If you want to give your own host address for EPR generation-->
+ <!--uncommet following paramter , and set as you required.-->
+ <!--<parameter name="hostname">tcp://myApp.com/ws</parameter>-->
+ <!-- /transportReceiver -->
+
+ <!-- ================================================= -->
+ <!-- Transport Outs -->
+ <!-- ================================================= -->
+
+ <transportSender name="tcp"
+ class="org.apache.axis2.transport.tcp.TCPTransportSender"/>
+ <transportSender name="local"
+ class="org.apache.axis2.transport.local.LocalTransportSender"/>
+ <transportSender name="http"
+ class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+ <parameter name="PROTOCOL">HTTP/1.1</parameter>
+ <parameter name="Transfer-Encoding">chunked</parameter>
+
+ <!-- If following is set to 'true', optional action part of the Content-Type will not be added to the SOAP 1.2 messages -->
+ <!-- <parameter name="OmitSOAP12Action">true</parameter> -->
+ </transportSender>
+
+ <transportSender name="https"
+ class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+ <parameter name="PROTOCOL">HTTP/1.1</parameter>
+ <parameter name="Transfer-Encoding">chunked</parameter>
+ </transportSender>
+ <!--Uncomment this and configure as appropriate for JMS transport support, after setting up your JMS environment (e.g. ActiveMQ)
+ <transportSender name="jms"
+ class="org.apache.axis2.transport.jms.JMSSender"/>
+ -->
+
+ <!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver
+ <transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender">
+ <parameter name="transport.mail.smtp.host">127.0.0.1</parameter>
+ <parameter name="transport.mail.smtp.user">axis2</parameter>
+ <parameter name="transport.mail.smtp.password">axis2</parameter>
+ <parameter name="transport.mail.smtp.port">25</parameter>
+ </transportSender>
+ -->
+
+ <!-- ================================================= -->
+ <!-- Global Modules -->
+ <!-- ================================================= -->
+ <!-- Comment this to disable Addressing -->
+ <module ref="addressing"/>
+
+ <!--Configuring module , providing parameters for modules whether they refer or not-->
+ <!--<moduleConfig name="addressing">-->
+ <!--<parameter name="addressingPara">N/A</parameter>-->
+ <!--</moduleConfig>-->
+
+ <!-- ================================================= -->
+ <!-- Clustering -->
+ <!-- ================================================= -->
+ <!-- Configure and uncomment following for preparing Axis2 to a clustered environment -->
+ <!--
+ <cluster class="org.apache.axis2.cluster.tribes.TribesClusterManager">
+ <parameter name="param1">value1</parameter>
+ <configurationManager class="org.apache.axis2.cluster.tribes.configuration.TribesConfigurationManager">
+ <listeners>
+ </listeners>
+ </configurationManager>
+ <contextManager class="org.apache.axis2.cluster.tribes.context.TribesContextManager">
+ <listeners>
+ </listeners>
+ </contextManager>
+ </cluster>
+ -->
+
+ <!-- ================================================= -->
+ <!-- Phases -->
+ <!-- ================================================= -->
+ <phaseOrder type="InFlow">
+ <!-- System pre defined phases -->
+ <phase name="Transport">
+ <handler name="RequestURIBasedDispatcher"
+ class="org.apache.axis2.engine.RequestURIBasedDispatcher">
+ <order phase="Transport"/>
+ </handler>
+ <handler name="SOAPActionBasedDispatcher"
+ class="org.apache.axis2.engine.SOAPActionBasedDispatcher">
+ <order phase="Transport"/>
+ </handler>
+ </phase>
+ <phase name="Security"/>
+ <phase name="PreDispatch"/>
+ <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+ <handler name="AddressingBasedDispatcher"
+ class="org.apache.axis2.engine.AddressingBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+ <handler name="RequestURIOperationDispatcher"
+ class="org.apache.axis2.engine.RequestURIOperationDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+
+ <handler name="SOAPMessageBodyBasedDispatcher"
+ class="org.apache.axis2.engine.SOAPMessageBodyBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+
+ <handler name="HTTPLocationBasedDispatcher"
+ class="org.apache.axis2.engine.HTTPLocationBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+
+ <handler name="InstanceDispatcher"
+ class="org.apache.axis2.engine.InstanceDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+ </phase>
+ <!-- System pre defined phases -->
+ <!-- After Postdispatch phase module author or or service author can add any phase he want -->
+ <phase name="OperationInPhase"/>
+ <phase name="soapmonitorPhase"/>
+ </phaseOrder>
+ <phaseOrder type="OutFlow">
+ <!-- user can add his own phases to this area -->
+ <phase name="soapmonitorPhase"/>
+ <phase name="OperationOutPhase"/>
+ <!--system predefined phase-->
+ <!--these phase will run irrespective of the service-->
+ <phase name="PolicyDetermination"/>
+ <phase name="MessageOut"/>
+ <phase name="Security"/>
+ </phaseOrder>
+ <phaseOrder type="InFaultFlow">
+ <phase name="PreDispatch"/>
+ <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+ <handler name="RequestURIBasedDispatcher"
+ class="org.apache.axis2.engine.RequestURIBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+
+ <handler name="SOAPActionBasedDispatcher"
+ class="org.apache.axis2.engine.SOAPActionBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+
+ <handler name="AddressingBasedDispatcher"
+ class="org.apache.axis2.engine.AddressingBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+ <handler name="RequestURIOperationDispatcher"
+ class="org.apache.axis2.engine.RequestURIOperationDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+
+ <handler name="SOAPMessageBodyBasedDispatcher"
+ class="org.apache.axis2.engine.SOAPMessageBodyBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+
+ <handler name="HTTPLocationBasedDispatcher"
+ class="org.apache.axis2.engine.HTTPLocationBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+
+ <handler name="InstanceDispatcher"
+ class="org.apache.axis2.engine.InstanceDispatcher">
+ <order phase="PostDispatch"/>
+ </handler>
+ </phase>
+ <!-- user can add his own phases to this area -->
+ <phase name="OperationInFaultPhase"/>
+ <phase name="soapmonitorPhase"/>
+ </phaseOrder>
+ <phaseOrder type="OutFaultFlow">
+ <!-- user can add his own phases to this area -->
+ <phase name="soapmonitorPhase"/>
+ <phase name="OperationOutFaultPhase"/>
+ <phase name="PolicyDetermination"/>
+ <phase name="MessageOut"/>
+ </phaseOrder>
+</axisconfig>
+
Added: webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/FastInfosetTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/FastInfosetTest.java?view=auto&rev=522322
==============================================================================
--- webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/FastInfosetTest.java (added)
+++ webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/FastInfosetTest.java Sun Mar 25 11:41:35 2007
@@ -0,0 +1,111 @@
+package org.apache.axis2.fastinfoset;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.SocketException;
+import java.rmi.RemoteException;
+
+import junit.framework.TestCase;
+
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.rpc.receivers.RPCMessageReceiver;
+import org.apache.axis2.transport.http.SimpleHTTPServer;
+
+public class FastInfosetTest extends TestCase {
+
+ private SimpleHTTPServer server;
+ private static int serverCount = 0;
+
+ private AxisService service;
+
+ private EndpointReference target;
+ private ConfigurationContext configurationContext;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ System.out.println("Setting up the Simple HTTP Server");
+
+ if (serverCount == 0) {
+ int port = findAvailablePort();
+// port = 8080; //Uncomment to test with tcpmon
+ target = new EndpointReference("http://127.0.0.1:" + (port)
+ + "/axis2/services/SimpleAddService");
+
+ File configFile = new File(System.getProperty("basedir",".") + "/test-resources/axis2.xml");
+ configurationContext = ConfigurationContextFactory
+ .createConfigurationContextFromFileSystem("target/test-classes", configFile
+ .getAbsolutePath());
+
+ server = new SimpleHTTPServer(configurationContext, port);
+
+ server.start();
+ }
+
+ serverCount++;
+
+ service = AxisService.createService("org.apache.axis2.fastinfoset.SimpleAddService",
+ server.getConfigurationContext().getAxisConfiguration(), RPCMessageReceiver.class);
+
+ server.getConfigurationContext().getAxisConfiguration().addService(
+ service);
+
+ System.out.println("Simple HTTP Server is started");
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ if(serverCount == 1) {
+ server.stop();
+ System.out.println("Stopped the Simple HTTP Server");
+ }
+ }
+
+ public void testAdd() throws RemoteException {
+ SimpleAddServiceClient client = new SimpleAddServiceClient(target); //Comment to test with tcpmon.
+// SimpleAddServiceClient client = new SimpleAddServiceClient(); //Uncomment to test with tcpmon.
+
+ String result = client.addStrings("Hello ", "World!");
+ System.out.println("Output: " + result);
+ TestCase.assertEquals("Hello World!", result);
+
+ int result1 = client.addInts(17, 33);
+ System.out.println("Output: " + result1);
+ TestCase.assertEquals(50, result1);
+
+ float result2 = client.addFloats(17.64f, 32.36f);
+ System.out.println("Output: " + result2);
+ TestCase.assertEquals(50.0f, result2, 0.0005f);
+ }
+
+ private int findAvailablePort() throws SocketException, IOException {
+ //Create a server socket on any free socket to find a free socket.
+ ServerSocket ss = new ServerSocket(0);
+ int port = ss.getLocalPort();
+ ss.close();
+
+ return port;
+ }
+
+ /**
+ * Run this class as a Java application, will host this SimpleAddService for further testing.
+ * There is a main method in SimpleAddServiceClient which can be used with this.
+ *
+ * Note: Useful when debugging.
+ *
+ * @param args - Not required.
+ */
+ public static void main(String args[]) {
+ FastInfosetTest test = new FastInfosetTest();
+ try {
+ test.setUp();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+}
Added: webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/SimpleAddService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/SimpleAddService.java?view=auto&rev=522322
==============================================================================
--- webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/SimpleAddService.java (added)
+++ webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/SimpleAddService.java Sun Mar 25 11:41:35 2007
@@ -0,0 +1,19 @@
+package org.apache.axis2.fastinfoset;
+
+public class SimpleAddService {
+
+ public int addInts(int val1, int val2) {
+ System.out.println("Received " + val1 + " & " + val2);
+ return val1 + val2;
+ }
+
+ public float addFloats(float val1, float val2) {
+ System.out.println("Received " + val1 + " & " + val2);
+ return val1 + val2;
+ }
+
+ public String addStrings(String val1, String val2) {
+ System.out.println("Received " + val1 + " & " + val2);
+ return val1 + val2;
+ }
+}
Added: webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/SimpleAddServiceClient.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/SimpleAddServiceClient.java?view=auto&rev=522322
==============================================================================
--- webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/SimpleAddServiceClient.java (added)
+++ webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/SimpleAddServiceClient.java Sun Mar 25 11:41:35 2007
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.axis2.fastinfoset;
+
+import java.rmi.RemoteException;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.fastinfoset.xsd.SimpleAddServiceStub;
+import org.apache.axis2.fastinfoset.xsd.SimpleAddServiceStub.AddFloats;
+import org.apache.axis2.fastinfoset.xsd.SimpleAddServiceStub.AddFloatsResponse;
+import org.apache.axis2.fastinfoset.xsd.SimpleAddServiceStub.AddInts;
+import org.apache.axis2.fastinfoset.xsd.SimpleAddServiceStub.AddIntsResponse;
+import org.apache.axis2.fastinfoset.xsd.SimpleAddServiceStub.AddStrings;
+import org.apache.axis2.fastinfoset.xsd.SimpleAddServiceStub.AddStringsResponse;
+import org.apache.axis2.transport.http.HTTPConstants;
+
+public class SimpleAddServiceClient {
+
+ private SimpleAddServiceStub serviceStub;
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+ try {
+ SimpleAddServiceClient client = new SimpleAddServiceClient();
+ System.out.println("Response 1 is " + client.addStrings("Hello ", "World!"));
+ System.out.println("Response 2 is " + client.addInts(23, 27));
+ System.out.println("Response 3 is " + client.addFloats(22.84f, 27.16f));
+ } catch (AxisFault af) {
+ af.printStackTrace();
+ } catch (RemoteException re) {
+ re.printStackTrace();
+ }
+ }
+
+ /**
+ * Contructor which uses "http://localhost:8081/axis2/services/SimpleAddService" as the target.
+ * When the serrver runs at port 8080, this can be use with tcpmon for debugging.
+ *
+ * @throws AxisFault
+ */
+ public SimpleAddServiceClient() throws AxisFault {
+ this(new EndpointReference("http://localhost:8081/axis2/services/SimpleAddService"));
+ }
+
+ /**
+ * Constructor used by the default JUnit test case.
+ *
+ * @param target
+ * @throws AxisFault
+ */
+ public SimpleAddServiceClient(EndpointReference target) throws AxisFault {
+ ConfigurationContext context =
+ ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-classes", "test-resources/axis2.xml");
+ serviceStub = new SimpleAddServiceStub(context, target.getAddress());
+ //serviceStub = new SimpleAddServiceStub();
+ ServiceClient client= serviceStub._getServiceClient();
+ Options options = client.getOptions();
+ options.setProperty(Constants.Configuration.MESSAGE_TYPE, "application/soap+fastinfoset");
+ }
+
+ public String addStrings(String param0, String param1) throws RemoteException {
+ AddStrings addStrings = new SimpleAddServiceStub.AddStrings();
+ addStrings.setVal1(param0);
+ addStrings.setVal2(param1);
+ AddStringsResponse response1 = serviceStub.addStrings(addStrings);
+ return response1.get_return();
+ }
+
+ public int addInts(int param0, int param1) throws RemoteException {
+ AddInts addInts = new SimpleAddServiceStub.AddInts();
+ addInts.setVal1(param0);
+ addInts.setVal2(param1);
+ AddIntsResponse response2 = serviceStub.addInts(addInts);
+ return response2.get_return();
+ }
+
+ public float addFloats(float param0, float param1) throws RemoteException {
+ AddFloats addFloats = new SimpleAddServiceStub.AddFloats();
+ addFloats.setVal1(param0);
+ addFloats.setVal2(param1);
+ AddFloatsResponse response3 = serviceStub.addFloats(addFloats);
+ return response3.get_return();
+ }
+}
Added: webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/xsd/SimpleAddServiceCallbackHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/xsd/SimpleAddServiceCallbackHandler.java?view=auto&rev=522322
==============================================================================
--- webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/xsd/SimpleAddServiceCallbackHandler.java (added)
+++ webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/xsd/SimpleAddServiceCallbackHandler.java Sun Mar 25 11:41:35 2007
@@ -0,0 +1,97 @@
+
+ /**
+ * SimpleAddServiceCallbackHandler.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis2 version: SNAPSHOT Mar 08, 2007 (04:12:48 LKT)
+ */
+ package org.apache.axis2.fastinfoset.xsd;
+
+ /**
+ * SimpleAddServiceCallbackHandler Callback class, Users can extend this class and implement
+ * their own receiveResult and receiveError methods.
+ */
+ public abstract class SimpleAddServiceCallbackHandler{
+
+
+
+ protected Object clientData;
+
+ /**
+ * User can pass in any object that needs to be accessed once the NonBlocking
+ * Web service call is finished and appropriate method of this CallBack is called.
+ * @param clientData Object mechanism by which the user can pass in user data
+ * that will be avilable at the time this callback is called.
+ */
+ public SimpleAddServiceCallbackHandler(Object clientData){
+ this.clientData = clientData;
+ }
+
+ /**
+ * Please use this constructor if you don't want to set any clientData
+ */
+ public SimpleAddServiceCallbackHandler(){
+ this.clientData = null;
+ }
+
+ /**
+ * Get the client data
+ */
+
+ public Object getClientData() {
+ return clientData;
+ }
+
+
+ /**
+ * auto generated Axis2 call back method for addStrings method
+ * override this method for handling normal response from addStrings operation
+ */
+ public void receiveResultaddStrings(
+ org.apache.axis2.fastinfoset.xsd.SimpleAddServiceStub.AddStringsResponse result
+ ) {
+ }
+
+ /**
+ * auto generated Axis2 Error handler
+ * override this method for handling error response from addStrings operation
+ */
+ public void receiveErroraddStrings(java.lang.Exception e) {
+ }
+
+ /**
+ * auto generated Axis2 call back method for addFloats method
+ * override this method for handling normal response from addFloats operation
+ */
+ public void receiveResultaddFloats(
+ org.apache.axis2.fastinfoset.xsd.SimpleAddServiceStub.AddFloatsResponse result
+ ) {
+ }
+
+ /**
+ * auto generated Axis2 Error handler
+ * override this method for handling error response from addFloats operation
+ */
+ public void receiveErroraddFloats(java.lang.Exception e) {
+ }
+
+ /**
+ * auto generated Axis2 call back method for addInts method
+ * override this method for handling normal response from addInts operation
+ */
+ public void receiveResultaddInts(
+ org.apache.axis2.fastinfoset.xsd.SimpleAddServiceStub.AddIntsResponse result
+ ) {
+ }
+
+ /**
+ * auto generated Axis2 Error handler
+ * override this method for handling error response from addInts operation
+ */
+ public void receiveErroraddInts(java.lang.Exception e) {
+ }
+
+
+
+ }
+
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org