i have generated stub for a webserivce using apache axis2 and i want to add custom soap header to the request i want soap header to look like this
<soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><ns1:soapHeader xmlns:ns1="urn:oasis:names:core" soapenv:mustUnderstand="0"><ns1:Username>myuser</ns1:Username><ns1:Password>mypass</ns1:Password></ns1:soapHeader></soapenv:Header>
and im writing this code
org.apache.axiom.soap.SOAPEnvelope env = null;
org.apache.axiom.om.OMFactory omFactory = org.apache.axiom.om.OMAbstractFactory.getOMFactory();
org.apache.axiom.om.OMElement omElement = omFactory.createOMElement(new javax.xml.namespace.QName("urn:oasis:names:core", "soapHeader", "ns1"));
org.apache.axiom.om.OMElement omElement1 = omFactory.createOMElement(new javax.xml.namespace.QName("urn:oasis:names:core", "Username", "ns1"));
org.apache.axiom.om.OMElement omElement2 = omFactory.createOMElement(new javax.xml.namespace.QName("urn:oasis:names:core", "Password", "ns1"));
omElement.addChild(omElement1);
omElement.addChild(omElement2);
omElement1.setText("myuser");
omElement2.setText("mypass");
addHeader(omElement,env);
but i am not getting required soap header, this is what im getting
<soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><ns1:soapHeader xmlns:ns1="urn:oasis:names:core" soapenv:mustUnderstand="0"><ns1:Username>myuser</ns1:Username></ns1:soapHeader></soapenv:Header>
as u can see password is missing, i wanna know what im doing wrong