whitlock 2003/01/20 06:34:09
Modified: java/test/mime Mime.wsdl MimeTest.java Mime.java
MimeImpl.java MimeBadSoapBodyType.wsdl
DeploymentDescriptor.xml
java/src/org/apache/wsif/providers/soap/apacheaxis
WSIFOperation_ApacheAxis.java
Log:
Fix attachments ordering problems
Revision Changes Path
1.8 +82 -4 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.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Mime.wsdl 7 Jan 2003 17:49:03 -0000 1.7
+++ Mime.wsdl 20 Jan 2003 14:34:08 -0000 1.8
@@ -70,6 +70,14 @@
<part name="file" type="tns:ArrayOfBinary"/>
</message>
+ <message name="MixMimePartsMessage">
+ <part name="position1" type="xsd:string"/>
+ <part name="file1" type="tns:datahandler"/>
+ <part name="position2" type="xsd:string"/>
+ <part name="file2" type="tns:datahandler"/>
+ <part name="position3" type="xsd:string"/>
+ </message>
+
<!-- port type declns -->
<portType name="Mime">
<operation name="dataHandlerToString">
@@ -144,6 +152,14 @@
<input message="tns:ArrayOfBinaryMessage"/>
<output message="tns:StringMessage"/>
</operation>
+ <operation name="optionalSoapBody">
+ <input message="tns:DataHandlerMessage"/>
+ <output message="tns:DataHandler2Message"/>
+ </operation>
+ <operation name="mixMimeParts">
+ <input message="tns:MixMimePartsMessage"/>
+ <output message="tns:StringMessage"/>
+ </operation>
</portType>
<!-- binding declns -->
@@ -426,6 +442,12 @@
<mime:part>
<mime:content part="file" type="text/plain"/>
</mime:part>
+ <mime:part>
+ <soap:body use="encoded"
+ namespace="http://mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+ parts="" />
+ </mime:part>
</mime:multipartRelated>
</input>
<output>
@@ -445,9 +467,6 @@
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
parts="shouldBounce" />
</mime:part>
- <mime:part>
- <mime:content part="file" type="text/plain"/>
- </mime:part>
</mime:multipartRelated>
</input>
<output>
@@ -462,7 +481,10 @@
<input>
<mime:multipartRelated>
<mime:part>
- <mime:content part="file" type="text/plain"/>
+ <soap:body use="encoded"
+ namespace="http://mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+ parts="" />
</mime:part>
</mime:multipartRelated>
</input>
@@ -479,6 +501,62 @@
<mime:multipartRelated>
<mime:part>
<mime:content part="file" type="text/html"/>
+ </mime:part>
+ </mime:multipartRelated>
+ </input>
+ <output>
+ <soap:body use="encoded"
+ namespace="http://mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </output>
+ </operation>
+
+ <operation name="optionalSoapBody">
+ <soap:operation soapAction=""/>
+ <input>
+ <mime:multipartRelated>
+ <mime:part>
+ <mime:content part="file" type="text/html"/>
+ </mime:part>
+ <mime:part>
+ <!-- This soap:body deliberately doesn't have a parts=""
+ to test that the soap body defaults to excluding the
+ attachment -->
+ <soap:body use="encoded"
+ namespace="http://mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </mime:part>
+ </mime:multipartRelated>
+ </input>
+ <output>
+ <mime:multipartRelated>
+ <mime:part>
+ <mime:content part="file2" type="text/html"/>
+ </mime:part>
+ <mime:part>
+ <soap:body use="encoded"
+ namespace="http://mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </mime:part>
+ </mime:multipartRelated>
+ </output>
+ </operation>
+
+ <operation name="mixMimeParts">
+ <soap:operation soapAction=""/>
+ <input>
+ <mime:multipartRelated>
+ <mime:part>
+ <mime:content part="file1" type="text/html"/>
+ </mime:part>
+ <mime:part>
+ <mime:content part="file2" type="text/html"/>
+ </mime:part>
+ <mime:part>
+ <soap:body use="encoded"
+ namespace="http://mime/"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+ parts="position1 position2 position3"/>
</mime:part>
</mime:multipartRelated>
</input>
1.9 +81 -40 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.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- MimeTest.java 7 Jan 2003 17:49:03 -0000 1.8
+++ MimeTest.java 20 Jan 2003 14:34:09 -0000 1.9
@@ -139,8 +139,9 @@
private final static String SOAP_BODY_PARTS3 = "SOAP_BODY_PARTS3";
private final static String SOAP_BODY_PARTS4 = "SOAP_BODY_PARTS4";
private final static String ARRAY_OF_BINARY = "ARRAY-OF-BINARY";
+ private final static String OPTIONAL_SOAP_BODY = "OPTIONAL_SOAP_BODY";
+ private final static String MIX_MIME_PARTS = "MIX_MIME_PARTS";
private final static String MAP_TYPE = "MAP-TYPE";
- private final static String BAD_NO_SOAP_BODY = "BAD-NO-SOAP-BODY";
private final static String BAD_NO_PART = "BAD-NO-PART";
private final static String BAD_PART = "BAD-PART";
private final static String BAD_NESTED = "BAD-NESTED";
@@ -223,6 +224,7 @@
public void testBounceImage4Default() {
doit(BOUNCE_IMAGE4_DEFAULT, "Mime.wsdl");
}
+
public void testBounceImage4False() {
doit(BOUNCE_IMAGE4_FALSE, "Mime.wsdl");
}
@@ -311,24 +313,21 @@
doit(TYPE_STAR, "Mime.wsdl");
}
- // TODO: this one fails as the order is important, need to fix that!
- //public void testSoapBodyParts1() {
- // doit(SOAP_BODY_PARTS1, "Mime.wsdl");
- //}
-
+ public void testSoapBodyParts1() {
+ doit(SOAP_BODY_PARTS1, "Mime.wsdl");
+ }
public void testSoapBodyParts2() {
doit(SOAP_BODY_PARTS2, "Mime.wsdl");
}
- // TODO these 2 fail as the service doesn't like a null attachement
- // probably would be ok if used axis at the other end
- //public void testSoapBodyParts3() {
- // doit(SOAP_BODY_PARTS3, "Mime.wsdl");
- //}
- //public void testSoapBodyParts4() {
- // doit(SOAP_BODY_PARTS4, "Mime.wsdl");
- // }
+ public void testSoapBodyParts3() {
+ doit(SOAP_BODY_PARTS3, "Mime.wsdl");
+ }
+
+ public void testSoapBodyParts4() {
+ doit(SOAP_BODY_PARTS4, "Mime.wsdl");
+ }
public void testArrayOfBinary() {
doit(ARRAY_OF_BINARY, "Mime.wsdl");
@@ -338,12 +337,15 @@
doit(MAP_TYPE, "Mime.wsdl");
}
- /* ************ ERRORS **************** */
+ public void testOptionalSoapBody() {
+ doit(OPTIONAL_SOAP_BODY, "Mime.wsdl");
+ }
- // removed as I think this is valid to do
- //public void testBadNoSoapBody() {
- // doit(BAD_NO_SOAP_BODY, "MimeBadNoSoapBody.wsdl");
- //}
+ public void testMixMimeParts() {
+ doit(MIX_MIME_PARTS, "Mime.wsdl");
+ }
+
+ /* ************ ERRORS **************** */
public void testBadNoPart() {
doit(BAD_NO_PART, "MimeBadNoPart.wsdl");
@@ -365,10 +367,9 @@
doit(BAD_MULTIPLE_SOAP_BODIES, "MimeBadMultipleSoapBodies.wsdl");
}
- // I think this is not wrong, a mime: need not a soap:body
- //public void testBadSoapBodyType() {
- // doit(BAD_SOAP_BODY_TYPE, "MimeBadSoapBodyType.wsdl");
- //}
+ public void testBadSoapBodyType() {
+ doit(BAD_SOAP_BODY_TYPE, "MimeBadSoapBodyType.wsdl");
+ }
/**
* doit should probably do the mapTypes() but unfortunately plain text
@@ -459,8 +460,10 @@
array_of_binary(service,stub);
else if (cmd.equals(MAP_TYPE))
map_type(service,stub);
- else if (cmd.equals(BAD_NO_SOAP_BODY))
- bad_no_soap_body(service);
+ else if (cmd.equals(OPTIONAL_SOAP_BODY))
+ optional_soap_body(service,stub);
+ else if (cmd.equals(MIX_MIME_PARTS))
+ mix_mime_parts(service,stub);
else if (cmd.equals(BAD_NO_PART))
bad_no_part(service);
else if (cmd.equals(BAD_PART))
@@ -560,6 +563,9 @@
DataHandler dh2 = (DataHandler)(out.getObjectPart("file2"));
+// This commented out code displays the image, so proving that the
+// bounced image is correct.
+//
// InputStream is = dh2.getInputStream();
// byte[] bBuff = new byte[is.available()];
// is.read(bBuff);
@@ -682,8 +688,8 @@
WSIFMessage in = op.createInputMessage();
WSIFMessage out = op.createOutputMessage();
WSIFMessage fault = op.createFaultMessage();
- in.setObjectPart("file",dh);
in.setBooleanPart("shouldBounce",true);
+ in.setObjectPart("file",dh);
boolean success = op.executeRequestResponseOperation(in,out,fault);
assertTrue(success);
@@ -756,23 +762,45 @@
assertTrue(compareFiles(flatfileLocation, buff));
}
- /* *********************** ERRORS ********************************** */
-
- private void bad_no_soap_body(WSIFService service)
+ private void optional_soap_body(WSIFService service, Mime stub)
throws Exception {
- boolean exceptionCaught = false;
- try {
- Mime stub = (Mime) service.getStub(portName, Mime.class);
- stub.badNoSoapBody(
- new DataHandler(new FileDataSource(imageLocation)));
- } catch (WSIFException we) {
- exceptionCaught = true;
- System.out.println("Expected exception=" + we);
- we.printStackTrace();
- }
- assertTrue(exceptionCaught);
+ DataHandler dh1 = new DataHandler(new FileDataSource(imageLocation));
+ DataHandler dh2 = stub.optionalSoapBody(dh1);
+ assertTrue(compareFiles(dh1,dh2));
}
+ private void mix_mime_parts(WSIFService service, Mime stub)
+ throws Exception
+ {
+ DataHandler dh1 = new DataHandler(new FileDataSource(flatfileLocation));
+ DataHandler dh2 =
+ new DataHandler(new FileDataSource(flatfileLocation2));
+ String position1 = "Position One";
+ String position2 = "Position Two";
+ String position3 = "Position Three";
+
+ WSIFPort port = service.getPort(portName);
+ WSIFOperation op = port.createOperation("mixMimeParts");
+ WSIFMessage in = op.createInputMessage();
+ WSIFMessage out = op.createOutputMessage();
+ WSIFMessage fault = op.createFaultMessage();
+ in.setObjectPart("position1", position1);
+ in.setObjectPart("file1", dh1);
+ in.setObjectPart("position2", position2);
+ in.setObjectPart("file2", dh2);
+ in.setObjectPart("position3", position3);
+
+ boolean success = op.executeRequestResponseOperation(in, out, fault);
+ assertTrue(success);
+
+ String s = (String) (out.getObjectPart("buff"));
+ String expected =
+ position1 + readFile(dh1) + position2 + readFile(dh2) + position3;
+ assertTrue(expected.equals(s));
+ }
+
+ /* *********************** ERRORS ********************************** */
+
private void bad_no_part(WSIFService service) throws Exception {
DataHandler dh = new DataHandler(new FileDataSource(flatfileLocation));
boolean exceptionCaught = false;
@@ -966,6 +994,19 @@
is1.close();
if (null != is2)
is2.close();
+ }
+ }
+
+ private String readFile(DataHandler dh) {
+ try {
+ InputStream is = dh.getInputStream();
+ byte[] bBuff = new byte[is.available()];
+ is.read(bBuff);
+ String sBuff = new String(bBuff);
+ return sBuff;
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
+ return "";
}
}
}
1.7 +8 -2 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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Mime.java 7 Jan 2003 17:49:03 -0000 1.6
+++ Mime.java 20 Jan 2003 14:34:09 -0000 1.7
@@ -88,13 +88,19 @@
public String noContent(String s);
public String typeStar(DataHandler dh);
- public String soapBodyParts1(DataHandler dh, boolean shouldBounce);
+ public String soapBodyParts1(boolean shouldBounce, DataHandler dh);
public String soapBodyParts2(DataHandler dh);
public String soapBodyParts3(boolean shouldBounce);
public String soapBodyParts4();
public String arrayOfBinary(DataHandler dh);
+ public DataHandler optionalSoapBody(DataHandler dh);
+ public String mixMimeParts(
+ String pos1,
+ DataHandler dh1,
+ String pos2,
+ DataHandler dh2,
+ String pos3);
- public void badNoSoapBody(DataHandler dh) throws Exception;
public String badNoPart(DataHandler dh) throws Exception;
public String badPart(DataHandler dh) throws Exception;
public String badNested(DataHandler dh) throws Exception;
1.7 +22 -3 xml-axis-wsif/java/test/mime/MimeImpl.java
Index: MimeImpl.java
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/test/mime/MimeImpl.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- MimeImpl.java 7 Jan 2003 17:49:03 -0000 1.6
+++ MimeImpl.java 20 Jan 2003 14:34:09 -0000 1.7
@@ -130,6 +130,9 @@
byte[] bBuff = new byte[is.available()];
is.read(bBuff);
+// This commented out code displays the image
+// to check that it is correct.
+//
// Image im = new ImageIcon(bBuff).getImage();
// WSIFFrame.display(im, "Backend image");
// int t = 0;
@@ -204,7 +207,7 @@
return dataHandlerToString(dh);
}
- public String soapBodyParts1(DataHandler dh, boolean shouldBounce) {
+ public String soapBodyParts1(boolean shouldBounce, DataHandler dh) {
return "1";
}
@@ -224,9 +227,25 @@
return dataHandlerToString(dh);
}
+ public DataHandler optionalSoapBody(DataHandler ds) {
+ return bounceImage(ds);
+ }
+
+ public String mixMimeParts(
+ String pos1,
+ DataHandler dh1,
+ String pos2,
+ DataHandler dh2,
+ String pos3)
+ {
+ return pos1
+ + dataHandlerToString(dh1)
+ + pos2
+ + dataHandlerToString(dh2)
+ + pos3;
+ }
+
/* ******************* ERRORS *********************** */
-
- public void badNoSoapBody(DataHandler dh) {}
public String badNoPart(DataHandler dh) {
return dataHandlerToString(dh);
1.3 +2 -1 xml-axis-wsif/java/test/mime/MimeBadSoapBodyType.wsdl
Index: MimeBadSoapBodyType.wsdl
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/test/mime/MimeBadSoapBodyType.wsdl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MimeBadSoapBodyType.wsdl 7 Dec 2002 12:33:49 -0000 1.2
+++ MimeBadSoapBodyType.wsdl 20 Jan 2003 14:34:09 -0000 1.3
@@ -39,7 +39,8 @@
<mime:content part="file" type="image/jpeg"/>
<soap:body use="encoded"
namespace="http://mime/"
- encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+ parts=""/>
</mime:part>
<mime:part>
<mime:content part="file" type="text/plain"/>
1.6 +7 -1 xml-axis-wsif/java/test/mime/DeploymentDescriptor.xml
Index: DeploymentDescriptor.xml
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/test/mime/DeploymentDescriptor.xml,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- DeploymentDescriptor.xml 7 Dec 2002 12:33:49 -0000 1.5
+++ DeploymentDescriptor.xml 20 Jan 2003 14:34:09 -0000 1.6
@@ -2,7 +2,13 @@
id="http://mime/">
<isd:provider type="java"
scope="Application"
- methods="dataHandlerToString stringToDataHandler plainTextToString
stringToPlainText bounceImage bounceImage2 bounceImage4 orMultiMimeParts
andMultiMimeParts noContent typeStar soapBodyParts1 soapBodyParts2 soapBodyParts3
soapBodyParts4 arrayOfBinary badNoSoapBody badNoPart badPart badNested badMixSoapMime
badMultipleSoapBodies badSoapBodyType">
+ methods="dataHandlerToString stringToDataHandler plainTextToString
+ stringToPlainText bounceImage bounceImage2 bounceImage4
+ orMultiMimeParts andMultiMimeParts noContent typeStar
+ soapBodyParts1 soapBodyParts2 soapBodyParts3
soapBodyParts4
+ arrayOfBinary optionalSoapBody mixMimeParts
+ badNoSoapBody badNoPart badPart badNested badMixSoapMime
+ badMultipleSoapBodies badSoapBodyType">
<isd:java class="mime.MimeImpl" static="false"/>
</isd:provider>
1.66 +175 -81
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.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- WSIFOperation_ApacheAxis.java 20 Jan 2003 13:53:55 -0000 1.65
+++ WSIFOperation_ApacheAxis.java 20 Jan 2003 14:34:09 -0000 1.66
@@ -59,6 +59,7 @@
import java.rmi.RemoteException;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -634,7 +635,7 @@
if (p == null) {
throw new WSIFException("Part '" +
partName +
- "' in soap:body parts not in message" + m);
+ "' in soap:body parts not in message " + m);
}
// as there can be multiple mime:content elements which
// specify a coice of types (TODO: which wsif ignores for now)
@@ -663,7 +664,8 @@
Trc.entry(this, mimeMultipart);
ArrayList mimePartNames = new ArrayList();
- boolean soapBodyFound = false;
+ SOAPBody soapBody = null;
+
Operation op = bindingOperation.getOperation();
Map mapInParts = op.getInput().getMessage().getParts();
Map mapOutParts =
@@ -730,17 +732,14 @@
mimePartNames.add(partName);
} else if (nextChild instanceof SOAPBody) {
- if (soapBodyFound) {
+ if (soapBody!=null) {
throw new WSIFException(
"Multiple soap:body
tags found in a "
+
"mime:multipartRelated. Operation="
+ getName());
}
- if (((SOAPBody)nextChild).getParts()
== null) {
-
((SOAPBody)nextChild).setParts(new ArrayList());
- }
-
- soapBodyFound = true;
+ soapBody = (SOAPBody)nextChild;
+
containsSoapBody = true;
if (containsMimeContent)
throw new WSIFException(
@@ -748,14 +747,6 @@
+ "contains a
soap:body. Operation="
+ getName());
- List soapParts =
- parseSoapBody((SOAPBody)
nextChild, isInput);
-
- if (isInput) {
- this.inputSOAPParts =
soapParts;
- } else {
- this.outputSOAPParts =
soapParts;
- }
} else if (nextChild instanceof
MIMEMultipartRelated) {
throw new WSIFException(
"WSIF does not support nesting
mime:multipartRelated "
@@ -770,14 +761,45 @@
}
}
-// TODO??? I don't understand what this was doing?
-// if (mimePartNames != null && !mimePartNames.isEmpty()) {
-// List oldMimePartNames = getMimePartNames();
-// if (oldMimePartNames == null || oldMimePartNames.isEmpty())
-// setMimePartNames(mimePartNames);
-// else
-// oldMimePartNames.addAll(mimePartNames);
-// }
+ // There is at most one soap:body so process it here.
+ if (soapBody != null)
+ {
+ List soapBodyParts = soapBody.getParts();
+ if (soapBodyParts == null && !mimePartNames.isEmpty())
+ {
+ /* In the WSDL (containing attachments and non-attachment
+ * parts), if there is a soap:body that does not have
+ * the parts attribute, which parts should the soap body
+ * contain? The WSDL spec is not clear so this code
+ * fixes the soap body to contain only the non-attachment
+ * parts, which is the kinder option. The alternative which
+ * is making the soap body contain all the parts (so duplicating
+ * the attachments) is cruel since this is probably not
+ * what the backend is expecting.
+ */
+ Map soapParts;
+ if (isInput)
+ soapParts = mapInParts;
+ else
+ soapParts = mapOutParts;
+
+ if (soapParts != null && !soapParts.isEmpty())
+ {
+ ArrayList nonMimeParts =
+ new ArrayList(
+ Arrays.asList(soapParts.keySet().toArray()));
+ nonMimeParts.removeAll(
+ Arrays.asList(soapParts.keySet().toArray()));
+ soapBody.setParts(nonMimeParts);
+ }
+ }
+
+ List soapParts = parseSoapBody(soapBody, isInput);
+ if (isInput)
+ this.inputSOAPParts = soapParts;
+ else
+ this.outputSOAPParts = soapParts;
+ }
if (mimePartNames != null && !mimePartNames.isEmpty()) {
javax.wsdl.Message m = null;
@@ -1555,29 +1577,57 @@
soapParts = inputSOAPParts;
}
- // setup the input SOAP parts
- for (int i = 0; i < soapParts.size(); i++) {
- Part p = (Part) soapParts.get(i);
- String partName = p.getName();
- if (!inJmsProps.containsKey(partName)) {
- if (WSIFAXISConstants.STYLE_DOCUMENT.equals(operationStyle)) {
- QName qn = p.getElementName();
- if (qn != null) {
- partName = qn.getLocalPart();
- }
- }
- QName name = new QName(inputNamespace, partName);
- QName type = getPartType(p);
- call.addParameter(name, type, ParameterMode.IN);
- }
- }
- // setup the input MIME parts
- for (int i = 0; i < inputMIMEParts.size(); i++) {
- Part p = (Part) inputMIMEParts.get(i);
- QName name = new QName(inputNamespace, p.getName());
- QName type = getPartType(p);
- call.addParameter(name, type, ParameterMode.IN);
- }
+ /* If there are no attachments take the part ordering from the
+ * soap:body. If there are attachments then the soap:body will
+ * not include the attachments, so take the part ordering from
+ * the ordering of the parts in the original message.
+ */
+ if (inputMIMEParts.isEmpty())
+ {
+ // setup the input SOAP parts
+ for (int i = 0; i < soapParts.size(); i++)
+ {
+ Part p = (Part) soapParts.get(i);
+ String partName = p.getName();
+ if (!inJmsProps.containsKey(partName))
+ {
+ if (WSIFAXISConstants
+ .STYLE_DOCUMENT
+ .equals(operationStyle))
+ {
+ QName qn = p.getElementName();
+ if (qn != null)
+ {
+ partName = qn.getLocalPart();
+ }
+ }
+ QName name = new QName(inputNamespace, partName);
+ QName type = getPartType(p);
+ call.addParameter(name, type, ParameterMode.IN);
+ }
+ }
+ }
+ else
+ {
+ // This order should include both the attachments and
+ // the non-attachments.
+ List order =
+ portTypeOperation.getInput().getMessage().getOrderedParts(null);
+ Iterator it = order.iterator();
+ while (it.hasNext())
+ {
+ Part p = (Part) it.next();
+
+ // Only add the part if it hasn't been excluded by the
+ // soap:body parts="?"
+ if (inputMIMEParts.contains(p) || soapParts.contains(p))
+ {
+ QName name = new QName(inputNamespace, p.getName());
+ QName type = getPartType(p);
+ call.addParameter(name, type, ParameterMode.IN);
+ }
+ }
+ }
// style=wrapped uses the unwrapped parts
if (WSIFAXISConstants.AXIS_STYLE_WRAPPED.equals(operationStyle)) {
@@ -2064,42 +2114,86 @@
soapParts = inputSOAPParts;
}
- for (int i = 0; i < soapParts.size(); i++) {
- Part p = (Part) soapParts.get(i);
- String partName = p.getName();
- Object value;
- try {
- value = inMsg.getObjectPart(partName);
- } catch (WSIFException e) {
- Trc.ignoredException(e);
- value = null; // missing part values default to null
- }
- if (inJmsProps.containsKey(partName) && dest != null) {
- String name = (String) (inJmsProps.get(partName));
- if (!timeoutProperty(dest, name, value)) {
- dest.setProperty(name, value);
- }
- } else {
- axisInputs.add(value);
- }
-
- }
-
- /* MIME parts are done seperatley for messaging
- * using addAttachmentPart (see invokeAXISMessaging)
+ /* If there are no attachments take the part ordering from the
+ * soap:body. If there are attachments then the soap:body will
+ * not include the attachments, so take the part ordering from
+ * the ordering of the parts in the original message.
*/
- if (!WSIFAXISConstants.AXIS_STYLE_MESSAGE.equals(operationStyle)) {
- for (int i = 0; i < inputMIMEParts.size(); i++) {
- Part p = (Part) inputMIMEParts.get(i);
+ if (inputMIMEParts.isEmpty())
+ {
+ for (int i = 0; i < soapParts.size(); i++)
+ {
+ Part p = (Part) soapParts.get(i);
String partName = p.getName();
- try {
- axisInputs.add(inMsg.getObjectPart(partName));
- } catch (WSIFException e) {
- Trc.ignoredException(e);
- axisInputs.add(null); // missing part values
default to null
- }
- }
- }
+ Object value;
+ try
+ {
+ value = inMsg.getObjectPart(partName);
+ }
+ catch (WSIFException e)
+ {
+ Trc.ignoredException(e);
+ value = null; // missing part values default to null
+ }
+ if (inJmsProps.containsKey(partName) && dest != null)
+ {
+ String name = (String) (inJmsProps.get(partName));
+ if (!timeoutProperty(dest, name, value))
+ {
+ dest.setProperty(name, value);
+ }
+ }
+ else
+ {
+ axisInputs.add(value);
+ }
+
+ }
+ }
+ else
+ {
+ // This order includes both the attachments and
+ // the non-attachments.
+ List order =
+ portTypeOperation.getInput().getMessage().getOrderedParts(null);
+ Iterator it = order.iterator();
+ while (it.hasNext())
+ {
+ Part p = (Part) it.next();
+ String partName = p.getName();
+
+ // Only add the part if it hasn't been excluded by the
+ // soap:body parts="?"
+ if (soapParts.contains(p)
+ || (inputMIMEParts.contains(p)
+ && !WSIFAXISConstants.AXIS_STYLE_MESSAGE.equals(
+ operationStyle)))
+ {
+ Object value;
+ try
+ {
+ value = inMsg.getObjectPart(partName);
+ }
+ catch (WSIFException e)
+ {
+ Trc.ignoredException(e);
+ value = null; // missing part values default to null
+ }
+ if (inJmsProps.containsKey(partName) && dest != null)
+ {
+ String name = (String) (inJmsProps.get(partName));
+ if (!timeoutProperty(dest, name, value))
+ {
+ dest.setProperty(name, value);
+ }
+ }
+ else
+ {
+ axisInputs.add(value);
+ }
+ }
+ }
+ }
return axisInputs.toArray();
}