mushaofeng / java-ws-discovery

Automatically exported from code.google.com/p/java-ws-discovery
GNU Lesser General Public License v3.0
0 stars 0 forks source link

SOAPOverUDPMessage.getHeaderNamespaceByURI doesn't check the real elements #15

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago

When Apache CXF creates soap messages with WS-Addressing header, the default is 
to NOT put and of the namespace prefixes other than the SOAP prefix onto the 
soap:Envelope or soap:Header elements.  Instead it will define it directly on 
the elements that need it:

<Action 
xmlns="http://www.w3.org/2005/08/addressing">http://docs.oasis-open.org/ws-dd/ns
/discovery/2009/01/Hello</Action>

The method above only checks if the prefix is defined on the soap:Header 
element and thus will reject the CXF generated messages which are proper 
XML/SOAP messages.  

Original issue reported on code.google.com by dan.k...@gmail.com on 16 Aug 2012 at 4:17

GoogleCodeExporter commented 9 years ago

Adding:

        for (Iterator<SOAPHeaderElement> i = soapHeader.examineAllHeaderElements(); i.hasNext();) {
            SOAPHeaderElement headerElement = i.next();
            if (namespace.equals(headerElement.getNamespaceURI())) {
                return headerElement.getElementQName().getPrefix();
            }
        }

fixes this.

Original comment by dan.k...@gmail.com on 16 Aug 2012 at 4:27