Hi, I found the problem in the org.apache.axis2.client.Stub.addHeader method:
Original: protected void addHeader(OMElement omElementToadd, SOAPEnvelope envelop, boolean mustUnderstand) { SOAPHeaderBlock soapHeaderBlock = envelop.getHeader().addHeaderBlock(omElementToadd.getLocalName(),omEleme ntToadd.getNamespace()); soapHeaderBlock.setMustUnderstand(mustUnderstand); OMNode omNode = null; for (Iterator iter = omElementToadd.getChildren(); iter.hasNext();){ omNode = (OMNode) iter.next(); soapHeaderBlock.addChild(omNode); } } I changed this into (overwritten in my own stub class): protected void addHeader(OMElement omElementToadd, SOAPEnvelope envelop, boolean mustUnderstand) { SOAPHeaderBlock soapHeaderBlock = envelop.getHeader().addHeaderBlock(omElementToadd.getLocalName(),omEleme ntToadd.getNamespace()); //soapHeaderBlock.setMustUnderstand(mustUnderstand); OMNode omNode = null; for (Iterator iter = omElementToadd.getChildren(); iter.hasNext();) { omNode = (OMNode) iter.next(); soapHeaderBlock.addChild(omNode); } OMAttribute omAtt = null; for (Iterator i = omElementToadd.getAllAttributes(); i.hasNext(); ) { omAtt = (OMAttribute)i.next(); soapHeaderBlock.addAttribute(omAtt); } } This worked! BR Morten -----Original Message----- From: Frank, Morten Sent: 26. oktober 2007 12:29 To: axis-user@ws.apache.org Subject: [AXIS2] addHeader problem Hi, I had a thread going regarding (missing) attributes in a SOAP header block. Now I pinned the problem down to the following: 1) In the generated stub class the Object representing the header block is build in the method org.apache.axiom.om.OMElement toOM(...) The result of this is an element that when printed has the correct structure: <metadata xmlns="http://metadata.ntpsoa.nordea.com/object" schemaVersion="1.0">.... Here the attribute schemaVersion is generated into the XML fragment correctly. 2) After the element is built the header is added to the envelope: addHeader(omElementmetadata1, env); 3) If the header is investigated immediate after this: System.out.println(env.getHeader().toString()); the result is disappointing: <soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><metadata xmlns="http://metadata.ntpsoa.nordea.com/object" soapenv:mustUnderstand="0">... So it seams, that the org.apache.axis2.client.Stub.addHeader method overwrites the attributes part of the header block, or? BR Morten --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]