whitlock 2003/03/07 06:15:59
Modified: java/test/mime Mime.wsdl MimeTest.java Mime.java
java/src/org/apache/wsif/providers/soap/apacheaxis
WSIFOperation_ApacheAxis.java
Log:
16993: unreferenced attachments
Revision Changes Path
1.13 +1 -0 xml-axis-wsif/java/test/mime/Mime.wsdl
Index: Mime.wsdl
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/test/mime/Mime.wsdl,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- Mime.wsdl 4 Mar 2003 17:16:12 -0000 1.12
+++ Mime.wsdl 7 Mar 2003 14:15:58 -0000 1.13
@@ -161,6 +161,7 @@
<output message="tns:StringMessage"/>
</operation>
<operation name="unref">
+ <!--input message="tns:DataHandlerMessage"/-->
<input message="tns:MultiMimePartsMessage"/>
<output message="tns:StringMessage"/>
</operation>
1.15 +54 -6 xml-axis-wsif/java/test/mime/MimeTest.java
Index: MimeTest.java
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/test/mime/MimeTest.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- MimeTest.java 6 Mar 2003 10:10:25 -0000 1.14
+++ MimeTest.java 7 Mar 2003 14:15:58 -0000 1.15
@@ -525,7 +525,7 @@
// Many of the error tests are badly behaved and would
// throw an exception here.
Mime stub = null;
- if (!cmd.startsWith("BAD"))
+ if (!cmd.startsWith("BAD") && (cmd.indexOf("UNREF") == -1))
stub = (Mime) service.getStub(portName, Mime.class);
if (cmd.equals(SEND_DH))
@@ -587,9 +587,9 @@
else if (cmd.equals(MIX_MIME_PARTS))
mix_mime_parts(portName, service, stub);
else if (cmd.equals(UNREF))
- unref(service, stub);
+ unref(portName, service);
else if (cmd.equals(SEND_UNREF_AP))
- send_unref_ap(portName, service, stub);
+ send_unref_ap(portName, service);
else if (cmd.equals(BAD_NO_PART))
bad_no_part(portName, service);
else if (cmd.equals(BAD_PART))
@@ -950,14 +950,62 @@
assertTrue(expected.equals(s));
}
- private void unref(WSIFService service, Mime stub) throws Exception {
+// private void unref(String portName, WSIFService service) throws Exception {
+// DataHandler dh1 = new DataHandler(new FileDataSource(flatfileLocation));
+// DataHandler dh2 =
+// new DataHandler(new FileDataSource(flatfileLocation2));
+//
+// WSIFPort port = service.getPort(portName);
+// WSIFMessage context = port.getContext();
+// context.setObjectPart("file2", dh2);
+// port.setContext(context);
+// WSIFOperation op = port.createOperation("unref");
+// WSIFMessage in = op.createInputMessage();
+// WSIFMessage out = op.createOutputMessage();
+// WSIFMessage fault = op.createFaultMessage();
+// in.setObjectPart("file", dh1);
+//
+// boolean success = op.executeRequestResponseOperation(in, out, fault);
+// assertTrue(success);
+//
+// String buff = (String) (out.getObjectPart("buff"));
+// assertTrue(compareFiles(flatfileLocation, buff));
+// }
+//
+// private void send_unref_ap(String portName, WSIFService service)
+// throws Exception {
+// DataHandler dh1 = new DataHandler(new FileDataSource(flatfileLocation));
+// DataHandler dh2 =
+// new DataHandler(new FileDataSource(flatfileLocation2));
+// AttachmentPart ap = new AttachmentPart(dh2);
+// ap.setContentLocation("peculiar");
+//
+// WSIFPort port = service.getPort(portName);
+// WSIFMessage context = port.getContext();
+// context.setObjectPart("file2", ap);
+// port.setContext(context);
+// WSIFOperation op = port.createOperation("unref");
+// WSIFMessage in = op.createInputMessage();
+// WSIFMessage out = op.createOutputMessage();
+// WSIFMessage fault = op.createFaultMessage();
+// in.setObjectPart("file", dh1);
+//
+// boolean success = op.executeRequestResponseOperation(in, out, fault);
+// assertTrue(success);
+//
+// String buff = (String) (out.getObjectPart("buff"));
+// assertTrue(compareFiles(flatfileLocation, buff));
+// }
+
+ private void unref(String portName, WSIFService service) throws Exception {
DataHandler dh1 = new DataHandler(new FileDataSource(flatfileLocation));
DataHandler dh2 = new DataHandler(new FileDataSource(flatfileLocation2));
+ Mime stub = (Mime) service.getStub(portName, Mime.class);
String buff = stub.unref(dh1, dh2);
assertTrue(compareFiles(flatfileLocation, buff));
}
- private void send_unref_ap(String portName, WSIFService service, Mime stub)
+ private void send_unref_ap(String portName, WSIFService service)
throws Exception {
DataHandler dh1 = new DataHandler(new FileDataSource(flatfileLocation));
DataHandler dh2 = new DataHandler(new FileDataSource(flatfileLocation2));
@@ -979,7 +1027,7 @@
assertTrue(compareFiles(flatfileLocation, buff));
}
-
+
/* *********************** ERRORS ********************************** */
private void bad_no_part(String portName, WSIFService service)
1.10 +1 -0 xml-axis-wsif/java/test/mime/Mime.java
Index: Mime.java
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/test/mime/Mime.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Mime.java 6 Mar 2003 10:10:27 -0000 1.9
+++ Mime.java 7 Mar 2003 14:15:58 -0000 1.10
@@ -102,6 +102,7 @@
String pos2,
DataHandler dh2,
String pos3);
+// public String unref(DataHandler dh);
public String unref(DataHandler dh1, DataHandler dh2);
public String dataHandlerToString(AttachmentPart ap);
1.76 +42 -2
xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apacheaxis/WSIFOperation_ApacheAxis.java
Index: WSIFOperation_ApacheAxis.java
===================================================================
RCS file:
/home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apacheaxis/WSIFOperation_ApacheAxis.java,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -r1.75 -r1.76
--- WSIFOperation_ApacheAxis.java 6 Mar 2003 10:10:27 -0000 1.75
+++ WSIFOperation_ApacheAxis.java 7 Mar 2003 14:15:59 -0000 1.76
@@ -767,6 +767,42 @@
}
}
+// This commented out code assumes that unreferenced attachments are in the
+// context message not the input message.
+// Map messageParts = null;
+// if (isInput)
+// messageParts = inMessageParts;
+// else
+// messageParts = outMessageParts;
+//
+// ArrayList refMimeParts = new ArrayList();
+// ArrayList unrefMimePartNames = new ArrayList();
+// Iterator itMimePartNames = mimePartNames.iterator();
+// while (itMimePartNames.hasNext()) {
+// String name = (String) itMimePartNames.next();
+// if (messageParts.containsKey(name))
+// refMimeParts.add(messageParts.get(name));
+// else
+// unrefMimePartNames.add(name);
+// }
+//
+// if (isInput) {
+// this.inputMIMEParts = refMimeParts;
+// this.inputUnrefMIMEPartNames = unrefMimePartNames;
+// } else {
+// this.outputMIMEParts = refMimeParts;
+// this.outputUnrefMIMEPartNames = unrefMimePartNames;
+// }
+//
+// // There is at most one soap:body so process it here.
+// if (soapBody != null) {
+// List soapParts = parseSoapBody(soapBody, isInput);
+// if (isInput)
+// this.inputSOAPParts = soapParts;
+// else
+// this.outputSOAPParts = soapParts;
+// }
+
ArrayList mimePartList = null;
if (mimePartNames != null && !mimePartNames.isEmpty()) {
javax.wsdl.Message m = null;
@@ -855,7 +891,7 @@
}
}
- Trc.exit();
+ Trc.exit();
}
/**
@@ -2284,10 +2320,13 @@
// instead all the referenced attachments will come first, then the
// unreferenced ones.
if (inputUnrefMIMEPartNames != null
- && !inputUnrefMIMEPartNames.isEmpty())
+ && !inputUnrefMIMEPartNames.isEmpty()) {
+// WSIFMessage context = this.wsifPort.getContext();
+
for (int i = 0; i < inputUnrefMIMEPartNames.size(); i++) {
String partName = (String) inputUnrefMIMEPartNames.get(i);
try {
+// Object value = context.getObjectPart(partName);
Object value = inMsg.getObjectPart(partName);
AttachmentPart ap = MIMEHelper.getAttachementPart(value);
call.addAttachmentPart(ap);
@@ -2299,6 +2338,7 @@
+ "' not in input WSIFMessage");
}
}
+ }
return attachments;
}