Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 58993 invoked from network); 24 Mar 2004 19:06:56 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 24 Mar 2004 19:06:56 -0000 Received: (qmail 42025 invoked by uid 500); 24 Mar 2004 19:06:46 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 42005 invoked by uid 500); 24 Mar 2004 19:06:46 -0000 Mailing-List: contact axis-dev-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-dev@ws.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list axis-dev@ws.apache.org Received: (qmail 41993 invoked from network); 24 Mar 2004 19:06:46 -0000 Received: from unknown (HELO mcs.anl.gov) (140.221.9.17) by daedalus.apache.org with SMTP; 24 Mar 2004 19:06:46 -0000 Received: from jgpad (wiggum.mcs.anl.gov [140.221.11.99]) by mcs.anl.gov (8.11.6/8.9.3) with ESMTP id i2OJ6j0159102 for ; Wed, 24 Mar 2004 13:06:45 -0600 From: "Jarek Gawor" To: Subject: Mixed content patch to BeanDeserializer Date: Wed, 24 Mar 2004 14:05:55 -0500 Message-ID: <002e01c411d3$09a2c390$6401a8c0@jgpad> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_002F_01C411A9.20CE4230" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.6626 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 In-Reply-To: <200403240559.i2O5xu0168662@mcs.anl.gov> Importance: Normal X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N This is a multi-part message in MIME format. ------=_NextPart_000_002F_01C411A9.20CE4230 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable Hi, Here's a patch to BeanDeserializer to handle mixed content. It only = works with beans that implement AnyContentType interface. Otherwise, it's just ignored. The text between elements will be added to the MessageElement = array of AnyContentType as org.apache.axis.message.Text instances. Empty text nodes (just with white space) are ignored and the text is trimmed. The = patch also includes a new test case.=20 I hope this will be useful, Jarek ------=_NextPart_000_002F_01C411A9.20CE4230 Content-Type: application/octet-stream; name="mixedContent.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="mixedContent.patch" ? src/org/apache/axis/encoding/ser/BaseDeserializerFactory.java.copy=0A= ? src/org/apache/axis/encoding/ser/BaseSerializerFactory.java.copy=0A= ? src/org/apache/axis/encoding/ser/listqname.path=0A= ? src/org/apache/axis/encoding/ser/nullpatch=0A= Index: test/wsdl/extensibility/ExtensibilityQuery.wsdl=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: = /home/cvspublic/ws-axis/java/test/wsdl/extensibility/ExtensibilityQuery.w= sdl,v=0A= retrieving revision 1.2=0A= diff -w -u -r1.2 ExtensibilityQuery.wsdl=0A= --- test/wsdl/extensibility/ExtensibilityQuery.wsdl 15 Dec 2003 20:58:01 = -0000 1.2=0A= +++ test/wsdl/extensibility/ExtensibilityQuery.wsdl 24 Mar 2004 18:35:11 = -0000=0A= @@ -29,6 +29,22 @@=0A= =0A= =0A= =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= +=0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= +=0A= =0A= =0A= =0A= @@ -40,11 +56,23 @@=0A= =0A= =0A= =0A= + =0A= + =0A= + =0A= +=0A= + =0A= + =0A= + =0A= +=0A= =0A= =0A= =0A= =0A= =0A= + =0A= + =0A= + =0A= + =0A= =0A= =0A= =0A= @@ -52,6 +80,15 @@=0A= transport=3D"http://schemas.xmlsoap.org/soap/http" />=0A= =0A= =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= + =0A= =0A= =0A= =0A= Index: test/wsdl/extensibility/ExtensibilityQueryBindingImpl.java=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: = /home/cvspublic/ws-axis/java/test/wsdl/extensibility/ExtensibilityQueryBi= ndingImpl.java,v=0A= retrieving revision 1.18=0A= diff -w -u -r1.18 ExtensibilityQueryBindingImpl.java=0A= --- test/wsdl/extensibility/ExtensibilityQueryBindingImpl.java 18 Jun = 2003 23:01:52 -0000 1.18=0A= +++ test/wsdl/extensibility/ExtensibilityQueryBindingImpl.java 24 Mar = 2004 18:35:12 -0000=0A= @@ -14,6 +14,7 @@=0A= import org.apache.axis.encoding.SerializationContext;=0A= import org.apache.axis.encoding.SerializationContextImpl;=0A= import org.apache.axis.message.MessageElement;=0A= +import org.apache.axis.message.Text;=0A= import org.apache.axis.message.RPCElement;=0A= import org.apache.axis.message.RPCParam;=0A= import org.apache.axis.message.SOAPBodyElement;=0A= @@ -79,5 +80,59 @@=0A= throw new RemoteException("Failed to get = FindBooksQueryExpressionElement. Got: " + obj);=0A= }=0A= return result;=0A= + }=0A= + =0A= + public ExtensibilityType mixedQuery(ExtensibilityType query) =0A= + throws RemoteException {=0A= + MessageElement [] elements =3D query.get_any();=0A= + if (elements =3D=3D null) {=0A= + throw new RemoteException("No any");=0A= + }=0A= + if (elements.length !=3D 3) {=0A= + throw new RemoteException("Expected: 3 got: " + elements.length +=0A= + " element");=0A= + }=0A= +=0A= + String expected =3D "123 456";=0A= + String received =3D elements[0].toString();=0A= +=0A= + if (!expected.equals(received)) {=0A= + throw new RemoteException("Expected: " + expected + =0A= + " received: " + received);=0A= + }=0A= +=0A= + Object obj =3D null;=0A= + try {=0A= + obj =3D elements[1].getObjectValue(BookType.class);=0A= + } catch (Exception e) {=0A= + throw new RemoteException("Failed to deserialize", e);=0A= + }=0A= + BookType bookQuery =3D (BookType)obj;=0A= + String subject =3D bookQuery.getSubject();=0A= + if (!"all".equals(subject)) {=0A= + throw new RemoteException("ExtensibilityQueryBindingImpl: Book = subject query should be all, instead was " + subject);=0A= + }=0A= +=0A= + expected =3D "789";=0A= + received =3D elements[2].toString();=0A= + =0A= + if (!expected.equals(received)) {=0A= + throw new RemoteException("Expected: " + expected + =0A= + " received: " + received);=0A= + }=0A= +=0A= + ExtensibilityType reply =3D new ExtensibilityType(); =0A= +=0A= + MessageElement [] replyElements =3D new MessageElement[2];=0A= +=0A= + BookType book =3D new BookType();=0A= + book.setSubject("gotAll");=0A= + QName elementName =3D = _FindBooksQueryExpressionElement.getTypeDesc().getFields()[0].getXmlName(= );=0A= + replyElements[0] =3D new MessageElement(elementName.getNamespaceURI(), = elementName.getLocalPart(), book);=0A= + replyElements[1] =3D new Text("ABCD");=0A= + =0A= + reply.set_any(replyElements);=0A= +=0A= + return reply;=0A= }=0A= }=0A= Index: test/wsdl/extensibility/ExtensibilityQueryTestCase.java=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: = /home/cvspublic/ws-axis/java/test/wsdl/extensibility/ExtensibilityQueryTe= stCase.java,v=0A= retrieving revision 1.20=0A= diff -w -u -r1.20 ExtensibilityQueryTestCase.java=0A= --- test/wsdl/extensibility/ExtensibilityQueryTestCase.java 15 Dec 2003 = 20:58:01 -0000 1.20=0A= +++ test/wsdl/extensibility/ExtensibilityQueryTestCase.java 24 Mar 2004 = 18:35:12 -0000=0A= @@ -10,6 +10,7 @@=0A= import org.apache.axis.client.AdminClient;=0A= import org.apache.axis.components.logger.LogFactory;=0A= import org.apache.axis.message.MessageElement;=0A= +import org.apache.axis.message.Text;=0A= import org.apache.axis.utils.Options;=0A= import org.apache.commons.logging.Log;=0A= import org.apache.log4j.Logger;=0A= @@ -69,6 +70,78 @@=0A= assertTrue(queryResult.length =3D=3D 2); =0A= isValid(queryResult[0], "Computer Science", "The Grid"); =0A= isValid(queryResult[1], "English", "The Oxford = Dictionary"); =0A= + }=0A= + catch (Exception e) {=0A= + e.printStackTrace();=0A= + throw new junit.framework.AssertionFailedError("Exception = caught: " + e);=0A= + }=0A= + }=0A= +=0A= + public void testMixedQuery() {=0A= + ExtensibilityQueryPortType binding;=0A= + try {=0A= + ExtensibilityQueryLocator locator =3D new = ExtensibilityQueryLocator();=0A= + binding =3D locator.getExtensibilityQueryPort();=0A= + deployServer();=0A= + }=0A= + catch (javax.xml.rpc.ServiceException jre) {=0A= + throw new junit.framework.AssertionFailedError("JAX-RPC = ServiceException caught: " + jre);=0A= + } =0A= + catch (Exception e) {=0A= + throw new junit.framework.AssertionFailedError("Binding = initialization Exception caught: " + e);=0A= + }=0A= + assertTrue("binding is null", binding !=3D null);=0A= +=0A= + try {=0A= + ExtensibilityType expression =3D new ExtensibilityType(); =0A= +=0A= + MessageElement [] elements =3D new MessageElement[4];=0A= +=0A= + elements[0] =3D new Text("123");=0A= + elements[1] =3D new Text(" 456");=0A= + =0A= + BookType book =3D new BookType();=0A= + book.setSubject("all");=0A= + QName elementName =3D = _FindBooksQueryExpressionElement.getTypeDesc().getFields()[0].getXmlName(= );=0A= + elements[2] =3D new = MessageElement(elementName.getNamespaceURI(), = elementName.getLocalPart(), book);=0A= +=0A= + elements[3] =3D new Text("789");=0A= +=0A= + expression.set_any(elements);=0A= +=0A= + // call the operation=0A= + ExtensibilityType any =3D binding.mixedQuery(expression);=0A= +=0A= + if (any =3D=3D null) {=0A= + throw new Exception("No output returned");=0A= + }=0A= +=0A= + // validate results=0A= + MessageElement [] anyContent =3D any.get_any();=0A= +=0A= + if (anyContent =3D=3D null) {=0A= + throw new Exception("No any");=0A= + }=0A= + if (anyContent.length !=3D 2) {=0A= + throw new Exception("Expected: 2 got: " + =0A= + anyContent.length + " element");=0A= + }=0A= +=0A= + Object obj =3D anyContent[0].getObjectValue(BookType.class);=0A= + BookType bookQuery =3D (BookType)obj;=0A= + String subject =3D bookQuery.getSubject();=0A= + if (!"gotAll".equals(subject)) {=0A= + throw new Exception("Book subject query reply should be gotAll, = instead was " + subject);=0A= + }=0A= +=0A= + String expected =3D "ABCD";=0A= + String received =3D anyContent[1].toString();=0A= +=0A= + if (!expected.equals(received)) {=0A= + throw new Exception("Expected: " + expected + =0A= + " received: " + received);=0A= + }=0A= + =0A= }=0A= catch (Exception e) {=0A= e.printStackTrace();=0A= Index: test/wsdl/extensibility/server-deploy.wsdd=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: = /home/cvspublic/ws-axis/java/test/wsdl/extensibility/server-deploy.wsdd,v=0A= retrieving revision 1.10=0A= diff -w -u -r1.10 server-deploy.wsdd=0A= --- test/wsdl/extensibility/server-deploy.wsdd 15 Dec 2003 20:58:01 = -0000 1.10=0A= +++ test/wsdl/extensibility/server-deploy.wsdd 24 Mar 2004 18:35:12 -0000=0A= @@ -22,7 +22,7 @@=0A= =0A= =0A= =0A= - =0A= + =0A= =0A= =0A=