I also got problem with parssing data in byte[].
I have also seen emails on the mailing list saying that they solved the
problem
by passing the data in a String (new String((byte[])data)), see
http://marc.theaimsgroup.com/?l=soap-user&m=102520383913046&w=2
I guess that char[] get all the data within valid unicode on both sender and
receiver side, but
this would increase the size to two times as one char has two bytes.
If we use byte[], the reciever side gets data into JVM with a invalid XML
character.
byte[] is supported by the soap implementation.
Is there a bug with byte[] base64 incoding? 
Why is using String necessary?




-----Original Message-----
From: [EMAIL PROTECTED] [mailto:vakkaraju@;intellequip.com]
Sent: Thursday, October 24, 2002 4:28 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: base 64 encoded xml string getting truncated


Hi,

We have been successfully using apache soap over the past one year
for transferring java objects between web applications. We're using
soap 2.2 with websphere 3.5.4 servlet/ejb environment.

We have a byte[] which is encoded to String using Base64 and the String is
placed as a child element in a Parent Element(which contains other
childeren).

We notice that when the Element reaches the Provider Class the encoded
string(one of the child elements)
is getting truncated(the original encoded string is about 100k and the new
string is about 5k).

Are there any limits on the size of byte[] that can be encoded and decoded
by Base64? Or are there any limits on
size of "Element" parameters to a soap call?

Here is the client code:

      //"itemElement" is the whole xml which contains an element
"binaryData" which holds the encoded string
      public static Document save(int userID, Element itemElement) throws
Exception {
            // Set the SOAP RPC URL
            URL rpcURL = null;
            try{
                  rpcURL = new URL
("http://localhost/soap/servlet/rpcrouter";);
            }catch(MalformedURLException ex){
                  throw new Exception("ItemManagerSOAPProxy::save - " +
ex.getMessage());
            }
            // Build the SOAP call
            Call call = new Call();
            call.setTargetObjectURI("urn:ItemManagerPersistence");
            call.setMethodName("saveItem");
            call.setEncodingStyleURI(Constants.NS_URI_LITERAL_XML);
            // Set the method parameters
            Vector params = new Vector();
            params.addElement(new Parameter("userID", int.class, new
Integer(userID), Constants.NS_URI_SOAP_ENC));
            params.addElement(new Parameter("itemElement", Element.class,
itemElement, Constants.NS_URI_LITERAL_XML));
            call.setParams(params);
            // Invoke the call
            Response response = null;
            try{
                  response = call.invoke(rpcURL, "");
            }catch(SOAPException ex){
                  throw new Exception("ItemManagerSOAPProxy::save - Caught
SOAPException (" + ex.getFaultCode() + "): " + ex.getMessage());
            }
            // Check the response
            Document itemXMLDocument = null;
            if(!response.generatedFault()){
                  Parameter returnValue = response.getReturnValue();
                  Object value = returnValue.getValue();
                  if(value != null) {
                        // Cast value to an Element
                        Element element = (Element)value;
                        try{
                              DocumentBuilderFactory dbf =
DocumentBuilderFactory.newInstance();
                              DocumentBuilder db = dbf.newDocumentBuilder
();
                              itemXMLDocument = db.newDocument();
                              Node importedNode =
itemXMLDocument.importNode(element, true);
                              itemXMLDocument.appendChild(importedNode);
                        }
                        catch(Exception ex){
                              throw new Exception
("ItemManagerSOAPProxy::save - " + ex.getMessage());
                        }
                  }
            }else{
                  Fault fault = response.getFault();
                  throw new Exception("ItemManagerSOAPProxy::save - Fault
Code = " + fault.getFaultCode() + " and Fault String = " +
fault.getFaultString());
            }
            return itemXMLDocument;
      }

Here is the deployment descriptor: 'urn:ItemManagerPersistence'
ID urn:ItemManagerPersistence
Scope Application
Provider Type java
Provider Class com.intellequip.itemmanager.soap.ItemManagerSOAPProcessor
Use Static Class false
Methods saveItem, saveItemTemp, getItemByID, getItemTempByID,
deleteItemTemp

Any ideas about what is happening?

Thanks in advance,

Vishnu.





--
To unsubscribe, e-mail:   <mailto:soap-user-unsubscribe@;xml.apache.org>
For additional commands, e-mail: <mailto:soap-user-help@;xml.apache.org>

--
To unsubscribe, e-mail:   <mailto:soap-user-unsubscribe@;xml.apache.org>
For additional commands, e-mail: <mailto:soap-user-help@;xml.apache.org>

Reply via email to