You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Wolfram Ditzer <di...@optel-informatik.de> on 2003/10/16 08:17:11 UTC

Remove mustunderstand from header

Hello,

I want to remove the "soapenv:musUnderstand="0" from my SOAP header:

<soapenv:Header>
  <ns2:transaction xsi:type="ns1:transaction" soapenv:mustUnderstand="0" 
xmlns:ns1="http://optel.test.de/schemas/interface/"
                          xmlns:ns2="http://optel.test.de/interface">
   <value xsi:type="xsd:string">22051</value>
  </ns2:transaction>
 </soapenv:Header>

I looked for threads regarding my question, but I didn´t find an answer.

I´m creating a Header. The mustUnderstand attribute is added 
autimatically. I try to remove it:


        // create a new transaction header
            header =
                new SOAPHeaderElement(
                    HeaderHandler.HEADER_NS,
                    HeaderHandler.HEADER_RESNAME,
                    null);
            SOAPFactory factory = SOAPFactory.newInstance();

            // header.setMustUnderstand(false);
            Name attrName = 
factory.createName(Constants.ATTR_MUST_UNDERSTAND, 
Constants.NS_PREFIX_SOAP_ENV, "");
            header.removeAttribute(attrName);

            MessageElement child =
                new MessageElement("", "value", (Object) transactionId);

            header.addChildElement(child);
            ArrayList ns = new ArrayList();
            ns.add(
                new Mapping(
                    "http:///optel.test.de/schemas/interface",
                    "ns1"));
            ns.add(new Mapping("http://optel.test.de/interface", "ns2"));
            header.setNSMappings(ns);
            header.setAttribute(
                "http://www.w3.org/2001/XMLSchema-instance",
                "type",
                "ns1:transaction");
            header.setType(
                new QName(
                    "http://optel.test.de/schemas/interface/",
                    "transaction"));

Regards Wolfram