HTTPConstants.MEDIA_TYPE_TEXT_XML);
} else if (wsdl4jExtensibilityElement instanceof SOAP12Header) {
SOAP12Header soapHeader = (SOAP12Header) wsdl4jExtensibilityElement;
SOAPHeaderMessage headerMessage = new SOAPHeaderMessage();
headerMessage.setNamespaceURI(soapHeader.getNamespaceURI());
headerMessage.setUse(soapHeader.getUse());
Boolean required = soapHeader.getRequired();
if (required != null) {
headerMessage.setRequired(required.booleanValue());
}
if (wsdl4jDefinition != null) {
// find the relevant schema part from the messages
Message msg = wsdl4jDefinition.getMessage(soapHeader
.getMessage());
if (msg == null) {
msg = getMessage(wsdl4jDefinition, soapHeader
.getMessage(), new HashSet());
}
if (msg == null) {
// TODO i18n this
throw new AxisFault("message "
+ soapHeader.getMessage()
+ " not found in the WSDL ");
}
Part msgPart = msg.getPart(soapHeader.getPart());
if (msgPart == null) {
// TODO i18n this
throw new AxisFault("message part "
+ soapHeader.getPart()
+ " not found in the WSDL ");
}
// see basic profile 4.4.2 Bindings and Faults header, fault and headerfaults
// can only have elements
headerMessage.setElement(msgPart.getElementName());
}
headerMessage.setMessage(soapHeader.getMessage());
headerMessage.setPart(soapHeader.getPart());
if (description instanceof AxisBindingMessage) {
AxisBindingMessage bindingMessage = (AxisBindingMessage) description;
List soapHeaders =
(List) bindingMessage.getProperty(WSDL2Constants.ATTR_WSOAP_HEADER);
if (soapHeaders == null) {
soapHeaders = new ArrayList();
bindingMessage.setProperty(WSDL2Constants.ATTR_WSOAP_HEADER, soapHeaders);
}
soapHeaders.add(headerMessage);
}
} else if (wsdl4jExtensibilityElement instanceof SOAPHeader) {
SOAPHeader soapHeader = (SOAPHeader) wsdl4jExtensibilityElement;
SOAPHeaderMessage headerMessage = new SOAPHeaderMessage();
headerMessage.setNamespaceURI(soapHeader.getNamespaceURI());
headerMessage.setUse(soapHeader.getUse());
Boolean required = soapHeader.getRequired();
if (null != required) {
headerMessage.setRequired(required.booleanValue());
}
if (null != wsdl4jDefinition) {
// find the relevant schema part from the messages
Message msg = wsdl4jDefinition.getMessage(soapHeader
.getMessage());
if (msg == null) {
msg = getMessage(wsdl4jDefinition, soapHeader
.getMessage(), new HashSet());
}
if (msg == null) {
// todo i18n this
throw new AxisFault("message "
+ soapHeader.getMessage()
+ " not found in the WSDL ");
}
Part msgPart = msg.getPart(soapHeader.getPart());
if (msgPart == null) {
// todo i18n this
throw new AxisFault("message part "
+ soapHeader.getPart()
+ " not found in the WSDL ");
}
headerMessage.setElement(msgPart.getElementName());
}
headerMessage.setMessage(soapHeader.getMessage());
headerMessage.setPart(soapHeader.getPart());
if (description instanceof AxisBindingMessage) {
AxisBindingMessage bindingMessage = (AxisBindingMessage) description;
List soapHeaders =
(List) bindingMessage.getProperty(WSDL2Constants.ATTR_WSOAP_HEADER);