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] Commented: (AXIS-2369) Printing out a SOAPHeader changes its internal state causing later problems
Date Fri, 13 Jan 2006 13:44:20 GMT
    [ http://issues.apache.org/jira/browse/AXIS-2369?page=comments#action_12362637 ] 

Santeri Paavolainen commented on AXIS-2369:
-------------------------------------------

I realized that this occurs even when the whole message (Envelope) is printed. For example,
if log4j debugging is enabled at sufficient level the envelope is printed two times. The first
printing:

2006-01-13 15:30:52,608 DEBUG [client.Call]: <?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#">...

and the second time it is printed (serialized into a string in XML form) when the actual HTTP
request is generated and sent. The request string can also be printed:

2006-01-13 15:30:52,795 DEBUG [http.HTTPSender]: POST /app/services/MSS_Signature HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.3
Host: host:8080
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: "uri"
Content-Length: 2760

<?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="http://www.w3.org/2003/05/soap-envelope">...

Again, namespace has been mysteriously changed. The latter one is what is actually sent, so
server gets a request with invalid namespace in the header element. 

The header element will again be in correct namespace at the server side *if* logging is disabled.

> 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