spring-projects/spring-ws

SaajSoapMessageFactory parses mime header dates as two headers

TomDole opened this issue · 0 comments

I'm trying to read response headers (as the client) implementing ClientInterceptor as follows:

    @Override
    public boolean handleResponse(MessageContext mc) throws WebServiceClientException {
        SaajSoapMessage message = (SaajSoapMessage) mc.getResponse();
        for (Iterator<MimeHeader> it = message.getSaajMessage().getMimeHeaders().getAllHeaders(); it.hasNext(); ) {
            //...
        }
     }

I'm expecting a Date header as follows:

Date=Tue, 09 Jul 2024 15:10:39 GMT

But instead I get two Date headers as follows:

Date=Tue
Date=09 Jul 2024 15:10:39 GMT

Similar problem can be observed with Set-Cookie header that includes the expires attribute, when the header is parsed into two as follows:

Set-Cookie=NSC_XXXX=YYYY;expires=Tue
Set-Cookie=09-Jul-2024 15:40:39 GMT;path=/;httponly

It seems that the SaajSoapMessageFactory is splitting header values into multiple headers too eagerly here:

StringTokenizer tokenizer = new StringTokenizer(headerValue, ",");

Cheers!