axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amila Suriarachchi" <amilasuriarach...@gmail.com>
Subject Re: removing mustUnderstand attribute from headers
Date Tue, 17 Jun 2008 13:45:39 GMT
Axis2 by default does not add the mustunderstand attribute.

thanks,
Amila.

On Tue, Jun 17, 2008 at 5:22 PM, <stefan.champailler@smals.be> wrote:

>
> Hello,
>
>
> I uses Axis2-1.4's wsdl2java to generate a client to a web service that
> does *not* accept the "mustUnderstand" attribute in headers. Obviously,
> sending it headers with mustUnderstand attribute set to something (true or
> fals or 0 or 1) fails. So, I want to make sure that the generated client
> doesn't add the dreaded attribute. I've checked this ML and there are
> several people who contributed information on how to achieve that. But none
> of the proposed solutions seem to work for me. Here's an excerpt of my code,
> with all the solutions I've tested :
>
>     public static void main(String[] inArgs) throws
> AxisFault,AlineFault,RemoteException,Exception {
>
>         AlineBackendServiceStub ws = new AlineBackendServiceStub("http://...");
> // address hidden for privacy; that's the stub, coming right from wsdl2java
>
>         Map m = ws._getServiceClient().getOptions().getProperties();
>
> m.remove(AddressingConstants.ADD_MUST_UNDERSTAND_TO_ADDRESSING_HEADERS);
>         ws._getServiceClient().getOptions().setProperties(m);
>
>
> //ws._getServiceClient().getOptions().setProperty(AddressingConstants.ADD_MUST_UNDERSTAND_TO_ADDRESSING_HEADERS,
> Boolean.FALSE);
>
> ws._getServiceClient().getServiceContext().getConfigurationContext().setProperty(AddressingConstants.ADD_MUST_UNDERSTAND_TO_ADDRESSING_HEADERS,
> Boolean.FALSE);
>
> ws._getServiceClient().getServiceContext().getConfigurationContext().createMessageContext().setProperty(AddressingConstants.ADD_MUST_UNDERSTAND_TO_ADDRESSING_HEADERS,
> Boolean.FALSE);
>
> ...
>
> }
>
> None of these work : the mustUnderstand attribute kept written in my header
> (with value "0").
>
> I've also tried to interfere with message context in the generated stub,
> like this :
>
>               // create a message context
>               _messageContext = new
> org.apache.axis2.context.MessageContext();
>
>
> _messageContext.setProperty(AddressingConstants.ADD_MUST_UNDERSTAND_TO_ADDRESSING_HEADERS,
> Boolean.FALSE); // Added by me !!!
>
>
> Then, I 'depserately) looked at the source code of Axis, and the only thing
> I've seen is this (in WSDLSerializationUtil.java):
>
>
>     /**
>      * Adds a soap header element to a given OMElement
>      * @param omFactory - An OMFactory
>      * @param list - The arraylist of soapHeaderMessages
>      * @param wsoap - The WSDL 2.0 SOAP namespace
>      * @param element - The element that the header should be added to
>      * @param nameSpaceMap - The namespaceMap
>      */
>     public static void addSOAPHeaderElements(OMFactory omFactory, ArrayList
> list, OMNamespace wsoap,
>                                              OMElement element, Map
> nameSpaceMap) {
>         for (int i = 0; i < list.size(); i++) {
>             SOAPHeaderMessage soapHeaderMessage = (SOAPHeaderMessage)
> list.get(i);
>             OMElement soapHeaderElement =
>
> omFactory.createOMElement(WSDL2Constants.ATTRIBUTE_HEADER, wsoap);
>             QName qName = soapHeaderMessage.getElement();
>             soapHeaderElement.addAttribute(omFactory.createOMAttribute(
>                     WSDL2Constants.ATTRIBUTE_ELEMENT, null,
>                     getPrefix(qName.getNamespaceURI(), nameSpaceMap) + ":"
> + qName.getLocalPart()));
>             soapHeaderElement.addAttribute(omFactory.createOMAttribute(
>                     WSDL2Constants.ATTRIBUTE_MUST_UNDERSTAND, null,
>
> Boolean.toString(soapHeaderMessage.isMustUnderstand())));
>             soapHeaderElement.addAttribute(omFactory.createOMAttribute(
>                     WSDL2Constants.ATTRIBUTE_REQUIRED, null,
>                     Boolean.toString(soapHeaderMessage.isRequired())));
>             element.addChild(soapHeaderElement);
>         }
>     }
>
>
> I've no idea if this is the place where the serialization does happen, but
> if it is, then I believe the mustUnderstand attribute will always be set (to
> true or false) and never removed.
>
> I know this question has been posted several times and I hope that some of
> you will have enough patience to look at it...
>
> Thanks,
>
> Stefan
>
>
>




-- 
Amila Suriarachchi,
WSO2 Inc.

Mime
View raw message