You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@xml.apache.org by va...@intellequip.com on 2002/10/24 22:27:34 UTC

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:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>


Re: base 64 encoded xml string getting truncated

Posted by Scott Nichol <sn...@scottnichol.com>.
I am not clear about what you are doing.  The client code you show
includes no byte array.  Is the byte array on the server?  I would have
to assume it is.  Do you verify at the exit of your service method that
the string as contained in the DOM is the length you expect?  Where in
the provider do you check the string to see it is 5k?  Are you checking
the string still in the DOM, or as serialized?  If you are looking at
the string while it is still in the DOM, I'm not sure what could have
gone wrong.

Scott Nichol
----- Original Message -----
From: <va...@intellequip.com>
To: <so...@xml.apache.org>; <so...@xml.apache.org>
Cc: <dt...@intellequip.com>
Sent: Thursday, October 24, 2002 4:27 PM
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:   <ma...@xml.apache.org>
> For additional commands, e-mail: <ma...@xml.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>


Re: base 64 encoded xml string getting truncated

Posted by Scott Nichol <sn...@scottnichol.com>.
I am not clear about what you are doing.  The client code you show
includes no byte array.  Is the byte array on the server?  I would have
to assume it is.  Do you verify at the exit of your service method that
the string as contained in the DOM is the length you expect?  Where in
the provider do you check the string to see it is 5k?  Are you checking
the string still in the DOM, or as serialized?  If you are looking at
the string while it is still in the DOM, I'm not sure what could have
gone wrong.

Scott Nichol
----- Original Message -----
From: <va...@intellequip.com>
To: <so...@xml.apache.org>; <so...@xml.apache.org>
Cc: <dt...@intellequip.com>
Sent: Thursday, October 24, 2002 4:27 PM
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:   <ma...@xml.apache.org>
> For additional commands, e-mail: <ma...@xml.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>


Re: base 64 encoded xml string getting truncated

Posted by Scott Nichol <sn...@scottnichol.com>.
I am not clear about what you are doing.  The client code you show
includes no byte array.  Is the byte array on the server?  I would have
to assume it is.  Do you verify at the exit of your service method that
the string as contained in the DOM is the length you expect?  Where in
the provider do you check the string to see it is 5k?  Are you checking
the string still in the DOM, or as serialized?  If you are looking at
the string while it is still in the DOM, I'm not sure what could have
gone wrong.

Scott Nichol
----- Original Message -----
From: <va...@intellequip.com>
To: <so...@xml.apache.org>; <so...@xml.apache.org>
Cc: <dt...@intellequip.com>
Sent: Thursday, October 24, 2002 4:27 PM
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:   <ma...@xml.apache.org>
> For additional commands, e-mail: <ma...@xml.apache.org>
>
>


Re: base 64 encoded xml string getting truncated

Posted by Scott Nichol <sn...@scottnichol.com>.
I am not clear about what you are doing.  The client code you show
includes no byte array.  Is the byte array on the server?  I would have
to assume it is.  Do you verify at the exit of your service method that
the string as contained in the DOM is the length you expect?  Where in
the provider do you check the string to see it is 5k?  Are you checking
the string still in the DOM, or as serialized?  If you are looking at
the string while it is still in the DOM, I'm not sure what could have
gone wrong.

Scott Nichol
----- Original Message -----
From: <va...@intellequip.com>
To: <so...@xml.apache.org>; <so...@xml.apache.org>
Cc: <dt...@intellequip.com>
Sent: Thursday, October 24, 2002 4:27 PM
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:   <ma...@xml.apache.org>
> For additional commands, e-mail: <ma...@xml.apache.org>
>
>