You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sc...@apache.org on 2006/08/09 18:32:47 UTC
svn commit: r430087 - in /webservices/axis2/trunk/java/modules/jaxws: ./
test-resources/image/ test-resources/xsd/
test/org/apache/axis2/jaxws/framework/ test/org/apache/axis2/jaxws/provider/
test/org/apache/axis2/jaxws/provider/jaxb/ test/org/apache/a...
Author: scheu
Date: Wed Aug 9 09:32:45 2006
New Revision: 430087
URL: http://svn.apache.org/viewvc?rev=430087&view=rev
Log:
AXIS2-984
JAXB/MTOM Dispatch client with JAXBSource/MTOM Provider on server
Contributor: Samuel Isokpunwu
Added:
webservices/axis2/trunk/java/modules/jaxws/test-resources/image/
webservices/axis2/trunk/java/modules/jaxws/test-resources/image/test.jpg (with props)
webservices/axis2/trunk/java/modules/jaxws/test-resources/xsd/samplemtom.xsd
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/AttachmentUtil.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/DataSourceImpl.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/JAXBProviderTests.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/jaxb/
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/jaxb/JAXBProvider.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/jaxb/META-INF/
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/jaxb/META-INF/MANIFEST.MF
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/jaxb/META-INF/services.xml
Modified:
webservices/axis2/trunk/java/modules/jaxws/maven.xml
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/ProviderTestCase.java
Modified: webservices/axis2/trunk/java/modules/jaxws/maven.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/maven.xml?rev=430087&r1=430086&r2=430087&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/maven.xml (original)
+++ webservices/axis2/trunk/java/modules/jaxws/maven.xml Wed Aug 9 09:32:45 2006
@@ -57,6 +57,13 @@
<classpath location="${compiled.classes.dir}"/>
<arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/stock2.xsd"/>
</java>
+ <ant:echo>Generating java from samplemtom.xsd</ant:echo>
+ <java classname="com.sun.tools.xjc.Driver" fork="true">
+ <jvmarg line="${maven.junit.jvmargs}"/>
+ <classpath refid="maven.dependency.classpath"/>
+ <classpath location="${compiled.classes.dir}"/>
+ <arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/samplemtom.xsd"/>
+ </java>
<ant:echo>Generating java from ProxyDocLitWrapped.wsdl</ant:echo>
<java classname="com.sun.tools.xjc.Driver" fork="true">
<jvmarg line="${maven.junit.jvmargs}"/>
@@ -116,6 +123,20 @@
</ant:fileset>
<ant:fileset dir="target/classes">
<ant:include name="org/apache/axis2/jaxws/server/**"/>
+ </ant:fileset>
+ </ant:copy>
+ <ant:copy toDir="target/test-classes/services/JAXBProviderService/">
+ <ant:fileset dir="target/test-classes">
+ <ant:include name="org/apache/axis2/jaxws/provider/jaxb/**"/>
+ </ant:fileset>
+ <ant:fileset dir="test/org/apache/axis2/jaxws/provider/jaxb">
+ <ant:include name="META-INF/**"/>
+ </ant:fileset>
+ <ant:fileset dir="target/classes">
+ <ant:include name="org/apache/axis2/jaxws/server/**"/>
+ </ant:fileset>
+ <ant:fileset dir="target/schema/classes">
+ <ant:include name="org/test/mtom/**"/>
</ant:fileset>
</ant:copy>
<!-- ================================================================ -->
Added: webservices/axis2/trunk/java/modules/jaxws/test-resources/image/test.jpg
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test-resources/image/test.jpg?rev=430087&view=auto
==============================================================================
Binary file - no diff available.
Propchange: webservices/axis2/trunk/java/modules/jaxws/test-resources/image/test.jpg
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: webservices/axis2/trunk/java/modules/jaxws/test-resources/xsd/samplemtom.xsd
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test-resources/xsd/samplemtom.xsd?rev=430087&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test-resources/xsd/samplemtom.xsd (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test-resources/xsd/samplemtom.xsd Wed Aug 9 09:32:45 2006
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<xs:schema elementFormDefault="qualified"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
+ xmlns:tns="urn://mtom.test.org"
+ targetNamespace="urn://mtom.test.org">
+ <xs:import namespace="http://www.w3.org/2005/05/xmlmime"
+ schemaLocation="http://www.w3.org/2005/05/xmlmime"/>
+ <xs:complexType name="ImageDepot">
+ <xs:sequence>
+ <xs:element name="imageData"
+ type="xs:base64Binary"
+ xmime:expectedContentTypes="multipart/*"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:element name="sendImage">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="1" name="input" type="tns:ImageDepot"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="sendImageResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="1" name="output" type="tns:ImageDepot"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+</xs:schema>
Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java?rev=430087&r1=430086&r2=430087&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java Wed Aug 9 09:32:45 2006
@@ -63,6 +63,7 @@
suite.addTestSuite(StringProviderTests.class);
suite.addTestSuite(SourceProviderTests.class);
+ suite.addTestSuite(JAXBProviderTests.class);
suite.addTestSuite(ProxyTests.class);
suite.addTestSuite(ExceptionFactoryTests.class);
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/AttachmentUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/AttachmentUtil.java?rev=430087&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/AttachmentUtil.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/AttachmentUtil.java Wed Aug 9 09:32:45 2006
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.jaxws.provider;
+
+
+import javax.imageio.IIOImage;
+import javax.imageio.ImageWriter;
+import javax.imageio.stream.ImageOutputStream;
+import java.awt.Image;
+import java.awt.image.BufferedImage;
+import java.io.OutputStream;
+import java.util.Iterator;
+
+/**
+ * This will serve as a helper class for attachments utility methods. All methods
+ * are intended to be referenced staticly.
+ *
+ */
+public class AttachmentUtil {
+
+ /**
+ * Store a given image to an Image output stream
+ * @param mimeType
+ * @param image
+ * @param os
+ * @throws Exception
+ */
+ public static void storeImage(String mimeType, Image image, OutputStream os) throws Exception {
+ ImageWriter imageWriter = null;
+ BufferedImage bufferedImage = (BufferedImage) image;
+
+ Iterator iterator = javax.imageio.ImageIO.getImageWritersByMIMEType(mimeType);
+ if (iterator.hasNext()) {
+ imageWriter = (ImageWriter) iterator.next();
+ }
+ ImageOutputStream ios = javax.imageio.ImageIO.createImageOutputStream(os);
+ imageWriter.setOutput(ios);
+
+ imageWriter.write(new IIOImage(bufferedImage, null, null));
+ ios.flush();
+ imageWriter.dispose();
+ }
+}
+
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/DataSourceImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/DataSourceImpl.java?rev=430087&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/DataSourceImpl.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/DataSourceImpl.java Wed Aug 9 09:32:45 2006
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.jaxws.provider;
+
+import javax.activation.DataSource;
+import java.awt.Image;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * An impl class for javax.activation.DataSource interface.
+ *
+ */
+public class DataSourceImpl implements DataSource {
+
+ private final String fileName;
+
+ private final String contentType;
+
+ private byte[] byteArray;
+
+ private ByteArrayOutputStream byteArrayOS;
+
+ /**
+ * Constructor
+ *
+ * @param _contentType
+ * @param _fileName
+ * @param image
+ * @throws Exception
+ */
+ public DataSourceImpl(String _contentType, String _fileName, Image image) throws Exception{
+ super();
+
+ try {
+ if((_contentType == null) || (_contentType == "")){
+ throw new NullPointerException("Type is NULL: Must provide content type");
+ }
+ if((_fileName == null) || (_contentType == "")){
+ throw new NullPointerException("File name is NULL: Must provide content file name");
+ }
+
+ this.fileName = _fileName;
+ this.contentType = _contentType;
+
+ if (image != null) {
+ byteArrayOS = new ByteArrayOutputStream();
+ AttachmentUtil.storeImage(this.contentType, image, byteArrayOS);
+ }
+ } catch (Exception e) {
+ throw e;
+ }
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.activation.DataSource#getContentType()
+ */
+ public String getContentType() {
+ return this.contentType;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.activation.DataSource#getInputStream()
+ */
+ public InputStream getInputStream() throws IOException {
+ if (this.byteArrayOS.size() != 0) {
+ this.byteArray = this.byteArrayOS.toByteArray();
+ this.byteArrayOS.reset();
+ }
+
+ if(this.byteArray == null){
+ return new ByteArrayInputStream(new byte[0]);
+
+ }
+ return new ByteArrayInputStream(this.byteArray);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.activation.DataSource#getName()
+ */
+ public String getName() {
+ return this.fileName;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.activation.DataSource#getOutputStream()
+ */
+ public OutputStream getOutputStream() throws IOException {
+ if (this.byteArrayOS.size() != 0) {
+ this.byteArray = this.byteArrayOS.toByteArray();
+ this.byteArrayOS.reset();
+ }
+ return this.byteArrayOS;
+ }
+}
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/JAXBProviderTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/JAXBProviderTests.java?rev=430087&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/JAXBProviderTests.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/JAXBProviderTests.java Wed Aug 9 09:32:45 2006
@@ -0,0 +1,157 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.jaxws.provider;
+
+import java.awt.Image;
+import java.io.File;
+
+import javax.activation.DataHandler;
+import javax.activation.DataSource;
+import javax.imageio.ImageIO;
+import javax.imageio.stream.FileImageInputStream;
+import javax.imageio.stream.ImageInputStream;
+import javax.xml.bind.JAXBContext;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+
+import org.apache.axiom.attachments.ByteArrayDataSource;
+import org.test.mtom.ImageDepot;
+import org.test.mtom.ObjectFactory;
+import org.test.mtom.SendImage;
+import org.test.mtom.SendImageResponse;
+
+/**
+ * The intended purpose of this testcase is to test the MTOM functions in Axis2.
+ * It demostrate an alternative way of sending an attachment using DataHandler.
+ *
+ * This testcase uses a JAXWS Dispatch invocation with JAXB generated request object
+ * as parameter. The endpoint for these testcase is a JAXWS Source Provider.
+ *
+ * These JAXB generated artifacts is based on jaxws\test-resources\xsd\samplemtom.xsd
+ * schema.
+ *
+ * Available Content types are:
+ * "image/gif"
+ * "image/jpeg"
+ * "text/plain"
+ * "multipart/*"
+ * "text/xml"
+ * "application/xml"
+ * This initial testcase only covers the "multipart/*" and "text/plain" mime types.
+ * The ultimate goal is to provide testcases for the remaining mime types.
+ *
+ */
+public class JAXBProviderTests extends ProviderTestCase {
+
+ String endpointUrl = "http://localhost:8080/axis2/services/JAXBProviderService";
+ private QName serviceName = new QName("http://ws.apache.org/axis2", "JAXBProviderService");
+ DataSource stringDS, imageDS;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ //Create a DataSource from a String
+ String string = "Sending a JAXB generated string object to Source Provider endpoint";
+ stringDS = new ByteArrayDataSource(string.getBytes(),"text/plain");
+
+ //Create a DataSource from an image
+ File file = new File(imageResourceDir+File.separator+"test.jpg");
+ ImageInputStream fiis = new FileImageInputStream(file);
+ Image image = ImageIO.read(fiis);
+ imageDS = new DataSourceImpl("image/jpeg","test.jpg",image);
+
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public JAXBProviderTests(String name) {
+ super(name);
+ }
+
+ /**
+ * test String
+ * @throws Exception
+ */
+ public void testMTOMAttachmentString() throws Exception {
+ System.out.println("---------------------------------------");
+ System.out.println("test: " + getName());
+
+ //Create a DataHandler with the String DataSource object
+ DataHandler dataHandler = new DataHandler(stringDS);
+
+ //Store the data handler in ImageDepot bean
+ ImageDepot imageDepot = new ObjectFactory().createImageDepot();
+ imageDepot.setImageData(dataHandler);
+
+ Service svc = Service.create(serviceName);
+ svc.addPort(portName, null, endpointUrl);
+
+ JAXBContext jbc = JAXBContext.newInstance("org.test.mtom");
+
+ Dispatch<Object> dispatch = svc
+ .createDispatch(portName, jbc, Service.Mode.PAYLOAD);
+
+ //Create a request bean with imagedepot bean as value
+ ObjectFactory factory = new ObjectFactory();
+ SendImage request = factory.createSendImage();
+ request.setInput(imageDepot);
+
+ System.out.println(">> Invoking Dispatch<Object> JAXBProviderService");
+
+ SendImageResponse response = (SendImageResponse) dispatch.invoke(request);
+
+ System.out.println(">> Response [" + response.toString() + "]");
+ }
+
+ /**
+ * test Image
+ * @throws Exception
+ */
+ public void testMTOMAttachmentImage() throws Exception {
+ System.out.println("---------------------------------------");
+ System.out.println("test: " + getName());
+
+ //Create a DataHandler with the String DataSource object
+ DataHandler dataHandler = new DataHandler(imageDS);
+
+ //Store the data handler in ImageDepot bean
+ ImageDepot imageDepot = new ObjectFactory().createImageDepot();
+ imageDepot.setImageData(dataHandler);
+
+ Service svc = Service.create(serviceName);
+ svc.addPort(portName, null, endpointUrl);
+
+ JAXBContext jbc = JAXBContext.newInstance("org.test.mtom");
+
+ Dispatch<Object> dispatch = svc
+ .createDispatch(portName, jbc, Service.Mode.PAYLOAD);
+
+ //Create a request bean with imagedepot bean as value
+ ObjectFactory factory = new ObjectFactory();
+ SendImage request = factory.createSendImage();
+ request.setInput(imageDepot);
+
+ System.out.println(">> Invoking Dispatch<Object> JAXBProviderService");
+
+ SendImageResponse response = (SendImageResponse) dispatch.invoke(request);
+
+ System.out.println(">> Response [" + response.toString() + "]");
+ }
+}
Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/ProviderTestCase.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/ProviderTestCase.java?rev=430087&r1=430086&r2=430087&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/ProviderTestCase.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/ProviderTestCase.java Wed Aug 9 09:32:45 2006
@@ -24,6 +24,7 @@
public QName portName = new QName("http://ws.apache.org/axis2", "SimpleProviderServiceSOAP11port0");
public String providerResourceDir = "test-resources"+File.separator+"provider";
+ public String imageResourceDir = "test-resources"+File.separator+"image";
public String basedir = null;
protected void setUp() throws Exception {
@@ -44,6 +45,7 @@
basedir = new File(".").getAbsolutePath();
}
providerResourceDir = new File(basedir, providerResourceDir).getAbsolutePath();
+ imageResourceDir = new File(basedir, imageResourceDir).getAbsolutePath();
}
}
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/jaxb/JAXBProvider.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/jaxb/JAXBProvider.java?rev=430087&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/jaxb/JAXBProvider.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/jaxb/JAXBProvider.java Wed Aug 9 09:32:45 2006
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.jaxws.provider.jaxb;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.Provider;
+
+import org.test.mtom.ObjectFactory;
+import org.test.mtom.SendImage;
+import org.test.mtom.SendImageResponse;
+
+/**
+ * A JAXWS Source Provider implementation
+ *
+ */
+public class JAXBProvider implements Provider<Source> {
+
+ /**
+ * Required impl method from javax.xml.ws.Provider interface
+ * @param obj
+ * @return
+ */
+ public Source invoke(Source obj) {
+ System.out.println(">> JAXB Provider Service: Request received.\n");
+ SendImage siRequest = null;
+ SendImageResponse siResponse = null;
+ StreamSource streamSource = null;
+
+ try {
+ //Create a request object
+ siRequest = new ObjectFactory().createSendImage();
+
+ //Unmarshall recieved Source to get request param.
+ JAXBContext jbc = JAXBContext.newInstance("org.test.mtom");
+ Unmarshaller um = jbc.createUnmarshaller();
+ siRequest = (SendImage)um.unmarshal(obj);
+
+ //Create a response object
+ siResponse = new ObjectFactory().createSendImageResponse();
+ siResponse.setOutput(siRequest.getInput());
+
+ //Marshall the response object and create a StreamSource from the
+ //resulting byte array input stream
+ Marshaller m = jbc.createMarshaller();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ m.marshal(siResponse, baos);
+ byte []bite = baos.toByteArray();
+ ByteArrayInputStream bais = new ByteArrayInputStream(bite);
+ streamSource = new StreamSource(bais);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ return streamSource;
+
+ }
+}
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/jaxb/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/jaxb/META-INF/MANIFEST.MF?rev=430087&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/jaxb/META-INF/MANIFEST.MF (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/jaxb/META-INF/MANIFEST.MF Wed Aug 9 09:32:45 2006
@@ -0,0 +1 @@
+Manifest-Version: 1.0
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/jaxb/META-INF/services.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/jaxb/META-INF/services.xml?rev=430087&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/jaxb/META-INF/services.xml (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/jaxb/META-INF/services.xml Wed Aug 9 09:32:45 2006
@@ -0,0 +1,11 @@
+<serviceGroup>
+ <service name="JAXBProviderService">
+ <messageReceivers>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" class="org.apache.axis2.jaxws.server.JAXWSMessageReceiver"/>
+ </messageReceivers>
+ <parameter locked="false" name="ServiceClass">org.apache.axis2.jaxws.provider.jaxb.JAXBProvider</parameter>
+ <operation name="sendImage" mep="http://www.w3.org/2004/08/wsdl/in-out">
+ <actionMapping/>
+ </operation>
+ </service>
+</serviceGroup>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org