You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by "Freeman Fang (JIRA)" <ji...@apache.org> on 2008/02/27 03:54:18 UTC

[jira] Commented: (SM-1249) CXF BC provider doesn't manage Soap 1.2 responses

    [ https://issues.apache.org/activemq/browse/SM-1249?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=41441#action_41441 ] 

Freeman Fang commented on SM-1249:
----------------------------------

Hi  Gianfranco, 

I think this issue is resolved when fix SM-1158

now we have a findBody method to find the soap body according to the soap version

this is the code piece from smx 3.2.2 snapshot

private XMLStreamReader createXMLStreamReaderFromMessage(Message message) {
        XMLStreamReader xmlReader = null;
        StreamSource bodySource = new StreamSource(message
                .getContent(InputStream.class));
        xmlReader = StaxUtils.createXMLStreamReader(bodySource);
        
        findBody(message, xmlReader);
        
        return xmlReader;
    }
    
    private void findBody(Message message, XMLStreamReader xmlReader) {
        DepthXMLStreamReader reader = new DepthXMLStreamReader(xmlReader);
        try {
            int depth = reader.getDepth();
            int event = reader.getEventType();
            while (reader.getDepth() >= depth && reader.hasNext()) {
                QName name = null;
                if (event == XMLStreamReader.START_ELEMENT) {
                    name = reader.getName();
                }
                if (event == XMLStreamReader.START_ELEMENT && name.equals(((SoapMessage)message).getVersion().getBody())) {
                    reader.nextTag();
                    return;
                }
                event = reader.next();
            }
            return;
        } catch (XMLStreamException e) {
            throw new RuntimeException("Couldn't parse stream.", e);
        }
    }


I will close this issue now just for track, if you find any issue, no hesitate to reopen it.

Thanks anyway.

Freeman

> CXF BC provider doesn't manage Soap 1.2 responses
> -------------------------------------------------
>
>                 Key: SM-1249
>                 URL: https://issues.apache.org/activemq/browse/SM-1249
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-cxf-bc
>    Affects Versions: 3.2.1
>            Reporter: Gianfranco Boccalon
>            Assignee: Freeman Fang
>         Attachments: CxfBcProviderMessageObserver.patch
>
>
> The problem was in the class CxfBcProviderMessageObserver. This class doesn't manage Soap 1.2 responses because it uses only the JbiInWsdl1Interceptor, but it's the ReadHeadersInterceptor that changes the SoapMessage version attribute according to the content of the soap response.
> In the current code the SoapMessage is created, and the default constructor set Soap 1.1 version.
> This causes that the getBodyElement method of the class JbiInWsdl1Interceptor, doesn't work because it tries to retrieve the wrong body from the message.
> I changed the CxfBcProviderMessageObserver adding some of the interceptors used in the CxfBcConsumer and changing the creation of the XML stream used to read the content of the response, and now it works correctly.
> I also replicated this patch made on the provider itself:
> https://issues.apache.org/activemq/browse/SM-1225?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.