SOAPHeaderElementpublic class SOAPHeaderElement extends MessageElement implements SOAPHeaderElementA simple header element abstraction. Extends MessageElement with
header-specific stuff like mustUnderstand, actor, and a 'processed' flag. |
Fields Summary |
---|
protected boolean | processed | protected String | actor | protected boolean | mustUnderstand | protected boolean | relay | boolean | alreadySerialized |
Constructors Summary |
---|
public SOAPHeaderElement(String namespace, String localPart)
super(namespace, localPart);
| public SOAPHeaderElement(Name name)
super(name);
| public SOAPHeaderElement(QName qname)
super(qname);
| public SOAPHeaderElement(String namespace, String localPart, Object value)
super(namespace, localPart, value);
| public SOAPHeaderElement(QName qname, Object value)
super(qname, value);
| public SOAPHeaderElement(Element elem)
super(elem);
// FIXME : This needs to come from someplace reasonable, perhaps
// TLS (SOAPConstants.getCurrentVersion() ?)
SOAPConstants soapConstants = getSOAPConstants();
String val = elem.getAttributeNS(soapConstants.getEnvelopeURI(),
Constants.ATTR_MUST_UNDERSTAND);
try {
setMustUnderstandFromString(val, (soapConstants ==
SOAPConstants.SOAP12_CONSTANTS));
} catch (AxisFault axisFault) {
// Log the bad MU value, since this constructor can't throw
log.error(axisFault);
}
QName roleQName = soapConstants.getRoleAttributeQName();
actor = elem.getAttributeNS(roleQName.getNamespaceURI(),
roleQName.getLocalPart());
// if (actor == null) {
// actor = "";
// }
if (soapConstants == SOAPConstants.SOAP12_CONSTANTS) {
String relayVal = elem.getAttributeNS(soapConstants.getEnvelopeURI(),
Constants.ATTR_RELAY);
relay = ((relayVal != null) && (relayVal.equals("true") || relayVal.equals("1"))) ? true : false;
}
| public SOAPHeaderElement(String namespace, String localPart, String prefix, Attributes attributes, org.apache.axis.encoding.DeserializationContext context)
super(namespace, localPart, prefix, attributes, context);
SOAPConstants soapConstants = getSOAPConstants();
// Check for mustUnderstand
String val = attributes.getValue(soapConstants.getEnvelopeURI(),
Constants.ATTR_MUST_UNDERSTAND);
setMustUnderstandFromString(val, (soapConstants ==
SOAPConstants.SOAP12_CONSTANTS));
QName roleQName = soapConstants.getRoleAttributeQName();
actor = attributes.getValue(roleQName.getNamespaceURI(),
roleQName.getLocalPart());
// if (actor == null) {
// actor = "";
// }
if (soapConstants == SOAPConstants.SOAP12_CONSTANTS) {
String relayVal = attributes.getValue(soapConstants.getEnvelopeURI(),
Constants.ATTR_RELAY);
relay = ((relayVal != null) && (relayVal.equals("true") || relayVal.equals("1"))) ? true : false;
}
processed = false;
alreadySerialized = true;
|
Methods Summary |
---|
public java.lang.String | getActor() return( actor );
| public org.w3c.dom.NamedNodeMap | getAttributes()
makeAttributesEditable();
SOAPConstants soapConstants = getSOAPConstants();
String mustUnderstand = attributes.getValue(soapConstants.getEnvelopeURI(),
Constants.ATTR_MUST_UNDERSTAND);
QName roleQName = soapConstants.getRoleAttributeQName();
String actor = attributes.getValue(roleQName.getNamespaceURI(),roleQName.getLocalPart());
if(mustUnderstand == null){
if (soapConstants == SOAPConstants.SOAP12_CONSTANTS) {
setAttributeNS(soapConstants.getEnvelopeURI(),
Constants.ATTR_MUST_UNDERSTAND,"false");
} else {
setAttributeNS(soapConstants.getEnvelopeURI(),
Constants.ATTR_MUST_UNDERSTAND,"0");
}
}
if(actor == null){
setAttributeNS(roleQName.getNamespaceURI(),
roleQName.getLocalPart(), this.actor);
}
return super.getAttributes();
| public boolean | getMustUnderstand() return( mustUnderstand );
| public boolean | getRelay()
return relay;
| public java.lang.String | getRole() return( actor );
| private org.apache.axis.soap.SOAPConstants | getSOAPConstants()
SOAPConstants soapConstants = null;
if (context != null) {
return context.getSOAPConstants();
}
if (getNamespaceURI() != null &&
getNamespaceURI().equals(SOAPConstants.SOAP12_CONSTANTS.getEnvelopeURI())) {
soapConstants = SOAPConstants.SOAP12_CONSTANTS;
}
if (soapConstants == null && getEnvelope() != null) {
soapConstants = getEnvelope().getSOAPConstants();
}
if (soapConstants == null) {
soapConstants = SOAPConstants.SOAP11_CONSTANTS;
}
return soapConstants;
| public boolean | isProcessed()
return( processed );
| protected void | outputImpl(org.apache.axis.encoding.SerializationContext context)Subclasses can override
if (!alreadySerialized) {
SOAPConstants soapVer = getSOAPConstants();
QName roleQName = soapVer.getRoleAttributeQName();
if (actor != null) {
setAttribute(roleQName.getNamespaceURI(),
roleQName.getLocalPart(), actor);
}
String val;
if (context.getMessageContext() != null && context.getMessageContext().getSOAPConstants() == SOAPConstants.SOAP12_CONSTANTS)
val = mustUnderstand ? "true" : "false";
else
val = mustUnderstand ? "1" : "0";
setAttribute(soapVer.getEnvelopeURI(),
Constants.ATTR_MUST_UNDERSTAND,
val);
if (soapVer == SOAPConstants.SOAP12_CONSTANTS && relay) {
setAttribute(soapVer.getEnvelopeURI(), Constants.ATTR_RELAY,
"true");
}
}
super.outputImpl(context);
| public void | setActor(java.lang.String a)
actor = a ;
| public void | setMustUnderstand(boolean b)
mustUnderstand = b ;
| private void | setMustUnderstandFromString(java.lang.String val, boolean isSOAP12)
if (val != null && val.length() > 0) {
if ("0".equals(val)) {
mustUnderstand = false;
} else if ("1".equals(val)) {
mustUnderstand = true;
} else if (isSOAP12) {
if ("true".equalsIgnoreCase(val)) {
mustUnderstand = true;
} else if ("false".equalsIgnoreCase(val)) {
mustUnderstand = false;
} else {
throw new AxisFault(
Messages.getMessage("badMUVal",
val,
new QName(namespaceURI,
name).toString()));
}
} else {
throw new AxisFault(
Messages.getMessage("badMUVal",
val,
new QName(namespaceURI,
name).toString()));
}
}
| public void | setParentElement(javax.xml.soap.SOAPElement parent)
if(parent == null) {
throw new IllegalArgumentException(Messages.getMessage("nullParent00"));
}
// migration aid
if (parent instanceof SOAPEnvelope) {
log.warn(Messages.getMessage("bodyHeaderParent"));
parent = ((SOAPEnvelope)parent).getHeader();
}
if (!(parent instanceof SOAPHeader)) {
throw new IllegalArgumentException(Messages.getMessage("illegalArgumentException00"));
}
super.setParentElement(parent);
| public void | setProcessed(boolean value)
processed = value ;
| public void | setRelay(boolean relay)
this.relay = relay;
| public void | setRole(java.lang.String a)
actor = a ;
|
|