At what line does the exception occur? Do you allocate bTitle, bImprint, etc., based on books.length, e.g.
String[] bTitle = new String[books.length]; Scott Nichol ----- Original Message ----- From: "Guntur N. Sarwohadi" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, September 22, 2002 12:18 PM Subject: RE: apacheSOAP & NuSOAP > Scott.. > > Thanks for the PropertyBagSerializer, it works great! It really is able > to read the soap messages generated by NuSOAP..!!! > > I tried implementing the code exactly as documented and it works fine. > Now, I wanted to extend it a bit so instead of: > > for (int i = 0; i < books.length; i++) { > Map book = books[i]; > System.out.println("Title: " + book.get("title")); > System.out.println("Imprint: " + book.get("imprint")); > ... > } > > I wanted to keep the book data into a string array (so that I could add > a 'page management algorithm' to the array and then loop it again > elsewhere), something like: > > for(int i=0; i < books.length; i++) { > Map book = books[i]; > bTitle[i] = (String) book.get("title"); > bImprint[i] = (String) book.get("imprint"); > ... > } > > but as I do so, I keep having an ArrayIndexOutOfBoundsException. How > should I fix this problem? > > Another thing.. I may have asked this question, but I couldn't quite > understand your reply on how to implement a Apache-SOAP server so that > it can communicate a NuSOAP client using the same SOAP message pattern > used by NuSOAP.. > Does the server should implement a PropertyBagSerializer also? How > should I return the call? > > Regards, > Guntur > > -----Original Message----- > From: Scott Nichol [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, September 17, 2002 11:43 PM > To: [EMAIL PROTECTED] > Subject: Re: apacheSOAP & NuSOAP > > You would need to use the PropertyBagSerializer, which will serialize > any > Map to a format similar to what your earlier example showed. From the > new > propertybag sample, this code > > // Create the bag (something that looks like a "book bean" > Hashtable bag = new Hashtable(7); > bag.put("AuthorFirstName", "Michael"); > bag.put("AuthorLastName", "Chabon"); > bag.put("Title", "The Amazing Adventures of Kavalier & Clay"); > bag.put("Pages", new Integer(639)); > bag.put("CopyrightYear", new Integer(2000)); > bag.put("Publisher", "Random House"); > bag.put("DateAdded", new Date()); > > // Create the mapping > PropertyBagSerializer ser = new PropertyBagSerializer(); > SOAPMappingRegistry smr = new SOAPMappingRegistry(); > smr.mapTypes(Constants.NS_URI_SOAP_ENC, > new QName("urn:property-bag-sample", > "PropertyBag"), > Map.class, ser, null); > > // Build the call. > Header header = new Header(); > SOAPContext ctx = new SOAPContext(); > ctx.setGzip(false); > ctx.setDocLitSerialization(false); > Vector params = new Vector(); > params.addElement(new Parameter("bag", Map.class, bag, null)); > Call call = new Call("urn:property-bag-sample", > "analyze", > params, > header, > Constants.NS_URI_SOAP_ENC, > ctx); > call.setSOAPMappingRegistry(smr); > > generates this envelope > > <SOAP-ENV:Envelope > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:xsd="http://www.w3.org/2001/XMLSchema"> > <SOAP-ENV:Body> > <ns1:analyze xmlns:ns1="urn:property-bag-sample" > SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> > <bag xsi:type="ns1:PropertyBag"> > <Publisher xsi:type="xsd:string">Random House</Publisher> > <AuthorFirstName xsi:type="xsd:string">Michael</AuthorFirstName> > <CopyrightYear xsi:type="xsd:int">2000</CopyrightYear> > <AuthorLastName xsi:type="xsd:string">Chabon</AuthorLastName> > <DateAdded xsi:type="xsd:dateTime">2002-09-16T15:16:33.832Z</DateAdded> > <Title xsi:type="xsd:string">The Amazing Adventures of Kavalier & > Clay</Title> > <Pages xsi:type="xsd:int">639</Pages> > </bag> > </ns1:analyze> > </SOAP-ENV:Body> > </SOAP-ENV:Envelope> > > The type used in this example (ns1:PropertyBag) was xsd:array in your > original example. I don't know whether NuSOAP would require it to be > that > same type or not. > > Scott Nichol > > ----- Original Message ----- > From: "Guntur N. Sarwohadi" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, September 17, 2002 12:32 PM > Subject: RE: apacheSOAP & NuSOAP > > > > Hello... > > > > I wanted to create a SOAP-server in Java that imitates how PHP maps > its > > arrays so that a SOAP-client in PHP (the same one that is able to > > translate SOAP outputs generated by the SOAP-server of PHP) is able to > > 'deserialize' my Java SOAP-server without changing any code to it. I > > recall that Scott suggest using Maps in Java.. how should I use it? > > > > Regards, > > Guntur > > > > -----Original Message----- > > From: Scott Nichol [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, September 17, 2002 9:39 PM > > To: Guntur N. Sarwohadi; [EMAIL PROTECTED] > > Subject: Re: apacheSOAP & NuSOAP > > > > > Um one thing,... where can I find this serializer of yours? > > > > You can download the nightly drop (directories under > > http://xml.apache.org/dist/soap/nightly/), which would allow you to > > easily > > use the latest revision of all the code. You can obtain the source > for > > just > > the serializer from the CVS tree > > > (http://cvs.apache.org/viewcvs.cgi/*checkout*/xml-soap/java/src/org/apac > > he/s > > > oap/encoding/soapenc/PropertyBagSerializer.java?rev=HEAD&content-type=te > > xt/p > > lain) and compile it against your soap.jar, assuming your soap.jar is > > recent > > enough. Personally, I recommend a nightly drop since this includes > the > > newest features and fixes. > > > > > And if I > > > want to add a WSDL extension of the server using Axis, should I > change > > > any code? > > > > I am not quite certain what you mean. Are you talking about using > Axis > > for > > the client? If so, just grab the current Axis build (it is RC1, I > > believe). > > You will want to use different client code using a proxy generated > from > > WSDL. If you do this, let this list know how it goes. > > > > Scott Nichol > > > > > > > > -- > > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > > > > > > > -- > > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > > > > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>