axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Santeri Paavolainen (JIRA)" <axis-...@ws.apache.org>
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
         URL: http://issues.apache.org/jira/browse/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]); 
        stub.setHeader(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="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Header><ns1:RoamingHeaderType
soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" ns1:mustUnderstand="true"
xmlns:ns1=>...

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="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Header><ns2:RoamingHeaderType
soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" ns1:mustUnderstand="true"
xmlns:ns1="http://www.w3.org/2003/05/soap-envelope" xmlns:ns2="http://uri.etsi.org/TS102207/v1.1.2#">...

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) "http://uri.etsi.org/TS102207/v1.1.2#"
(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 "http://www.w3.org/2003/05/soap-envelope", 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:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message