Methods Summary |
---|
public void | addChild(MessageElement element)
if (!(element instanceof SOAPHeaderElement)) {
throw new SOAPException(Messages.getMessage("badSOAPHeader00"));
}
element.setEnvelope(getEnvelope());
super.addChild(element);
|
public javax.xml.soap.SOAPElement | addChildElement(javax.xml.soap.SOAPElement element)
if (!(element instanceof SOAPHeaderElement)) {
throw new SOAPException(Messages.getMessage("badSOAPHeader00"));
}
SOAPElement child = super.addChildElement(element);
setDirty();
return child;
|
public javax.xml.soap.SOAPElement | addChildElement(javax.xml.soap.Name name)
SOAPHeaderElement child = new SOAPHeaderElement(name);
addChildElement(child);
return child;
|
public javax.xml.soap.SOAPElement | addChildElement(java.lang.String localName)
// Inherit parent's namespace
SOAPHeaderElement child = new SOAPHeaderElement(getNamespaceURI(),
localName);
addChildElement(child);
return child;
|
public javax.xml.soap.SOAPElement | addChildElement(java.lang.String localName, java.lang.String prefix)
SOAPHeaderElement child =
new SOAPHeaderElement(getNamespaceURI(prefix), localName);
child.setPrefix(prefix);
addChildElement(child);
return child;
|
public javax.xml.soap.SOAPElement | addChildElement(java.lang.String localName, java.lang.String prefix, java.lang.String uri)
SOAPHeaderElement child = new SOAPHeaderElement(uri, localName);
child.setPrefix(prefix);
child.addNamespaceDeclaration(prefix, uri);
addChildElement(child);
return child;
|
void | addHeader(SOAPHeaderElement header)
if (log.isDebugEnabled())
log.debug(Messages.getMessage("addHeader00"));
try {
addChildElement(header);
} catch (SOAPException ex) {
// class cast should never fail when parent is a SOAPHeader
log.fatal(Messages.getMessage("exception00"), ex);
}
|
public javax.xml.soap.SOAPHeaderElement | addHeaderElement(javax.xml.soap.Name name)
SOAPHeaderElement headerElement = new SOAPHeaderElement(name);
addChildElement(headerElement);
return headerElement;
|
public org.w3c.dom.Node | appendChild(org.w3c.dom.Node newChild)
SOAPHeaderElement headerElement = null;
if(newChild instanceof SOAPHeaderElement)
headerElement = (SOAPHeaderElement)newChild;
else
headerElement = new SOAPHeaderElement((Element)newChild);
try {
addChildElement(headerElement);
} catch (SOAPException e) {
throw new DOMException(DOMException.INVALID_STATE_ERR,e.toString());
}
return headerElement;
|
public java.util.Iterator | examineAllHeaderElements()
return getChildElements();
|
public java.util.Iterator | examineHeaderElements(java.lang.String actor)
return findHeaderElements(actor).iterator();
|
public java.util.Iterator | examineMustUnderstandHeaderElements(java.lang.String actor)
if (actor == null) return null;
Vector result = new Vector();
List headers = getChildren();
if (headers != null) {
for(int i = 0; i < headers.size(); i++) {
SOAPHeaderElement she = (SOAPHeaderElement)headers.get(i);
if (she.getMustUnderstand()) {
String candidate = she.getActor();
if (actor.equals(candidate)) {
result.add(headers.get(i));
}
}
}
}
return result.iterator();
|
public java.util.Iterator | extractAllHeaderElements()
Vector result = new Vector();
List headers = getChildren();
if (headers != null) {
for(int i = 0; i < headers.size(); i++) {
result.add(headers.get(i));
}
headers.clear();
}
return result.iterator();
|
public java.util.Iterator | extractHeaderElements(java.lang.String actor)
Vector results = findHeaderElements(actor);
Iterator iterator = results.iterator();
// Detach the header elements from the header
while (iterator.hasNext()) {
((SOAPHeaderElement)iterator.next()).detachNode();
}
return results.iterator();
|
private java.util.Vector | findHeaderElements(java.lang.String actor)
ArrayList actors = new ArrayList();
actors.add(actor);
return getHeadersByActor(actors);
|
SOAPHeaderElement | getHeaderByName(java.lang.String namespace, java.lang.String localPart, boolean accessAllHeaders)Get a header by name, filtering for headers targeted at this
engine depending on the accessAllHeaders parameter.
QName name = new QName(namespace, localPart);
SOAPHeaderElement header = (SOAPHeaderElement)getChildElement(name);
// If we're operating within an AxisEngine, respect its actor list
// unless told otherwise
if (!accessAllHeaders) {
MessageContext mc = MessageContext.getCurrentContext();
if (mc != null) {
if (header != null) {
String actor = header.getActor();
// Always respect "next" role
String nextActor =
getEnvelope().getSOAPConstants().getNextRoleURI();
if (nextActor.equals(actor))
return header;
SOAPService soapService = mc.getService();
if (soapService != null) {
ArrayList actors = mc.getService().getActors();
if ((actor != null) &&
(actors == null || !actors.contains(actor))) {
header = null;
}
}
}
}
}
return header;
|
java.util.Vector | getHeaders()
initializeChildren();
return new Vector(getChildren());
|
java.util.Vector | getHeadersByActor(java.util.ArrayList actors)Get all the headers targeted at a list of actors.
Vector results = new Vector();
List headers = getChildren();
if (headers == null) {
return results;
}
Iterator i = headers.iterator();
SOAPConstants soapVer = getEnvelope().getSOAPConstants();
boolean isSOAP12 = soapVer == SOAPConstants.SOAP12_CONSTANTS;
String nextActor = soapVer.getNextRoleURI();
while (i.hasNext()) {
SOAPHeaderElement header = (SOAPHeaderElement)i.next();
String actor = header.getActor();
// Skip it if we're SOAP 1.2 and it's the "none" role.
if (isSOAP12 && Constants.URI_SOAP12_NONE_ROLE.equals(actor)) {
continue;
}
// Always process NEXT's, and then anything else in our list
// For now, also always process ultimateReceiver role if SOAP 1.2
if (actor == null ||
nextActor.equals(actor) ||
(isSOAP12 &&
Constants.URI_SOAP12_ULTIMATE_ROLE.equals(actor)) ||
(actors != null && actors.contains(actor))) {
results.add(header);
}
}
return results;
|
java.util.Enumeration | getHeadersByName(java.lang.String namespace, java.lang.String localPart, boolean accessAllHeaders)Return an Enumeration of headers which match the given namespace
and localPart. Depending on the value of the accessAllHeaders
parameter, we will attempt to filter on the current engine's list
of actors.
!!! NOTE THAT RIGHT NOW WE ALWAYS ASSUME WE'RE THE "ULTIMATE
DESTINATION" (i.e. we match on null actor). IF WE WANT TO FULLY SUPPORT
INTERMEDIARIES WE'LL NEED TO FIX THIS.
ArrayList actors = null;
boolean firstTime = false;
/** This might be optimizable by creating a custom Enumeration
* which moves through the headers list (parsing on demand, again),
* returning only the next one each time.... this is Q&D for now.
*/
Vector v = new Vector();
List headers = getChildren();
if (headers == null) {
return v.elements();
}
Iterator e = headers.iterator();
SOAPHeaderElement header;
String nextActor = getEnvelope().getSOAPConstants().getNextRoleURI();
while (e.hasNext()) {
header = (SOAPHeaderElement)e.next();
if (header.getNamespaceURI().equals(namespace) &&
header.getName().equals(localPart)) {
if (!accessAllHeaders) {
if (firstTime) {
// Do one-time setup
MessageContext mc = MessageContext.getCurrentContext();
if (mc != null && mc.getAxisEngine() != null) {
actors = mc.getAxisEngine().getActorURIs();
}
firstTime = false;
}
String actor = header.getActor();
if ((actor != null) && !nextActor.equals(actor) &&
(actors == null || !actors.contains(actor))) {
continue;
}
}
v.addElement(header);
}
}
return v.elements();
|
protected void | outputImpl(org.apache.axis.encoding.SerializationContext context)
List headers = getChildren();
if (headers == null) {
return;
}
boolean oldPretty = context.getPretty();
context.setPretty(true);
if (log.isDebugEnabled())
log.debug(headers.size() + " "
+ Messages.getMessage("headers00"));
if (!headers.isEmpty()) {
// Output <SOAP-ENV:Header>
context.startElement(new QName(soapConstants.getEnvelopeURI(),
Constants.ELEM_HEADER), null);
Iterator enumeration = headers.iterator();
while (enumeration.hasNext()) {
// Output this header element
((NodeImpl)enumeration.next()).output(context);
}
// Output </SOAP-ENV:Header>
context.endElement();
}
context.setPretty(oldPretty);
|
void | removeHeader(SOAPHeaderElement header)
if (log.isDebugEnabled())
log.debug(Messages.getMessage("removeHeader00"));
removeChild(header);
|
public void | setParentElement(javax.xml.soap.SOAPElement parent)
if(parent == null) {
throw new IllegalArgumentException(Messages.getMessage("nullParent00"));
}
try {
// cast to force exception if wrong type
SOAPEnvelope env = (SOAPEnvelope)parent;
super.setParentElement(env);
setEnvelope(env);
} catch (Throwable t) {
throw new SOAPException(t);
}
|