[
https://issues.apache.org/jira/browse/AXIS2-5431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13467675#comment-13467675
]
Martin Gainty commented on AXIS2-5431:
--------------------------------------
if the SOAPHeaders were never populated in Service Client in the first place
(then the headers ArrayList wont contain MUST_UNDERSTAND or any other attribute)
here in ServiceClient
public void sendRobust(QName operation, OMElement elem) throws AxisFault {
MessageContext mc = new MessageContext();
fillSOAPEnvelope(mc, elem);
//at this point headers should be filled with SOAPHeaderBlock
OperationClient mepClient = createClient(operation);
mepClient.addMessageContext(mc);
mepClient.execute(true);
}
//which calls fillSOAPEnveloper with the aforementioned MessageContext and the
xmlPayload
private void fillSOAPEnvelope(MessageContext messageContext, OMElement
xmlPayload)
throws AxisFault {
messageContext.setServiceContext(serviceContext);
SOAPFactory soapFactory = getSOAPFactory();
SOAPEnvelope envelope = soapFactory.getDefaultEnvelope();
if (xmlPayload != null) {
envelope.getBody().addChild(xmlPayload);
}
addHeadersToEnvelope(envelope);
messageContext.setEnvelope(envelope);
}
//which calls addHeadersToEnvelope with the envelope (previously constructed
from SOAPFactory)
public void addHeadersToEnvelope(SOAPEnvelope envelope) {
if (headers != null) {
SOAPHeader soapHeader = envelope.getHeader();
for (Object header : headers) {
soapHeader.addChild((OMElement)header);
}
}
}
/ /where do the headers come from..they are added with addHeader(OMElement) or
addHeader(SOAPHeaderBlock) ..note the difference!
/**
* Add an arbitrary XML element as a header to be sent with outgoing
messages.
* @param header header to be sent (non-<code>null</code>)
*/
public void addHeader(OMElement header) {
/ /at this point the attributes of MUST_UNDERSTAND_PROPERTY are lost
if (headers == null) {
headers = new ArrayList<OMElement>();
}
headers.add(header);
}
/**
* Add SOAP Header to be sent with outgoing messages.
* @param header header to be sent (non-<code>null</code>)
*/
public void addHeader(SOAPHeaderBlock header) {
if (headers == null) {
headers = new ArrayList<OMElement>();
/ /wrong...we cannot use an ArrayList<OMElement> to contain
ArrayList<SOAPHeaderBlock>
}
/ / MUST_UNDERSTAND_PROPERTY is lost ..there is no way to retrieve from headers
array
headers.add(header);
}
noting the difference of OMElement and SOAPHeaderBlock
public interface SOAPHeaderBlock extends OMSourcedElement {
/**
* A SOAPHeaderBlock may be represented as an unexpanded OMSourcedElement.
* In such cases, the underlying OMDataSource may have a property that
contains
* the value of the ROLE/ACTOR, RELAY or MUST_UNDERSTAND setting.
*/
public String ROLE_PROPERTY = "org.apache.axiom.soap.SOAPHeader.ROLE";
public String RELAY_PROPERTY = "org.apache.axiom.soap.SOAPHeader.RELAY";
public String MUST_UNDERSTAND_PROPERTY =
"org.apache.axiom.soap.SOAPHeader.MUST_UNDERSTAND";
...
}
so the downcast of SOAPHeaderBlock to OMElement to fit into
ArrayList<OMElement> loses MUST_UNDERSTAND_PROPERTY
the ArrayList<OMElement> needs to be ArrayList<SOAPHeaderBlock>
this is not good and needs to be rectified ASAP
> No Header in response
> ---------------------
>
> Key: AXIS2-5431
> URL: https://issues.apache.org/jira/browse/AXIS2-5431
> Project: Axis2
> Issue Type: Bug
> Components: kernel
> Affects Versions: 1.6.2
> Reporter: Martin Gainty
>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]