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 wh...@apache.org on 2002/10/23 17:23:56 UTC
cvs commit: xml-axis-wsif/java/test/proposals/mime test.txt MimeTest.java DeploymentDescriptor.xml Mime.wsdl MimeImpl.java Mime.java WSIFOperation_ApacheAxis.java
whitlock 2002/10/23 08:23:56
Modified: java/test/proposals/mime test.txt MimeTest.java
DeploymentDescriptor.xml Mime.wsdl MimeImpl.java
Mime.java WSIFOperation_ApacheAxis.java
Log:
Support text/plain
Revision Changes Path
1.2 +1 -1 xml-axis-wsif/java/test/proposals/mime/test.txt
Index: test.txt
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/test/proposals/mime/test.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- test.txt 3 Oct 2002 09:20:46 -0000 1.1
+++ test.txt 23 Oct 2002 15:23:56 -0000 1.2
@@ -1 +1 @@
-Hello Mark
\ No newline at end of file
+Hello Mark!
\ No newline at end of file
1.5 +162 -22 xml-axis-wsif/java/test/proposals/mime/MimeTest.java
Index: MimeTest.java
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/test/proposals/mime/MimeTest.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- MimeTest.java 21 Oct 2002 13:56:53 -0000 1.4
+++ MimeTest.java 23 Oct 2002 15:23:56 -0000 1.5
@@ -57,6 +57,7 @@
package proposals.mime;
+import java.awt.Image;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
@@ -67,7 +68,9 @@
import javax.activation.DataHandler;
import javax.activation.FileDataSource;
+import javax.mail.internet.MimeMultipart;
import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
@@ -89,6 +92,8 @@
* Soap Http and Jms
* Does this function make sense for NativeJms, Java, EJB, etc?
* Sending attachments and receiving them
+ * Send or receive a null attachment
+ * Sending or receiving an object that extends DataHandler, DataSource, etc
*
* @author Mark Whitlock
*/
@@ -96,11 +101,25 @@
String wsdlLocation =
TestUtilities.getWsdlPath("java\\test\\proposals\\mime") + "Mime.wsdl";
- private final static String SEND = "SEND";
- private final static String RECEIVE = "RECEIVE";
+ private final static String SEND_DH = "SEND-DH";
+ private final static String RECEIVE_DH = "RECEIVE-DH";
+ private final static String SEND_PLAINTEXT = "SEND-PLAINTEXT";
+ private final static String RECEIVE_PLAINTEXT = "RECEIVE-PLAINTEXT";
+ private final static String SEND_IMAGE = "SEND-IMAGE";
+ private final static String RECEIVE_IMAGE = "RECEIVE-IMAGE";
+ private final static String SEND_SOURCE = "SEND-SOURCE";
+ private final static String RECEIVE_SOURCE = "RECEIVE-SOURCE";
+ private final static String SEND_MIMEMULTIPART = "SEND-MIMEMULTIPART";
+ private final static String RECEIVE_MIMEMULTIPART = "RECEIVE-MIMEMULTIPART";
+
+ private final static String[] rhyme =
+ { "The owl and the pussy cat went to sea in a beautiful pea-green boat,",
+ "They took some honey and plenty of money wrapped up in a five pound note" };
- private final static String filename =
+ private final static String flatfilename =
TestUtilities.getWsdlPath("java\\test\\proposals\\mime") + "test.txt";
+ private final static String imagefilename =
+ TestUtilities.getWsdlPath("java\\test\\proposals\\mime") + "test.img";
private final boolean SYNC = true;
private final boolean ASYNC = false;
@@ -123,10 +142,46 @@
TestUtilities.setUpExtensionsAndProviders();
}
- public void testAxisSendSync() {
- doit("SOAPPort", SEND, SYNC);
+ public void testAxisSendHandlerSync() {
+ doit("SOAPPort", SEND_DH, SYNC);
}
+ public void testAxisReceiveHandlerSync() {
+ doit("SOAPPort", RECEIVE_DH, SYNC);
+ }
+
+ public void testAxisSendPlainTextSync() {
+ doit("SOAPPort", SEND_PLAINTEXT, SYNC);
+ }
+
+// public void testAxisReceivePlainTextSync() {
+// doit("SOAPPort", RECEIVE_PLAINTEXT, SYNC);
+// }
+//
+// public void testAxisSendImageSync() {
+// doit("SOAPPort", SEND_IMAGE, SYNC);
+// }
+//
+// public void testAxisReceiveImageSync() {
+// doit("SOAPPort", RECEIVE_IMAGE, SYNC);
+// }
+//
+// public void testAxisSendSourceSync() {
+// doit("SOAPPort", SEND_SOURCE, SYNC);
+// }
+//
+// public void testAxisReceiveSourceSync() {
+// doit("SOAPPort", RECEIVE_SOURCE, SYNC);
+// }
+//
+// public void testAxisSendMimeMultipartSync() {
+// doit("SOAPPort", SEND_MIMEMULTIPART, SYNC);
+// }
+//
+// public void testAxisReceiveMimeMultipartSync() {
+// doit("SOAPPort", RECEIVE_MIMEMULTIPART, SYNC);
+// }
+
/*
* Sending MIME messages using Axis over Jms should be supported
* by WSIF, but currently this does not work. I think the problem
@@ -144,10 +199,16 @@
* }
*/
- public void testAxisReceiveSync() {
- doit("SOAPPort", RECEIVE, SYNC);
- }
-
+ /**
+ * doit should probably do the mapTypes() but unfortunately plain text
+ * means that Strings are serialized with the JAFDataHandlerSerializer
+ * and I can't find a way to differentiate between strings that should
+ * be treated as a mime part and those that should not. Basically if I
+ * mapTypes(plaintext,String) all Strings get mapped to a DataHandler,
+ * and soap on the server looks for a web service that takes a
+ * DataHandler, not a String. So be careful where mapTypes(plaintext,String)
+ * is done.
+ */
private void doit(String portName, String cmd, boolean blocking) {
WSIFDynamicProvider_ApacheAxis provider =
@@ -172,10 +233,26 @@
Mime stub = (Mime) service.getStub(portName, Mime.class);
- if (cmd.equals(SEND))
- send(stub);
- else if (cmd.equals(RECEIVE))
- receive(stub);
+ if (cmd.equals(SEND_DH))
+ send_dh(service,stub);
+ else if (cmd.equals(RECEIVE_DH))
+ receive_dh(service,stub);
+ else if (cmd.equals(SEND_PLAINTEXT))
+ send_plaintext(service,stub);
+ else if (cmd.equals(RECEIVE_PLAINTEXT))
+ receive_plaintext(service,stub);
+ else if (cmd.equals(SEND_IMAGE))
+ send_image(service,stub);
+ else if (cmd.equals(RECEIVE_IMAGE))
+ receive_image(service,stub);
+ else if (cmd.equals(SEND_SOURCE))
+ send_source(service,stub);
+ else if (cmd.equals(RECEIVE_SOURCE))
+ receive_source(service,stub);
+ else if (cmd.equals(SEND_MIMEMULTIPART))
+ send_mimemultipart(service,stub);
+ else if (cmd.equals(RECEIVE_MIMEMULTIPART))
+ receive_mimemultipart(service,stub);
else
assertTrue(false);
@@ -192,17 +269,80 @@
}
- private void send(Mime stub) throws Exception {
- DataHandler dh = new DataHandler(new FileDataSource(filename));
- String buff = stub.fileToString(dh);
- compareFiles(filename, buff);
+ private void send_dh(WSIFService service, Mime stub) throws Exception {
+ DataHandler dh = new DataHandler(new FileDataSource(flatfilename));
+ String buff = stub.dataHandlerToString(dh);
+ compareFiles(flatfilename, buff);
+ }
+
+ private void receive_dh(WSIFService service, Mime stub) throws Exception {
+ DataHandler dh = stub.stringToDataHandler(rhyme[0]);
+ compareFiles(dh,rhyme[0]);
+ }
+
+ private void send_plaintext(WSIFService service, Mime stub) throws Exception {
+ service.mapType(
+ new QName("http://proposals.mime/", "plaintext"),
+ String.class);
+ String buff = stub.plainTextToString(rhyme[0]);
+ assertTrue(rhyme[0].equals(buff));
+ }
+
+ private void receive_plaintext(WSIFService service, Mime stub) throws Exception {
+ service.mapType(
+ new QName("http://proposals.mime/", "plaintext"),
+ String.class);
+ String buff = stub.stringToPlainText(rhyme[1]);
+ assertTrue(rhyme[1].equals(buff));
+ }
+
+ private void send_image(WSIFService service, Mime stub) throws Exception {
+ service.mapType(
+ new QName("http://proposals.mime/", "image"),
+ Image.class);
+// Image i = new Image(imagefilename);
+// String buff = stub.imageToString(i);
+// assertTrue(rhyme[0].equals(buff));
+ }
+
+ private void receive_image(WSIFService service, Mime stub) throws Exception {
+ service.mapType(
+ new QName("http://proposals.mime/", "image"),
+ Image.class);
+// String buff = stub.stringToImage(rhyme[1]);
+// assertTrue(rhyme[1].equals(buff));
+ }
+
+ private void send_source(WSIFService service, Mime stub) throws Exception {
+ service.mapType(
+ new QName("http://proposals.mime/", "source"),
+ Source.class);
+// String buff = stub.plainTextToString(rhyme[0]);
+// assertTrue(rhyme[0].equals(buff));
+ }
+
+ private void receive_source(WSIFService service, Mime stub) throws Exception {
+ service.mapType(
+ new QName("http://proposals.mime/", "source"),
+ Source.class);
+// String buff = stub.stringToPlainText(rhyme[1]);
+// assertTrue(rhyme[1].equals(buff));
+ }
+
+ private void send_mimemultipart(WSIFService service, Mime stub) throws Exception {
+ service.mapType(
+ new QName("http://proposals.mime/", "mimemultipart"),
+ MimeMultipart.class);
+// String buff = stub.plainTextToString(rhyme[0]);
+// assertTrue(rhyme[0].equals(buff));
}
- private void receive(Mime stub) throws Exception {
- String rhyme =
- "The owl and the pussy cat went to sea in a beautiful pea-green boat";
- DataHandler dh = stub.stringToFile(rhyme);
- compareFiles(dh,rhyme);
+ private void receive_mimemultipart(WSIFService service, Mime stub) throws Exception {
+ service.mapType(
+ new QName("http://proposals.mime/", "mimemultipart"),
+ MimeMultipart.class);
+// String buff = stub.stringToPlainText(rhyme[1]);
+// assertTrue(rhyme[1].equals(buff));
}
private boolean compareFiles(DataHandler dh, String buff)
1.3 +7 -1 xml-axis-wsif/java/test/proposals/mime/DeploymentDescriptor.xml
Index: DeploymentDescriptor.xml
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/test/proposals/mime/DeploymentDescriptor.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DeploymentDescriptor.xml 21 Oct 2002 09:48:18 -0000 1.2
+++ DeploymentDescriptor.xml 23 Oct 2002 15:23:56 -0000 1.3
@@ -2,7 +2,7 @@
id="http://proposals.mime/">
<isd:provider type="java"
scope="Application"
- methods="fileToString stringToFile">
+ methods="dataHandlerToString stringToDataHandler plainTextToString stringToPlainText">
<isd:java class="proposals.mime.MimeImpl" static="false"/>
</isd:provider>
@@ -13,6 +13,12 @@
xmlns:x="http://proposals.mime/"
qname="x:datahandler"
javaType="javax.activation.DataHandler"
+ java2XMLClassName="org.apache.soap.encoding.soapenc.MimePartSerializer"
+ xml2JavaClassName="org.apache.soap.encoding.soapenc.MimePartSerializer" />
+ <isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+ xmlns:x="http://proposals.mime/"
+ qname="x:datasource"
+ javaType="javax.activation.DataSource"
java2XMLClassName="org.apache.soap.encoding.soapenc.MimePartSerializer"
xml2JavaClassName="org.apache.soap.encoding.soapenc.MimePartSerializer" />
</isd:mappings>
1.3 +101 -17 xml-axis-wsif/java/test/proposals/mime/Mime.wsdl
Index: Mime.wsdl
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/test/proposals/mime/Mime.wsdl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Mime.wsdl 21 Oct 2002 09:48:18 -0000 1.2
+++ Mime.wsdl 23 Oct 2002 15:23:56 -0000 1.3
@@ -10,23 +10,35 @@
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
- <message name="FileToStringRequestMessage">
+ <message name="DataHandlerMessage">
<part name="file" type="tns:datahandler"/>
</message>
- <message name="FileToStringResponseMessage">
+ <message name="PlainTextMessage">
+ <part name="plaintext" type="tns:plaintext"/>
+ </message>
+
+ <message name="StringMessage">
<part name="buff" type="xsd:string"/>
</message>
<!-- port type declns -->
<portType name="Mime">
- <operation name="fileToString">
- <input message="tns:FileToStringRequestMessage"/>
- <output message="tns:FileToStringResponseMessage"/>
- </operation>
- <operation name="stringToFile">
- <input message="tns:FileToStringResponseMessage"/>
- <output message="tns:FileToStringRequestMessage"/>
+ <operation name="dataHandlerToString">
+ <input message="tns:DataHandlerMessage"/>
+ <output message="tns:StringMessage"/>
+ </operation>
+ <operation name="stringToDataHandler">
+ <input message="tns:StringMessage"/>
+ <output message="tns:DataHandlerMessage"/>
+ </operation>
+ <operation name="plainTextToString">
+ <input message="tns:PlainTextMessage"/>
+ <output message="tns:StringMessage"/>
+ </operation>
+ <operation name="stringToPlainText">
+ <input message="tns:StringMessage"/>
+ <output message="tns:PlainTextMessage"/>
</operation>
</portType>
@@ -34,7 +46,7 @@
<binding name="SOAPHttpBinding" type="tns:Mime">
<soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
- <operation name="fileToString">
+ <operation name="dataHandlerToString">
<soap:operation soapAction=""/>
<input>
<mime:multipartRelated>
@@ -52,7 +64,7 @@
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
- <operation name="stringToFile">
+ <operation name="stringToDataHandler">
<soap:operation soapAction=""/>
<input>
<soap:body use="encoded"
@@ -70,12 +82,48 @@
</mime:multipartRelated>
</output>
</operation>
+ <operation name="plainTextToString">
+ <soap:operation soapAction=""/>
+ <input>
+ <mime:multipartRelated>
+ <mime:part>
+ <mime:content part="plaintext" type="text/plain"/>
+ <soap:body use="encoded"
+ namespace="http://proposals.mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </mime:part>
+ </mime:multipartRelated>
+ </input>
+ <output>
+ <soap:body use="encoded"
+ namespace="http://proposals.mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </output>
+ </operation>
+ <operation name="stringToPlainText">
+ <soap:operation soapAction=""/>
+ <input>
+ <soap:body use="encoded"
+ namespace="http://proposals.mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </input>
+ <output>
+ <mime:multipartRelated>
+ <mime:part>
+ <mime:content part="plaintext" type="text/plain"/>
+ <soap:body use="encoded"
+ namespace="http://proposals.mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </mime:part>
+ </mime:multipartRelated>
+ </output>
+ </operation>
</binding>
- <binding name="SOAPJmsBinding" type="tns:Mime">
+ <!-- binding name="SOAPJmsBinding" type="tns:Mime">
<soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/jms"/>
- <operation name="fileToString">
+ <operation name="dataHandlerToString">
<soap:operation soapAction=""/>
<input>
<mime:multipartRelated>
@@ -93,7 +141,7 @@
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
- <operation name="stringToFile">
+ <operation name="stringToDataHandler">
<soap:operation soapAction=""/>
<input>
<soap:body use="encoded"
@@ -111,20 +159,56 @@
</mime:multipartRelated>
</output>
</operation>
- </binding>
+ <operation name="dataSourceToString">
+ <soap:operation soapAction=""/>
+ <input>
+ <mime:multipartRelated>
+ <mime:part>
+ <mime:content part="file" type="text/html"/>
+ <soap:body use="encoded"
+ namespace="http://proposals.mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </mime:part>
+ </mime:multipartRelated>
+ </input>
+ <output>
+ <soap:body use="encoded"
+ namespace="http://proposals.mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </output>
+ </operation>
+ <operation name="stringToDataSource">
+ <soap:operation soapAction=""/>
+ <input>
+ <soap:body use="encoded"
+ namespace="http://proposals.mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </input>
+ <output>
+ <mime:multipartRelated>
+ <mime:part>
+ <mime:content part="file" type="text/html"/>
+ <soap:body use="encoded"
+ namespace="http://proposals.mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </mime:part>
+ </mime:multipartRelated>
+ </output>
+ </operation>
+ </binding -->
<!-- service decln -->
<service name="MimeService">
<port name="SOAPPort" binding="tns:SOAPHttpBinding">
<soap:address location="http://localhost:8080/soap/servlet/rpcrouter"/>
</port>
- <port name="SOAPJMSPort" binding="tns:SOAPJmsBinding">
+ <!-- port name="SOAPJMSPort" binding="tns:SOAPJmsBinding">
<jms:address jndiDestinationName="SoapJmsAddressBookQueue"
destinationStyle="queue"
jndiConnectionFactoryName="WSIFSampleQCF"
initialContextFactory="com.sun.jndi.fscontext.RefFSContextFactory"
jndiProviderURL="file:///JNDI-Directory"/>
- </port>
+ </port -->
</service>
</definitions>
1.4 +38 -23 xml-axis-wsif/java/test/proposals/mime/MimeImpl.java
Index: MimeImpl.java
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/test/proposals/mime/MimeImpl.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- MimeImpl.java 21 Oct 2002 13:56:53 -0000 1.3
+++ MimeImpl.java 23 Oct 2002 15:23:56 -0000 1.4
@@ -60,18 +60,18 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
-import java.io.OutputStream;
import javax.activation.DataHandler;
+import javax.activation.DataSource;
import javax.activation.FileDataSource;
/**
* Mime service used by MimeTest
* @author Mark Whitlock
*/
-public class MimeImpl implements Mime {
-
- public String fileToString(DataHandler dh) {
+public class MimeImpl {
+
+ public String dataHandlerToString(DataHandler dh) {
try {
InputStream is = dh.getInputStream();
byte[] bBuff = new byte[is.available()];
@@ -79,35 +79,50 @@
String sBuff = new String(bBuff);
return sBuff;
} catch (IOException ioe) {
+ ioe.printStackTrace();
return null;
}
}
- public DataHandler stringToFile(String buff) {
+ public DataHandler stringToDataHandler(String buff) {
try {
-// FileDataSource fds = new FileDataSource(tempFileName);
-// File f = fds.getFile();
-// if (f.exists()) {
-// System.out.println("Deleting an existing file");
-// f.delete();
-// }
-//
-// if (!f.createNewFile()) {
-// System.out.println("Failed to create file");
-// return null;
-// }
-
- File f = File.createTempFile("WSIFMimeTest","txt");
- f.deleteOnExit();
-
- FileDataSource fds = new FileDataSource(f.getAbsolutePath());
+ FileDataSource fds = getTempFile();
fds.getOutputStream().write(buff.getBytes());
-
DataHandler dh = new DataHandler(fds);
return dh;
} catch (IOException ioe) {
- ioe.printStackTrace();
+ ioe.printStackTrace();
return null;
}
+ }
+
+ public String plainTextToString(DataHandler ds) {
+ try {
+ InputStream is = ds.getInputStream();
+ byte[] bBuff = new byte[is.available()];
+ is.read(bBuff);
+ String sBuff = new String(bBuff);
+ return sBuff;
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
+ return null;
+ }
+ }
+
+ public DataHandler stringToPlainText(String buff) {
+ try {
+ FileDataSource fds = getTempFile();
+ fds.getOutputStream().write(buff.getBytes());
+ return new DataHandler(fds);
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
+ return null;
+ }
+ }
+
+ private FileDataSource getTempFile() throws IOException {
+ File f = File.createTempFile("WSIFMimeTest", "txt");
+ f.deleteOnExit();
+ return new FileDataSource(f);
}
}
1.3 +18 -2 xml-axis-wsif/java/test/proposals/mime/Mime.java
Index: Mime.java
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/test/proposals/mime/Mime.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Mime.java 21 Oct 2002 09:48:18 -0000 1.2
+++ Mime.java 23 Oct 2002 15:23:56 -0000 1.3
@@ -58,8 +58,24 @@
package proposals.mime;
import javax.activation.DataHandler;
+import javax.activation.DataSource;
public interface Mime {
- public String fileToString(DataHandler dh);
- public DataHandler stringToFile(String buff);
+ public String dataHandlerToString(DataHandler dh);
+ public DataHandler stringToDataHandler(String buff);
+
+ public String plainTextToString(String s);
+ public String stringToPlainText(String buff);
+
+// public String dataSourceToString(DataSource ds);
+// public DataSource stringToDataSource(String buff);
+//
+// public String dataSourceToString(DataSource ds);
+// public DataSource stringToDataSource(String buff);
+//
+// public String dataSourceToString(DataSource ds);
+// public DataSource stringToDataSource(String buff);
+//
+// public String dataSourceToString(DataSource ds);
+// public DataSource stringToDataSource(String buff);
}
1.4 +33 -0 xml-axis-wsif/java/test/proposals/mime/WSIFOperation_ApacheAxis.java
Index: WSIFOperation_ApacheAxis.java
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/test/proposals/mime/WSIFOperation_ApacheAxis.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- WSIFOperation_ApacheAxis.java 21 Oct 2002 13:56:53 -0000 1.3
+++ WSIFOperation_ApacheAxis.java 23 Oct 2002 15:23:56 -0000 1.4
@@ -57,6 +57,7 @@
package proposals.mime;
+import java.awt.Image;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
@@ -66,7 +67,9 @@
import java.util.Vector;
import javax.activation.DataHandler;
+import javax.activation.DataSource;
import javax.jms.TextMessage;
+import javax.mail.internet.MimeMultipart;
import javax.wsdl.Definition;
import javax.wsdl.Input;
import javax.wsdl.Operation;
@@ -75,10 +78,15 @@
import javax.xml.namespace.QName;
import javax.xml.soap.AttachmentPart;
import javax.xml.soap.SOAPException;
+import javax.xml.transform.Source;
import org.apache.axis.AxisFault;
import org.apache.axis.Message;
import org.apache.axis.MessageContext;
+import org.apache.axis.attachments.ImageDataSource;
+import org.apache.axis.attachments.MimeMultipartDataSource;
+import org.apache.axis.attachments.PlainTextDataSource;
+import org.apache.axis.attachments.SourceDataSource;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.client.Transport;
@@ -650,6 +658,7 @@
Trc.exception(ex);
obj = null;
}
+
if (obj != null) {
if (types[i] == null)
throw new WSIFException("Cannot map type " + names[i]);
@@ -747,6 +756,30 @@
if (DataHandler.class.equals(objClass)) {
call.registerTypeMapping(
objClass,
+ qn,
+ JAFDataHandlerSerializerFactory.class,
+ JAFDataHandlerDeserializerFactory.class);
+ } else if (Image.class.equals(objClass)) {
+ call.registerTypeMapping(
+ Image.class,
+ qn,
+ JAFDataHandlerSerializerFactory.class,
+ JAFDataHandlerDeserializerFactory.class);
+ } else if (String.class.equals(objClass)) {
+ call.registerTypeMapping(
+ String.class,
+ qn,
+ JAFDataHandlerSerializerFactory.class,
+ JAFDataHandlerDeserializerFactory.class);
+ } else if (Source.class.equals(objClass)) {
+ call.registerTypeMapping(
+ Source.class,
+ qn,
+ JAFDataHandlerSerializerFactory.class,
+ JAFDataHandlerDeserializerFactory.class);
+ } else if (MimeMultipart.class.equals(objClass)) {
+ call.registerTypeMapping(
+ MimeMultipart.class,
qn,
JAFDataHandlerSerializerFactory.class,
JAFDataHandlerDeserializerFactory.class);