Hi Chengmin, I don't suppose you found a handy way of converting a DOM Document in Java to a string. The Transformer classes in xalan.jar are a little bulky for the use with the client(an applet). Any help would be appreciated. Thanks.
-----Original Message----- From: Ding, Chengmin To: '[EMAIL PROTECTED]' Sent: 10/30/01 10:46 PM Subject: RE: What is the best way to send Large String from the Client to the Service? Barnaby, Thank you for your continuous support. The problem has finally been solved! On the vb client end, I used some routine to cast the VB String into a Binary Array. Somehow the routine appended an "0x00" at the end of the binary array as the string terminator. It is this one byte "0x00" that got BASE64 encoded and decoded back into a unicode "0x00" in the Java web service. I revised the routine and now it works fine. You know what, I have also been using Simon's TCPTrace for quite a while. I think it is better than the tracer tool in MSSoap toolkit because the MS tool doesn't have header information and hide some details. Since MS Soap doesn't pass the type information for each parameter, there is no xsi:type information in the payload sent from the client. Today I can go back home earlier :) I really appreciate your help. Best regards. -Chengmin -----Original Message----- From: Barnaby James [mailto:[EMAIL PROTECTED]] Sent: Monday, October 29, 2001 7:50 PM To: [EMAIL PROTECTED] Subject: RE: What is the best way to send Large String from the Client to the Service? Hmmm. It sounds like it is including the null terminator (the unicode 0x00) from the end of the string. You can probably strip this off yourself (I guess it depends a little bit on how you convert the string to byte[]. 0x00 isn't legal in an XML document (I am pretty sure). The part I find suprising is that the byte[] isn't getting Base64 encoded before it is written to the XML (I recall you can't have a 0x00 in a Base64 encoded content). You might want to look at the XML that is being sent between the client and the server and see what it looks like. If you see your string then it's not Base64 encoded. If you see a bunch of letters and the xsi:type on the attribute is Base64 then it's (duh!) Base64. I use this handy utility http://www.pocketsoap.com/ when i need to look at the SOAP XML going over the wire. Glad to hear your at least making some progress! Baranby -----Original Message----- From: Ding, Chengmin [mailto:[EMAIL PROTECTED]] Sent: Monday, October 29, 2001 4:12 PM To: '[EMAIL PROTECTED]' Subject: RE: What is the best way to send Large String from the Client to the Service? Barnaby and Paramdeep, Thank you very much for your hints. I have followed Barnaby's tip and passed the Large string as a binary array from VB to Java. Now it is much faster(5 seconds versus 15 minutes). But I started to get the following error after I use String(byte bInput[]) to cast the byte array back to its XML string format: [Mon Oct 29 17:29:15 EST 2001] error: SendVIS: SendVIS-importVIS : org.xml.sax.SAXException: Stopping after fatal error: An invalid XML character (Unicode: 0x0) was found in markup after the end of the element content. at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1092) at org.apache.xerces.framework.XMLDocumentScanner.reportFatalXMLError(XMLDo cume ntScanner.java:644) at org.apache.xerces.framework.XMLDocumentScanner$TrailingMiscDispatcher.di spat ch(XMLDocumentScanner.java:1513) I checked the content of the casted String and it looked fine, it also can be validated via XMLSPY. I wonder whether there should be anything special when I cast the binary array back to string? I have tried to use encoding="ISO-8859-1" instead of "UTF-8" in the input XML String according to some posts but it didn't solve the problem. BTW, I noticed the Microsoft Messaging Framework in Soap Toolkit 2.0, but it doesn't look straightforward and doesn't have some good example as template. Thanks. -Chengmin -----Original Message----- From: Barnaby James [mailto:[EMAIL PROTECTED]] Sent: Friday, October 26, 2001 9:05 PM To: [EMAIL PROTECTED] Subject: RE: What is the best way to send Large String from the Client to the Service? Lamentably, I don't know much about visual basic and using it with SOAP but I'd be very suprised if there were not a way to do this. It might be as simple as casting your XML String to a byte[] (or whathever the visual basic equivelent is) and passing it as a parameter. On the Apache SOAP side of things, if you make the parameter byte[] then it will expect it to be base64 and do the decoding for you. Visual Basic is probably similar so in all probability, you don't need to worry about it. Here is a link to the (terse) SOAP spec on the topic: http://www.w3.org/TR/2001/WD-soap12-20010709/#_Toc478383517 Hope it works out, Barnaby -----Original Message----- From: Ding, Chengmin [mailto:[EMAIL PROTECTED]] Sent: Friday, October 26, 2001 8:07 AM To: '[EMAIL PROTECTED]' Subject: RE: What is the best way to send Large String from the Client to the Service? Barnaby, Thanks a lot for your hint. The string I am passing is validated XML string, I read from somewhere that the best way is to use LITERAL_XML encodingStyle. But I don't how to write the client VB code/WSDL to use LITERAL_XML or BASE64 ? Are there any samples on using different encodingStyles? Regards, -Chengmin -----Original Message----- From: Barnaby James [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 25, 2001 6:56 PM To: [EMAIL PROTECTED] Subject: RE: What is the best way to send Large String from the Client to the Service? Did you try sending it as a data base64 encoded parameter rather than a string? i.e. a parameter of xsi:type="SOAP-ENC:base64"? I would think this would be handled more efficiently than an xsi:type="xsd:string" parameter. If your class on the Apache SOAP side is byte[] it will be automagically converted to SOAP-ENC:base64. Barnaby -----Original Message----- From: Paramdeep Singh [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 25, 2001 3:13 AM To: [EMAIL PROTECTED] Subject: Re: What is the best way to send Large String from the Client to the Service? Hi, I think that if the size of the string is too large, then you should send it as an attachment. I remember of seeing an article somewhere, which mentioned that if the string that you are sending is of a very large length, then it may not get the correct results as well. I think that I read it on this mailing list only, but cant remember it off-hand. Regards Paramdeep ----- Original Message ----- From: "Ding, Chengmin" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, October 25, 2001 2:05 AM Subject: What is the best way to send Large String from the Client to the Service? > HI, Soap folks, > Our web service is based on Apache Soap 2.2 and the web service client is > based on Microsoft Soap Tool kit 2.0. > The client periodically sends an XML String as one of an array parameter to > the web service and the web service will do some manipulations of that > string. The input string used to be below 100 KB and the performance is > satisfactory. Recently the input XML string increases to around 1 MB and the > web service starts to respond extremely slow. > We put some output statement at the beginning of the web service function, > now it takes about 15 minutes before we see those output. We want to know > why it takes Apache Soap 2.2 so long to respond? We found some previous post > that mentions using XML_LITERAL_ENCODING will make it faster, but since we > are using MS SOAPtoolkit, we don't know how to sent this encoding. > > Any of your help will be highly appreciated. > > Thanks. > > -Chengmin _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
