[ 
https://issues.apache.org/jira/browse/AXIS2-6046?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17893303#comment-17893303
 ] 

Robert Lazarski commented on AXIS2-6046:
----------------------------------------

[~veithen] I committed a fix for this since we supported a null content-type 
and null charSetEnc up until 1.7.9 - I read the source and the OP is correct - 
and I don't see anything in the SOAP docs that say that is disallowed in the 
HTTP response. 

Just thought I'd mention it in case you have some insight. I am going to close 
the issue as fixed barring any concerns - if so, we can reopen it. 

This is the code now: 

https://github.com/apache/axis-axis2-java-core/blob/master/modules/transport/http/src/main/java/org/apache/axis2/transport/http/HTTPSender.java#L444

        // AXIS2-6046 , we supported a null content-type and null charSetEnc up 
until 1.7.9,
        // so let's support that here now
        String contentTypeString = 
request.getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE);
        String charSetEnc = null;
        if (contentTypeString != null) {
            ContentType contentType;
            try {
                contentType = new ContentType(contentTypeString);
            } catch (ParseException ex) {
                throw AxisFault.makeFault(ex);
            }
            charSetEnc = 
contentType.getParameter(HTTPConstants.CHAR_SET_ENCODING);
        }

        if (contentTypeString == null) {
            log.debug("contentType and charSetEnc detected as null, proceeding 
anyway");
        }

        MessageContext inMessageContext = 
msgContext.getOperationContext().getMessageContext(
                WSDLConstants.MESSAGE_LABEL_IN_VALUE);
        if (inMessageContext != null) {
            inMessageContext.setProperty(Constants.Configuration.CONTENT_TYPE, 
contentTypeString);
            
inMessageContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, 
charSetEnc);

> AxisFault after upgrade to 1.8.0
> --------------------------------
>
>                 Key: AXIS2-6046
>                 URL: https://issues.apache.org/jira/browse/AXIS2-6046
>             Project: Axis2
>          Issue Type: Bug
>          Components: transports
>    Affects Versions: 1.8.0
>            Reporter: 杨林
>            Assignee: Robert Lazarski
>            Priority: Blocker
>             Fix For: 2.0.0
>
>         Attachments: image-2022-10-08-11-48-20-446.png, 
> image-2022-10-08-11-49-30-028.png, screenshot-1.png
>
>
> After update to 1.8.0 from 1.7.9 , I received an 
> AxisFault:java.text.ParseException: Token expected
> The cause of the AxisFault is that content-type is empty. 
> !image-2022-10-08-11-49-30-028.png!
> I use axis2 to send a soap message as a notification to third-party . And i 
> only need a response ,don`t care about the response content 。 In addition, 
> the third-party simply returns a response with empty body . such as 
> !image-2022-10-08-11-48-20-446.png|width=543,height=147!
>  
> And OperationClient is OutOnlyAxisOperationClient
> Is content-type mandatory in this scenario?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to