whitlock 2002/11/19 01:41:25 Modified: java/test/mime MimeTest.java Mime.wsdl DeploymentDescriptor.xml MimeImpl.java Mime.java java/src/org/apache/wsif/providers/soap/apacheaxis WSIFPort_ApacheAxis.java Added: java/test/mime MimeBadMultipleSoapBodies.wsdl MimeBadSoapBodyType.wsdl MimeBadNested.wsdl MimeBadNoPart.wsdl MimeBadNoSoapBody.wsdl MimeBadMixSoapMime.wsdl MimeBadPart.wsdl Removed: java/test/mime MimeErrors.wsdl Log: More mime fixes Revision Changes Path 1.4 +121 -118 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.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- MimeTest.java 14 Nov 2002 13:49:34 -0000 1.3 +++ MimeTest.java 19 Nov 2002 09:41:24 -0000 1.4 @@ -108,7 +108,6 @@ public class MimeTest extends TestCase { private final static String wsdlPath = TestUtilities.getWsdlPath("java\\test\\mime"); - private final static String wsdlLocation = wsdlPath + "Mime.wsdl"; private final static String imageLocation = wsdlPath + "axis.jpg"; private final static String flatfileLocation = wsdlPath + "test.txt"; private final static String flatfileLocation2 = wsdlPath + "test2.txt"; @@ -139,10 +138,10 @@ private final static String SOAP_BODY_PARTS2 = "SOAP_BODY_PARTS2"; 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 MAP_TYPE = "MAP-TYPE"; private final static String BAD_NO_SOAP_BODY = "BAD-NO-SOAP-BODY"; - private final static String BAD_NO_TYPE = "BAD-NO-TYPE"; private final static String BAD_NO_PART = "BAD-NO-PART"; - private final static String BAD_TYPE = "BAD-TYPE"; private final static String BAD_PART = "BAD-PART"; private final static String BAD_NESTED = "BAD-NESTED"; private final static String BAD_MIX_SOAP_MIME = "BAD-MIX-SOAP-MIME"; @@ -189,41 +188,41 @@ } public void testSendHandler() { - doit(SEND_DH); + doit(SEND_DH, "Mime.wsdl"); } public void testReceiveHandler() { - doit(RECEIVE_DH); + doit(RECEIVE_DH, "Mime.wsdl"); } public void testSendPlainText() { - doit(SEND_PLAINTEXT); + doit(SEND_PLAINTEXT, "Mime.wsdl"); } /* * public void testReceivePlainText() { - * doit(RECEIVE_PLAINTEXT); + * doit(RECEIVE_PLAINTEXT, "Mime.wsdl"); * } */ public void testBounceImage() { - doit(BOUNCE_IMAGE); + doit(BOUNCE_IMAGE, "Mime.wsdl"); } public void testBounceImage2() { - doit(BOUNCE_IMAGE2); + doit(BOUNCE_IMAGE2, "Mime.wsdl"); } public void testBounceImage3() { - doit(BOUNCE_IMAGE3); + doit(BOUNCE_IMAGE3, "Mime.wsdl"); } public void testBounceImage4Default() { - doit(BOUNCE_IMAGE4_DEFAULT); + doit(BOUNCE_IMAGE4_DEFAULT, "Mime.wsdl"); } public void testBounceImage4False() { - doit(BOUNCE_IMAGE4_FALSE); + doit(BOUNCE_IMAGE4_FALSE, "Mime.wsdl"); } /* @@ -231,7 +230,7 @@ * parameters to be passed in. * * public void testBounceImage4Null() { - * doit(BOUNCE_IMAGE4_NULL); + * doit(BOUNCE_IMAGE4_NULL, "Mime.wsdl"); * } */ @@ -247,19 +246,19 @@ /* * public void testSendSource() { - * doit(SEND_SOURCE); + * doit(SEND_SOURCE, "Mime.wsdl"); * } * * public void testReceiveSource() { - * doit(RECEIVE_SOURCE); + * doit(RECEIVE_SOURCE, "Mime.wsdl"); * } * * public void testSendMimeMultipart() { - * doit(SEND_MIMEMULTIPART); + * doit(SEND_MIMEMULTIPART, "Mime.wsdl"); * } * * public void testReceiveMimeMultipart() { - * doit(RECEIVE_MIMEMULTIPART); + * doit(RECEIVE_MIMEMULTIPART, "Mime.wsdl"); * } */ @@ -276,91 +275,93 @@ * the async tests) because it fails. * * public void testJmsSend() { - * doit("SOAPJMSPort", SEND); + * doit("SOAPJMSPort", SEND, "Mime.wsdl"); * } */ public void testOrMultiParts1() { - doit(OR_MULTIPARTS1); + doit(OR_MULTIPARTS1, "Mime.wsdl"); } public void testOrMultiParts2() { - doit(OR_MULTIPARTS2); + doit(OR_MULTIPARTS2, "Mime.wsdl"); } public void testAndMultiParts() { - doit(AND_MULTIPARTS); + doit(AND_MULTIPARTS, "Mime.wsdl"); } /* * public void testMultiOutParts() { - * doit(MULTI_OUT_PARTS); + * doit(MULTI_OUT_PARTS, "Mime.wsdl"); * } * * public void testMultiInoutParts() { - * doit(MULTI_INOUT_PARTS); + * doit(MULTI_INOUT_PARTS, "Mime.wsdl"); * } */ public void testNoContent() { - doit(NO_CONTENT); + doit(NO_CONTENT, "Mime.wsdl"); } public void testTypeStar() { - doit(TYPE_STAR); + doit(TYPE_STAR, "Mime.wsdl"); } public void testSoapBodyParts1() { - doit(SOAP_BODY_PARTS1); + doit(SOAP_BODY_PARTS1, "Mime.wsdl"); } public void testSoapBodyParts2() { - doit(SOAP_BODY_PARTS2); + doit(SOAP_BODY_PARTS2, "Mime.wsdl"); } public void testSoapBodyParts3() { - doit(SOAP_BODY_PARTS3); + doit(SOAP_BODY_PARTS3, "Mime.wsdl"); } public void testSoapBodyParts4() { - doit(SOAP_BODY_PARTS4); + doit(SOAP_BODY_PARTS4, "Mime.wsdl"); + } + + public void testArrayOfBinary() { + doit(ARRAY_OF_BINARY, "Mime.wsdl"); + } + + public void testMapType() { + doit(MAP_TYPE, "Mime.wsdl"); + } + + /* ************ ERRORS **************** */ + + public void testBadNoSoapBody() { + doit(BAD_NO_SOAP_BODY, "MimeBadNoSoapBody.wsdl"); + } + + public void testBadNoPart() { + doit(BAD_NO_PART, "MimeBadNoPart.wsdl"); + } + + public void testBadPart() { + doit(BAD_PART, "MimeBadPart.wsdl"); + } + + public void testBadNested() { + doit(BAD_NESTED, "MimeBadNested.wsdl"); + } + + public void testBadMixSoapMime() { + doit(BAD_MIX_SOAP_MIME, "MimeBadMixSoapMime.wsdl"); + } + + public void testBadMultipleSoapBodies() { + doit(BAD_MULTIPLE_SOAP_BODIES, "MimeBadMultipleSoapBodies.wsdl"); + } + + public void testBadSoapBodyType() { + doit(BAD_SOAP_BODY_TYPE, "MimeBadSoapBodyType.wsdl"); } -// -// public void testBadNoSoapBody() { -// doit(BAD_NO_SOAP_BODY); -// } -// -// public void testBadNoType() { -// doit(BAD_NO_TYPE); -// } -// -// public void testBadNoPart() { -// doit(BAD_NO_PART); -// } -// -// public void testBadType() { -// doit(BAD_TYPE); -// } -// -// public void testBadPart() { -// doit(BAD_PART); -// } -// -// public void testBadNested() { -// doit(BAD_NESTED); -// } -// -// public void testBadMixSoapMime() { -// doit(BAD_MIX_SOAP_MIME); -// } -// -// public void testBadMultipleSoapBodies() { -// doit(BAD_MULTIPLE_SOAP_BODIES); -// } -// -// public void testBadSoapBodyType() { -// doit(BAD_SOAP_BODY_TYPE); -// } /** * doit should probably do the mapTypes() but unfortunately plain text @@ -372,7 +373,7 @@ * DataHandler, not a String. So be careful where mapTypes(plaintext,String) * is done. */ - private void doit(String cmd) { + private void doit(String cmd, String wsdl) { if (!TestUtilities.areWeTesting("mime")) return; @@ -385,13 +386,17 @@ WSIFServiceFactory factory = WSIFServiceFactory.newInstance(); WSIFService service = factory.getService( - wsdlLocation, + wsdlPath + wsdl, null, null, "http://mime/", "Mime"); - Mime stub = (Mime) service.getStub(portName, Mime.class); + // Many of the error tests are badly behaved and would + // throw an exception here. + Mime stub = null; + if (!cmd.startsWith("BAD")) + stub = (Mime) service.getStub(portName, Mime.class); if (cmd.equals(SEND_DH)) send_dh(service,stub); @@ -443,24 +448,24 @@ soap_body_parts3(service,stub); else if (cmd.equals(SOAP_BODY_PARTS4)) soap_body_parts4(service,stub); + else if (cmd.equals(ARRAY_OF_BINARY)) + 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,stub); - else if (cmd.equals(BAD_NO_TYPE)) - bad_no_type(service,stub); + bad_no_soap_body(service); else if (cmd.equals(BAD_NO_PART)) - bad_no_part(service,stub); + bad_no_part(service); else if (cmd.equals(BAD_PART)) - bad_part(service,stub); - else if (cmd.equals(BAD_TYPE)) - bad_type(service,stub); + bad_part(service); else if (cmd.equals(BAD_NESTED)) - bad_nested(service,stub); + bad_nested(service); else if (cmd.equals(BAD_MIX_SOAP_MIME)) - bad_mix_soap_mime(service,stub); + bad_mix_soap_mime(service); else if (cmd.equals(BAD_MULTIPLE_SOAP_BODIES)) - bad_multiple_soap_bodies(service,stub); + bad_multiple_soap_bodies(service); else if (cmd.equals(BAD_SOAP_BODY_TYPE)) - bad_soap_body_type(service,stub); + bad_soap_body_type(service); else assertTrue(false); @@ -480,20 +485,12 @@ } private void send_dh(WSIFService service, Mime stub) throws Exception { - service.mapType( - new QName("http://mime/", "datahandler"), - DataHandler.class); - DataHandler dh = new DataHandler(new FileDataSource(flatfileLocation)); String buff = stub.dataHandlerToString(dh); assertTrue(compareFiles(flatfileLocation, buff)); } private void receive_dh(WSIFService service, Mime stub) throws Exception { - service.mapType( - new QName("http://mime/", "datahandler"), - DataHandler.class); - DataHandler dh = stub.stringToDataHandler(rhyme[0]); assertTrue(compareFiles(dh, rhyme[0])); } @@ -736,113 +733,119 @@ assertTrue("4".equals(s)); } + private void array_of_binary(WSIFService service, Mime stub) throws Exception { + DataHandler dh = new DataHandler(new FileDataSource(flatfileLocation)); + String buff = stub.arrayOfBinary(dh); + assertTrue(compareFiles(flatfileLocation, buff)); + } + + private void map_type(WSIFService service, Mime stub) throws Exception { + service.mapType( + new QName("http://mime/", "datahandler"), + DataHandler.class); + + DataHandler dh = new DataHandler(new FileDataSource(flatfileLocation)); + String buff = stub.dataHandlerToString(dh); + assertTrue(compareFiles(flatfileLocation, buff)); + } + /* *********************** ERRORS ********************************** */ - private void bad_no_soap_body(WSIFService service, Mime stub) + private void bad_no_soap_body(WSIFService service) 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); } - private void bad_no_type(WSIFService service, Mime stub) throws Exception { - DataHandler dh = new DataHandler(new FileDataSource(flatfileLocation)); - boolean exceptionCaught = false; - try { - String buff = stub.badNoType(dh); - } catch (WSIFException we) { - exceptionCaught = true; - System.out.println("Expected exception="+we); - } - assertTrue(exceptionCaught); - } - - private void bad_no_part(WSIFService service, Mime stub) throws Exception { + private void bad_no_part(WSIFService service) throws Exception { DataHandler dh = new DataHandler(new FileDataSource(flatfileLocation)); boolean exceptionCaught = false; try { + Mime stub = (Mime) service.getStub(portName, Mime.class); String buff = stub.badNoPart(dh); } catch (WSIFException we) { exceptionCaught = true; System.out.println("Expected exception="+we); + we.printStackTrace(); } assertTrue(exceptionCaught); } - private void bad_part(WSIFService service, Mime stub) throws Exception { + private void bad_part(WSIFService service) throws Exception { DataHandler dh = new DataHandler(new FileDataSource(flatfileLocation)); boolean exceptionCaught = false; try { + Mime stub = (Mime) service.getStub(portName, Mime.class); String buff = stub.badPart(dh); } catch (WSIFException we) { exceptionCaught = true; System.out.println("Expected exception="+we); + we.printStackTrace(); } assertTrue(exceptionCaught); } - private void bad_type(WSIFService service, Mime stub) throws Exception { - DataHandler dh = new DataHandler(new FileDataSource(flatfileLocation)); - boolean exceptionCaught = false; - try { - String buff = stub.badType(dh); - } catch (WSIFException we) { - exceptionCaught = true; - System.out.println("Expected exception="+we); - } - assertTrue(exceptionCaught); - } - - private void bad_nested(WSIFService service, Mime stub) throws Exception { + private void bad_nested(WSIFService service) throws Exception { DataHandler dh = new DataHandler(new FileDataSource(flatfileLocation)); boolean exceptionCaught = false; try { + Mime stub = (Mime) service.getStub(portName, Mime.class); stub.badNested(dh); } catch (WSIFException we) { exceptionCaught = true; System.out.println("Expected exception="+we); + we.printStackTrace(); } assertTrue(exceptionCaught); } - private void bad_mix_soap_mime(WSIFService service, Mime stub) throws Exception { + private void bad_mix_soap_mime(WSIFService service) throws Exception { DataHandler dh = new DataHandler(new FileDataSource(flatfileLocation)); boolean exceptionCaught = false; try { + Mime stub = (Mime) service.getStub(portName, Mime.class); String buff = stub.badMixSoapMime(dh); } catch (WSIFException we) { exceptionCaught = true; System.out.println("Expected exception="+we); + we.printStackTrace(); } assertTrue(exceptionCaught); } - private void bad_multiple_soap_bodies(WSIFService service, Mime stub) throws Exception { + private void bad_multiple_soap_bodies(WSIFService service) throws Exception { DataHandler dh = new DataHandler(new FileDataSource(flatfileLocation)); boolean exceptionCaught = false; try { + Mime stub = (Mime) service.getStub(portName, Mime.class); String buff = stub.badMultipleSoapBodies(dh); } catch (WSIFException we) { exceptionCaught = true; System.out.println("Expected exception="+we); + we.printStackTrace(); } assertTrue(exceptionCaught); } - private void bad_soap_body_type(WSIFService service, Mime stub) throws Exception { + private void bad_soap_body_type(WSIFService service) throws Exception { DataHandler dh = new DataHandler(new FileDataSource(flatfileLocation)); boolean exceptionCaught = false; try { + Mime stub = (Mime) service.getStub(portName, Mime.class); String buff = stub.badSoapBodyType(dh); } catch (WSIFException we) { exceptionCaught = true; System.out.println("Expected exception="+we); + we.printStackTrace(); } assertTrue(exceptionCaught); } 1.4 +44 -2 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.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Mime.wsdl 14 Nov 2002 13:49:34 -0000 1.3 +++ Mime.wsdl 19 Nov 2002 09:41:24 -0000 1.4 @@ -1,7 +1,5 @@ <?xml version="1.0" ?> -<!-- Currently missing complex types and type="application/octet-stream" ??? --> - <definitions targetNamespace="http://mime/" xmlns:tns="http://mime/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" @@ -12,6 +10,21 @@ xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns="http://schemas.xmlsoap.org/wsdl/"> + <!-- type defs --> + <types> + <xsd:schema + targetNamespace="http://mime/" + xmlns:xsd="http://www.w3.org/1999/XMLSchema"> + <xsd:complexType name="ArrayOfBinary"> + <complexContent> + <restriction base="soapenc:Array"> + <attribute ref="soapenc:arrayType" arrayType="xsd:binary[]"/> + </restriction> + </complexContent> + </xsd:complexType> + </xsd:schema> + </types> + <message name="DataHandlerMessage"> <part name="file" type="tns:datahandler"/> </message> @@ -53,6 +66,10 @@ <message name="NullMessage"> </message> + <message name="ArrayOfBinaryMessage"> + <part name="file" type="tns:ArrayOfBinary"/> + </message> + <!-- port type declns --> <portType name="Mime"> <operation name="dataHandlerToString"> @@ -123,6 +140,10 @@ <input message="tns:BounceImage4Message"/> <output message="tns:StringMessage"/> </operation> + <operation name="arrayOfBinary"> + <input message="tns:ArrayOfBinaryMessage"/> + <output message="tns:StringMessage"/> + </operation> </portType> <!-- binding declns --> @@ -529,6 +550,27 @@ </mime:part> <mime:part> <mime:content part="file" type="text/plain"/> + </mime:part> + </mime:multipartRelated> + </input> + <output> + <soap:body use="encoded" + namespace="http://mime/" + encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> + </output> + </operation> + + <operation name="arrayOfBinary"> + <soap:operation soapAction=""/> + <input> + <mime:multipartRelated> + <mime:part> + <soap:body use="encoded" + namespace="http://mime/" + encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> + </mime:part> + <mime:part> + <mime:content part="file" type="text/html"/> </mime:part> </mime:multipartRelated> </input> 1.4 +1 -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.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- DeploymentDescriptor.xml 14 Nov 2002 13:49:34 -0000 1.3 +++ DeploymentDescriptor.xml 19 Nov 2002 09:41:25 -0000 1.4 @@ -2,7 +2,7 @@ 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 badNoSoapBody badNoType badNoPart badType badPart badNested badMixSoapMime badMultipleSoapBodies badSoapBodyType"> + methods="dataHandlerToString stringToDataHandler plainTextToString stringToPlainText bounceImage bounceImage2 bounceImage4 orMultiMimeParts andMultiMimeParts noContent typeStar soapBodyParts1 soapBodyParts2 soapBodyParts3 soapBodyParts4 arrayOfBinary badNoSoapBody badNoPart badPart badNested badMixSoapMime badMultipleSoapBodies badSoapBodyType"> <isd:java class="mime.MimeImpl" static="false"/> </isd:provider> 1.4 +4 -8 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.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- MimeImpl.java 14 Nov 2002 13:49:34 -0000 1.3 +++ MimeImpl.java 19 Nov 2002 09:41:25 -0000 1.4 @@ -215,19 +215,15 @@ return "4"; } + public String arrayOfBinary(DataHandler dh) { + return dataHandlerToString(dh); + } + /* ******************* ERRORS *********************** */ public void badNoSoapBody(DataHandler dh) {} - public String badNoType(DataHandler dh) { - return dataHandlerToString(dh); - } - public String badNoPart(DataHandler dh) { - return dataHandlerToString(dh); - } - - public String badType(DataHandler dh) { return dataHandlerToString(dh); } 1.4 +1 -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.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Mime.java 14 Nov 2002 13:49:34 -0000 1.3 +++ Mime.java 19 Nov 2002 09:41:25 -0000 1.4 @@ -89,11 +89,10 @@ public String soapBodyParts2(DataHandler dh); public String soapBodyParts3(boolean shouldBounce); public String soapBodyParts4(); + public String arrayOfBinary(DataHandler dh); public void badNoSoapBody(DataHandler dh) throws Exception; - public String badNoType(DataHandler dh) throws Exception; public String badNoPart(DataHandler dh) throws Exception; - public String badType(DataHandler dh) throws Exception; public String badPart(DataHandler dh) throws Exception; public String badNested(DataHandler dh) throws Exception; public String badMixSoapMime(DataHandler dh) throws Exception; 1.1 xml-axis-wsif/java/test/mime/MimeBadMultipleSoapBodies.wsdl Index: MimeBadMultipleSoapBodies.wsdl =================================================================== <?xml version="1.0" ?> <definitions targetNamespace="http://mime/" xmlns:tns="http://mime/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:jms="http://schemas.xmlsoap.org/wsdl/jms/" xmlns:format="http://schemas.xmlsoap.org/wsdl/formatbinding/" xmlns:java="http://schemas.xmlsoap.org/wsdl/java/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns="http://schemas.xmlsoap.org/wsdl/"> <message name="DataHandlerMessage"> <part name="file" type="tns:datahandler"/> </message> <message name="StringMessage"> <part name="buff" type="xsd:string"/> </message> <!-- port type declns --> <portType name="Mime"> <operation name="badMultipleSoapBodies"> <input message="tns:DataHandlerMessage"/> <output message="tns:StringMessage"/> </operation> </portType> <!-- binding declns --> <binding name="SOAPHttpBinding" type="tns:Mime"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <!-- There must only be one mime:part that contains a soap:body --> <operation name="badMultipleSoapBodies"> <soap:operation soapAction=""/> <input> <mime:multipartRelated> <mime:part> <soap:body use="encoded" namespace="http://mime/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </mime:part> <mime:part> <soap:body use="encoded" namespace="http://mime/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </mime:part> <mime:part> <mime:content part="file" type="text/plain"/> </mime:part> </mime:multipartRelated> </input> <output> <soap:body use="encoded" namespace="http://mime/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </output> </operation> </binding> <!-- service decln --> <service name="MimeService"> <port name="SOAPPort" binding="tns:SOAPHttpBinding"> <soap:address location="http://localhost:8080/soap/servlet/rpcrouter"/> </port> </service> </definitions> 1.1 xml-axis-wsif/java/test/mime/MimeBadSoapBodyType.wsdl Index: MimeBadSoapBodyType.wsdl =================================================================== <?xml version="1.0" ?> <definitions targetNamespace="http://mime/" xmlns:tns="http://mime/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:jms="http://schemas.xmlsoap.org/wsdl/jms/" xmlns:format="http://schemas.xmlsoap.org/wsdl/formatbinding/" xmlns:java="http://schemas.xmlsoap.org/wsdl/java/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns="http://schemas.xmlsoap.org/wsdl/"> <message name="DataHandlerMessage"> <part name="file" type="tns:datahandler"/> </message> <message name="StringMessage"> <part name="buff" type="xsd:string"/> </message> <!-- port type declns --> <portType name="Mime"> <operation name="badSoapBodyType"> <input message="tns:DataHandlerMessage"/> <output message="tns:StringMessage"/> </operation> </portType> <!-- binding declns --> <binding name="SOAPHttpBinding" type="tns:Mime"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <!-- There must not a mime:content in the same mime:part as the soap:body --> <operation name="badSoapBodyType"> <soap:operation soapAction=""/> <input> <mime:multipartRelated> <mime:part> <mime:content part="file" type="image/jpeg"/> <soap:body use="encoded" namespace="http://mime/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </mime:part> <mime:part> <mime:content part="file" type="text/plain"/> </mime:part> </mime:multipartRelated> </input> <output> <soap:body use="encoded" namespace="http://mime/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </output> </operation> </binding> <!-- service decln --> <service name="MimeService"> <port name="SOAPPort" binding="tns:SOAPHttpBinding"> <soap:address location="http://localhost:8080/soap/servlet/rpcrouter"/> </port> </service> </definitions> 1.1 xml-axis-wsif/java/test/mime/MimeBadNested.wsdl Index: MimeBadNested.wsdl =================================================================== <?xml version="1.0" ?> <definitions targetNamespace="http://mime/" xmlns:tns="http://mime/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:jms="http://schemas.xmlsoap.org/wsdl/jms/" xmlns:format="http://schemas.xmlsoap.org/wsdl/formatbinding/" xmlns:java="http://schemas.xmlsoap.org/wsdl/java/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns="http://schemas.xmlsoap.org/wsdl/"> <message name="DataHandlerMessage"> <part name="file" type="tns:datahandler"/> </message> <message name="StringMessage"> <part name="buff" type="xsd:string"/> </message> <!-- port type declns --> <portType name="Mime"> <operation name="badNested"> <input message="tns:DataHandlerMessage"/> <output message="tns:StringMessage"/> </operation> </portType> <!-- binding declns --> <binding name="SOAPHttpBinding" type="tns:Mime"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <!-- Nested mime:parts are valid WSDL but not supported by WSIF --> <operation name="badNested"> <soap:operation soapAction=""/> <input> <mime:multipartRelated> <mime:part> <soap:body use="encoded" namespace="http://mime/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </mime:part> <mime:part> <mime:multipartRelated> <mime:part> <mime:content part="file" type="text/plain"/> </mime:part> </mime:multipartRelated> </mime:part> </mime:multipartRelated> </input> <output> <soap:body use="encoded" namespace="http://mime/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </output> </operation> </binding> <!-- service decln --> <service name="MimeService"> <port name="SOAPPort" binding="tns:SOAPHttpBinding"> <soap:address location="http://localhost:8080/soap/servlet/rpcrouter"/> </port> </service> </definitions> 1.1 xml-axis-wsif/java/test/mime/MimeBadNoPart.wsdl Index: MimeBadNoPart.wsdl =================================================================== <?xml version="1.0" ?> <definitions targetNamespace="http://mime/" xmlns:tns="http://mime/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:jms="http://schemas.xmlsoap.org/wsdl/jms/" xmlns:format="http://schemas.xmlsoap.org/wsdl/formatbinding/" xmlns:java="http://schemas.xmlsoap.org/wsdl/java/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns="http://schemas.xmlsoap.org/wsdl/"> <message name="DataHandlerMessage"> <part name="file" type="tns:datahandler"/> </message> <message name="StringMessage"> <part name="buff" type="xsd:string"/> </message> <!-- port type declns --> <portType name="Mime"> <operation name="badNoPart"> <input message="tns:DataHandlerMessage"/> <output message="tns:StringMessage"/> </operation> </portType> <!-- binding declns --> <binding name="SOAPHttpBinding" type="tns:Mime"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="badNoPart"> <soap:operation soapAction=""/> <input> <mime:multipartRelated> <mime:part> <soap:body use="encoded" namespace="http://mime/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </mime:part> <mime:part> <mime:content type="text/plain"/> </mime:part> </mime:multipartRelated> </input> <output> <soap:body use="encoded" namespace="http://mime/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </output> </operation> </binding> <!-- service decln --> <service name="MimeService"> <port name="SOAPPort" binding="tns:SOAPHttpBinding"> <soap:address location="http://localhost:8080/soap/servlet/rpcrouter"/> </port> </service> </definitions> 1.1 xml-axis-wsif/java/test/mime/MimeBadNoSoapBody.wsdl Index: MimeBadNoSoapBody.wsdl =================================================================== <?xml version="1.0" ?> <definitions targetNamespace="http://mime/" xmlns:tns="http://mime/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:jms="http://schemas.xmlsoap.org/wsdl/jms/" xmlns:format="http://schemas.xmlsoap.org/wsdl/formatbinding/" xmlns:java="http://schemas.xmlsoap.org/wsdl/java/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns="http://schemas.xmlsoap.org/wsdl/"> <message name="DataHandlerMessage"> <part name="file" type="tns:datahandler"/> </message> <message name="NullMessage"> </message> <!-- port type declns --> <portType name="Mime"> <operation name="badNoSoapBody"> <input message="tns:DataHandlerMessage"/> <output message="tns:NullMessage"/> </operation> </portType> <!-- binding declns --> <binding name="SOAPHttpBinding" type="tns:Mime"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="badNoSoapBody"> <soap:operation soapAction=""/> <input> <mime:multipartRelated> <mime:part> <mime:content part="file" type="text/xml"/> </mime:part> </mime:multipartRelated> </input> <output> <soap:body use="encoded" namespace="http://mime/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </output> </operation> </binding> <!-- service decln --> <service name="MimeService"> <port name="SOAPPort" binding="tns:SOAPHttpBinding"> <soap:address location="http://localhost:8080/soap/servlet/rpcrouter"/> </port> </service> </definitions> 1.1 xml-axis-wsif/java/test/mime/MimeBadMixSoapMime.wsdl Index: MimeBadMixSoapMime.wsdl =================================================================== <?xml version="1.0" ?> <definitions targetNamespace="http://mime/" xmlns:tns="http://mime/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:jms="http://schemas.xmlsoap.org/wsdl/jms/" xmlns:format="http://schemas.xmlsoap.org/wsdl/formatbinding/" xmlns:java="http://schemas.xmlsoap.org/wsdl/java/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns="http://schemas.xmlsoap.org/wsdl/"> <message name="DataHandlerMessage"> <part name="file" type="tns:datahandler"/> </message> <message name="StringMessage"> <part name="buff" type="xsd:string"/> </message> <!-- port type declns --> <portType name="Mime"> <operation name="badMixSoapMime"> <input message="tns:DataHandlerMessage"/> <output message="tns:StringMessage"/> </operation> </portType> <!-- binding declns --> <binding name="SOAPHttpBinding" type="tns:Mime"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <!-- The binding input can't contain both a soap:body and a mime:multipartRelated --> <operation name="badMixSoapMime"> <soap:operation soapAction=""/> <input> <soap:body use="encoded" namespace="http://mime/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> <mime:multipartRelated> <mime:part> <mime:content part="file" type="text/plain"/> </mime:part> </mime:multipartRelated> </input> <output> <soap:body use="encoded" namespace="http://mime/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </output> </operation> </binding> <!-- service decln --> <service name="MimeService"> <port name="SOAPPort" binding="tns:SOAPHttpBinding"> <soap:address location="http://localhost:8080/soap/servlet/rpcrouter"/> </port> </service> </definitions> 1.1 xml-axis-wsif/java/test/mime/MimeBadPart.wsdl Index: MimeBadPart.wsdl =================================================================== <?xml version="1.0" ?> <definitions targetNamespace="http://mime/" xmlns:tns="http://mime/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:jms="http://schemas.xmlsoap.org/wsdl/jms/" xmlns:format="http://schemas.xmlsoap.org/wsdl/formatbinding/" xmlns:java="http://schemas.xmlsoap.org/wsdl/java/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns="http://schemas.xmlsoap.org/wsdl/"> <message name="DataHandlerMessage"> <part name="file" type="tns:datahandler"/> </message> <message name="StringMessage"> <part name="buff" type="xsd:string"/> </message> <!-- port type declns --> <portType name="Mime"> <operation name="badPart"> <input message="tns:DataHandlerMessage"/> <output message="tns:StringMessage"/> </operation> </portType> <!-- binding declns --> <binding name="SOAPHttpBinding" type="tns:Mime"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="badPart"> <soap:operation soapAction=""/> <input> <mime:multipartRelated> <mime:part> <soap:body use="encoded" namespace="http://mime/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </mime:part> <mime:part> <mime:content part="trash" type="text/plain"/> </mime:part> </mime:multipartRelated> </input> <output> <soap:body use="encoded" namespace="http://mime/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </output> </operation> </binding> <!-- service decln --> <service name="MimeService"> <port name="SOAPPort" binding="tns:SOAPHttpBinding"> <soap:address location="http://localhost:8080/soap/servlet/rpcrouter"/> </port> </service> </definitions> 1.18 +136 -36 xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apacheaxis/WSIFPort_ApacheAxis.java Index: WSIFPort_ApacheAxis.java =================================================================== RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apacheaxis/WSIFPort_ApacheAxis.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- WSIFPort_ApacheAxis.java 15 Nov 2002 09:32:36 -0000 1.17 +++ WSIFPort_ApacheAxis.java 19 Nov 2002 09:41:25 -0000 1.18 @@ -78,6 +78,7 @@ import javax.wsdl.PortType; import javax.wsdl.Service; import javax.wsdl.extensions.mime.MIMEContent; +import javax.wsdl.extensions.mime.MIMEMimeXml; import javax.wsdl.extensions.mime.MIMEMultipartRelated; import javax.wsdl.extensions.mime.MIMEPart; import javax.wsdl.extensions.soap.SOAPAddress; @@ -238,11 +239,11 @@ wsifoperation_apacheaxis)) { operation = (Operation) iterator.next(); - String s3 = operation.getName(); + String opName = operation.getName(); Input input = operation.getInput(); Output output = operation.getOutput(); if (input == null) - throw new WSIFException("missing input message for operation " + s3); + throw new WSIFException("missing input message for operation " + opName); wsifoperation_apacheaxis = new WSIFOperation_ApacheAxis(this, operation, wsifdynamictypemap); @@ -256,7 +257,7 @@ WSIFUtils.getBindingOperation( binding, operation ); if (bindingoperation == null) throw new WSIFException( - "missing required in WSDL 1.1 binding operation for " + s3); + "missing required in WSDL 1.1 binding operation for " + opName); SOAPOperation soapoperation = (SOAPOperation) getExtElem(bindingoperation, javax.wsdl.extensions.soap.SOAPOperation.class, @@ -269,11 +270,11 @@ wsifoperation_apacheaxis.setSoapActionURI(s4); String s5 = soapoperation.getStyle(); if (s5 != null && !"rpc".equals(s5) && !"document".equals(s5)) - throw new WSIFException("unsupported style " + s1 + " for operation " + s3); + throw new WSIFException("unsupported style " + s1 + " for operation " + opName); if (!"rpc".equals(s1) && !"document".equals(s1)) throw new WSIFException( "default soap style must be rpc or document if operation " - + s3 + + opName + " binding has not style property"); if (s5 != null) { style = s5; @@ -284,39 +285,47 @@ } BindingInput bindinginput = bindingoperation.getBindingInput(); List inExtElems = bindinginput.getExtensibilityElements(); - SOAPBody soapbody = + SOAPBody inSoapBody = (SOAPBody) getExtElem(bindinginput, javax.wsdl.extensions.soap.SOAPBody.class, inExtElems); - if (soapbody != null) { + if (inSoapBody != null) { List list2 = parseSoapBody( wsifoperation_apacheaxis, soapoperation, - soapbody, + inSoapBody, true); wsifoperation_apacheaxis.setSoapPartNames(list2); } - MIMEMultipartRelated mimeMultipart = + MIMEMultipartRelated inMimeMultipart = (MIMEMultipartRelated) getExtElem(bindinginput, MIMEMultipartRelated.class, inExtElems); - if (soapbody != null && mimeMultipart != null) + if (inSoapBody != null && inMimeMultipart != null) throw new WSIFException( "In a binding operation that contains a mime:multipartRelated, " + "a soap:body was found that was not in a mime:part. " + "OperationName=" - + s3); - if (mimeMultipart != null) + + opName); + if (inMimeMultipart != null) parseMimeMultipart( - mimeMultipart, + inMimeMultipart, bindingoperation, wsifoperation_apacheaxis, soapoperation, true, - s3); + opName); + MIMEMimeXml inMimeMimeXml = + (MIMEMimeXml) getExtElem(bindinginput, + MIMEMimeXml.class, + inExtElems); + if (inMimeMimeXml != null) + throw new WSIFException( + "WSIF does not support mime:mimeXml. Operation=" + opName); + SOAPHeader soapheader = (SOAPHeader) getExtElem(bindinginput, javax.wsdl.extensions.soap.SOAPHeader.class, @@ -346,24 +355,53 @@ BindingOutput bindingoutput = bindingoperation.getBindingOutput(); if (bindingoutput != null) { - SOAPBody soapbody1 = + List outExtElems = bindingoutput.getExtensibilityElements(); + SOAPBody outSoapBody = (SOAPBody) getExtElem(bindingoutput, javax.wsdl.extensions.soap.SOAPBody.class, - bindingoutput.getExtensibilityElements()); - if (soapbody1 != null) { + outExtElems); + if (outSoapBody != null) { List list3 = parseSoapBody( wsifoperation_apacheaxis, soapoperation, - soapbody1, + outSoapBody, false); if (list3 != null && list3.size() > 0) wsifoperation_apacheaxis.setReturnName((String) list3.get(0)); } + + MIMEMultipartRelated outMimeMultipart = + (MIMEMultipartRelated) getExtElem(bindingoutput, + MIMEMultipartRelated.class, + outExtElems); + if (outSoapBody != null && outMimeMultipart != null) + throw new WSIFException( + "In a binding operation that contains a mime:multipartRelated, " + + "a soap:body was found that was not in a mime:part. " + + "OperationName=" + + opName); + if (outMimeMultipart != null) + parseMimeMultipart( + outMimeMultipart, + bindingoperation, + wsifoperation_apacheaxis, + soapoperation, + false, + opName); + + MIMEMimeXml outMimeMimeXml = + (MIMEMimeXml) getExtElem(bindingoutput, + MIMEMimeXml.class, + outExtElems); + if (outMimeMimeXml != null) + throw new WSIFException( + "WSIF does not support mime:mimeXml. Operation=" + opName); + soapheader = (SOAPHeader) getExtElem(bindingoutput, javax.wsdl.extensions.soap.SOAPHeader.class, - bindingoutput.getExtensibilityElements()); + outExtElems); if (soapheader != null) throw new WSIFException("not supported output soap:header " + soapheader); for (Iterator iterator1 = @@ -380,7 +418,7 @@ getExtElems( bindingoutput, JMSProperty.class, - bindingoutput.getExtensibilityElements()); + outExtElems); if (outJmsProps != null && outJmsProps.size() > 0) { if (st instanceof WSIFJmsTransport) wsifoperation_apacheaxis.setOutputJmsProperties(outJmsProps); @@ -445,7 +483,13 @@ soapoperation); Vector mimePartNames = new Vector(); - List soapPartNameList = null; + boolean soapBodyFound = false; + Operation op = bindingoperation.getOperation(); + Map mapInParts = op.getInput().getMessage().getParts(); + Map mapOutParts = + op.getOutput() == null + ? new HashMap() + : op.getOutput().getMessage().getParts(); List mimeParts = mimeMultipart.getMIMEParts(); Iterator mimePartIt = mimeParts.iterator(); @@ -463,10 +507,12 @@ + MIMEConstants.NS_URI_MIME + "."); - List mimeContents = mimePart.getExtensibilityElements(); - Iterator mimeContentIt = mimeContents.iterator(); - while (mimeContentIt.hasNext()) { - Object nextChild = mimeContentIt.next(); + boolean containsSoapBody = false; + boolean containsMimeContent = false; + List mimePartChildren = mimePart.getExtensibilityElements(); + Iterator mimePartChildrenIt = mimePartChildren.iterator(); + while (mimePartChildrenIt.hasNext()) { + Object nextChild = mimePartChildrenIt.next(); if (nextChild instanceof MIMEContent) { MIMEContent mimeContent = (MIMEContent) nextChild; if (!MIMEConstants @@ -479,32 +525,86 @@ + " did not have the correct namespace URI of " + MIMEConstants.NS_URI_MIME + "."); + containsMimeContent = true; + if (containsSoapBody) + throw new WSIFException( + "A mime:part that contains a mime:content also " + + "contains a soap:body. Operation=" + + operationName); + + String partName = mimeContent.getPart(); + if (partName == null || partName.length() == 0) + throw new WSIFException( + "No part name for a mime:content. Operation=" + + operationName); + + if ((isInput && mapInParts.get(partName) == null) + || (!isInput && mapOutParts.get(partName) == null)) + throw new WSIFException( + "The part specified in a mime:content does " + + "not exist in the operation. Operation=" + + operationName + + " Part=" + + partName); + + mimePartNames.addElement(partName); - mimePartNames.addElement(mimeContent.getPart()); } else if (nextChild instanceof SOAPBody) { - if (soapPartNameList != null) + if (soapBodyFound) throw new WSIFException( "Multiple soap:body tags found in a " - + "mime:multipartRelated. OperationName=" + + "mime:multipartRelated. Operation=" + + operationName); + soapBodyFound = true; + containsSoapBody = true; + if (containsMimeContent) + throw new WSIFException( + "A mime:part that contains a mime:content also " + + "contains a soap:body. Operation=" + operationName); - soapPartNameList = + List soapPartNameList = parseSoapBody( wsifoperation_apacheaxis, soapoperation, (SOAPBody) nextChild, - true); + isInput); - wsifoperation_apacheaxis.setSoapPartNames( - soapPartNameList); + if (isInput) + wsifoperation_apacheaxis.setSoapPartNames( + soapPartNameList); + else if ( + soapPartNameList != null + && soapPartNameList.size() > 0) + wsifoperation_apacheaxis.setReturnName( + (String) soapPartNameList.get(0)); + } else if (nextChild instanceof MIMEMultipartRelated) { + throw new WSIFException( + "WSIF does not support nesting mime:multipartRelated " + + "inside a mime:part. Operation=" + + operationName); + } else if (nextChild instanceof MIMEMimeXml) { + throw new WSIFException( + "WSIF does not support mime:mimeXml. Operation=" + + operationName); } } } } - - if (mimePartNames != null && !mimePartNames.isEmpty()) - wsifoperation_apacheaxis.setMimePartNames(mimePartNames); - + + if (!soapBodyFound) + throw new WSIFException( + "No soap:body found in a mime:multipartRelated. Operation=" + + operationName); + + if (mimePartNames != null && !mimePartNames.isEmpty()) { + List oldMimePartNames = wsifoperation_apacheaxis.getMimePartNames(); + if (oldMimePartNames == null || oldMimePartNames.isEmpty()) + wsifoperation_apacheaxis.setMimePartNames(mimePartNames); + else + oldMimePartNames.addAll(mimePartNames); + } + Trc.exit(); }