axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Santeri Paavolainen (JIRA)" <>
Subject [jira] Created: (AXIS-2369) Printing out a SOAPHeader changes its internal state causing later problems
Date Fri, 13 Jan 2006 13:24:20 GMT
Printing out a SOAPHeader changes its internal state causing later problems

         Key: AXIS-2369
     Project: Apache Axis
        Type: Bug
  Components: Basic Architecture  
    Versions: 1.3    
 Environment: java full version "1.4.2_07-b05"
Axis 1.3 (both client and server)
Linux FC4
Server: jakarta-tomcat-4.1.31
    Reporter: Santeri Paavolainen

Printing a SOAPHeader apparently causes it to change its state. Apparently printing cases
the objects namespaces to be internally set. Basically, with code:

        System.out.println("Setting SOAP header " + i + ": " + soapHeaders[i]); 

the soap header is printed out nicely (I am not going to include it, since what client prints
out doesn't matter in this case, but what it sees eg. what server sees), and the server gets
the following request:

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv=""
xmlns:xsd="" xmlns:xsi=""><soapenv:Header><ns1:RoamingHeaderType
soapenv:actor="" soapenv:mustUnderstand="0" ns1:mustUnderstand="true"

If the print statement is removed, then the following request is received by the server:

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv=""
xmlns:xsd="" xmlns:xsi=""><soapenv:Header><ns2:RoamingHeaderType
soapenv:actor="" soapenv:mustUnderstand="0" ns1:mustUnderstand="true"
xmlns:ns1="" xmlns:ns2="">...

The important difference is in Envelope/Header/RoamingHeaderType ands its namespace. In the
first case it is  (as ns1) and in the latter case (the correct value) ""
(as ns2). The only difference between these two requests is either having a println (with
implied toString) and not having it.

I guess the following happens: When toString() is called, the SOAPHeader will assign internally
namespace *names* to various components. These are assigned from an empty collection of namespaces,
so the first one starts at "ns1" (or similar). This assignment somehow gets "stuck" (is it
cached?), so when later the message is linearized again into XML format as part of the *whole*
request the old namespace name assignment gets used. However in the latter case the "ns1"
namespace is already taken by "", so the object gets
incorrect namespace name assignment, and thus ends also up in the wrong namespace.

Note that this problem is very subtle. It suffices that the header is printed out at any point
*prior* sending the request. The printing can occur before or after setHeader() call, and
as long as it occurs bevore the invoke() operation, the namespaces will get mangled up.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message