axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Veithen (Updated) (JIRA)" <axis-...@ws.apache.org>
Subject [jira] [Updated] (AXIS-2633) The Axis DOM implementation is improperly stripping whitespace from the beginning and end of Text nodes
Date Wed, 11 Jan 2012 11:29:39 GMT

     [ https://issues.apache.org/jira/browse/AXIS-2633?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Andreas Veithen updated AXIS-2633:
----------------------------------

    Fix Version/s:     (was: 1.4)
                       (was: 1.3)
                       (was: 1.2.1)
                       (was: 1.2)
    
> The Axis DOM implementation is improperly stripping whitespace from the beginning and
end of Text nodes
> -------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS-2633
>                 URL: https://issues.apache.org/jira/browse/AXIS-2633
>             Project: Axis
>          Issue Type: Bug
>          Components: Serialization/Deserialization
>    Affects Versions: 1.2, 1.2.1, 1.3, 1.4
>         Environment: Windows XP, Sun JDK 1.4
>            Reporter: Michael Theroux
>
> Axis's DOM implementation is improperly stripping whitespace from the beginning and end
of text nodes of SOAP envelopes.  The following code snippet tries to concisely show the issue:
> import java.util.Iterator;
> import org.apache.axis.SimpleChain;
> import org.apache.axis.client.Call;
> import org.apache.axis.client.Service;
> import org.apache.axis.handlers.LogHandler;
> import org.apache.axis.message.RPCParam;
> import org.w3c.dom.Node;
> import org.w3c.dom.NodeList;
> import javax.xml.namespace.QName;
>   
> public class TestSpace {
> 	public static void main(String [] args) {
> 		try {
> 			String endpoint =
> 				"http://soap.4s4c.com/ilab/soap.asp";
> 			SimpleChain responseChain = new SimpleChain();
> 			responseChain.addHandler( new LogHandler() );
> 			responseChain.init();
> 			Service  service = new Service();
> 			Call     call    = (Call) service.createCall();
> 			
> 			call.setTargetEndpointAddress( new java.net.URL(endpoint) );
> 			call.setOperationName(new QName("http://soapinterop.org/", "echoString" ) );
> 			RPCParam param = new RPCParam( "inputString", "  Hello  " );
> 			String ret = (String) call.invoke( new Object[] { param } );
> 		
> 			System.out.println("Sent 'Hello!', got '" + ret + "'");
> 			Node result = call.getMessageContext().getResponseMessage().getSOAPBody().getFirstChild().getFirstChild().getFirstChild();
> 			System.out.println( "DOM Value: '" + result.getNodeValue() + "'" );
> 			
> 		} catch (Exception e) {
> 			System.err.println(e.toString());
> 		}
> 	}
> }
> This is an adapted version of the "Getting Started" sample found in the online documentation.
 It calls a publically available echo service (the version in the online doc references a
web service that is no longer running).  It calls a method "EchoString" that echoes the given
string.
> The above sample asks the web service to echo a string with whitespace at the beginning
and end of the string.  It then prints the result.  Finally, it goes into the DOM of the SOAP
envelope and prints the text node value of the response string.  The above sample will show
that the DOM implementation is improperly stripping the whitespace while the return value
correctly preserves them.
> I spent a little time trying to track down this issue.  I believe the issue is in org.apache.axis.message.SoapHandler.addTextNode().
 The issue is corrected by replacing:
> "String s = StringUtils.strip( val.toString() );"
> with:
> String s = val.toString()
> I know of nothing in any of the specifications that indicate that whitespace is not a
valid textnode value, nor should be stripped (unless the schema type is xsd:normalizedString
or xsd:token).
> I've reproduced this in Axis 1.2 and 1.4.
> Thank you.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


Mime
View raw message