Methods Summary |
---|
private void | addHeader(org.w3c.dom.Node n)Adds the header node to the header list.
if(log) {
logger.log(Level.FINE, "Header = " + toString(n));
}
DOMHeader header = new DOMHeader((Element)n);
headers.add(header);
|
private void | addHeader(javax.xml.stream.XMLStreamReader r)Adds the header node pointed by XMLStreamReader to the header list.
try {
if(log) {
logger.log(Level.FINE, "Header = " + r.getName());
}
StreamHeader11 header = new StreamHeader11(r);
headers.add(header);
} catch(Exception ex) {
logger.log(Level.SEVERE, ex.getMessage(), ex);
}
|
public com.sun.xml.ws.api.message.Message | copy()
return null;
|
public void | copyPayLoad(javax.xml.stream.XMLStreamReader r)
ByteArrayOutputStream baos = new ByteArrayOutputStream();
XMLStreamWriter writer = XOF.createXMLStreamWriter(baos);
DOMUtil.UTIL.writeNode(r, writer);
writer.flush();
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
XMLStreamReader reader = XIF.createXMLStreamReader(bais);
if(log) {
logger.log(Level.FINE, "Payload = " + baos.toString());
}
setPayLoad(reader);
|
private boolean | findJBINode(javax.xml.stream.XMLStreamReader reader, java.lang.String localName)
while(reader.hasNext()) {
if(isJBINode(reader,localName)) {
return true;
}
reader.next();
}
return false;
|
public com.sun.xml.ws.api.message.HeaderList | getHeaders()
if(log) {
logger.log(Level.FINE, "Headers = " + headers);
}
return headers;
|
public org.w3c.dom.Node | getOwnerDocument(org.w3c.dom.Node n)
Node ownerDocument = n.getOwnerDocument();
return ownerDocument != null
? ownerDocument
: n;
|
public java.lang.String | getPayloadLocalPart()
return payloadLocalName;
|
public java.lang.String | getPayloadNamespaceURI()
return payloadNamespaceURI;
|
public javax.xml.transform.stream.StreamSource | getStreamSource(javax.xml.transform.Source src)
try {
if(src instanceof StreamSource) {
return (StreamSource)src;
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
StreamResult result = new StreamResult(baos);
TF.newTransformer().transform(src, result);
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
StreamSource ss = new StreamSource(bais);
return ss;
} catch(Exception ex) {
ex.printStackTrace();
return null;
}
|
public boolean | hasHeaders()
return (headers.size() != 0);
|
public boolean | hasPayload()
return payLoadAsStreamReader == null;
|
public boolean | isFault()
return isFault;
|
private boolean | isJBINode(org.w3c.dom.Node node, java.lang.String localName)
if(WRAPPER_DEFAULT_NAMESPACE.equalsIgnoreCase(node.getNamespaceURI()) &&
localName.equalsIgnoreCase(node.getLocalName())) {
return true;
}
return false;
|
private boolean | isJBINode(javax.xml.stream.XMLStreamReader reader, java.lang.String localName)
if(reader.getEventType() != XMLStreamReader.START_ELEMENT) {
return false;
}
if(WRAPPER_DEFAULT_NAMESPACE.equalsIgnoreCase(reader.getNamespaceURI()) &&
localName.equalsIgnoreCase(reader.getLocalName())) {
return true;
}
return false;
|
public void | printPayLoad(java.lang.String message)
if(!log) {
return;
}
StringBuffer msg = new StringBuffer("\n\n");
if(payLoadAsSource instanceof DOMSource) {
Node n = ((DOMSource)payLoadAsSource).getNode();
msg.append("Unwrapped message " + UnWrappedMessage.toString(n));
}
msg
.append(message)
.append("\n\npayLoadLocalName = ")
.append(payloadLocalName)
.append("\npayLoadNamespaceURI = ")
.append(payloadNamespaceURI)
.append("\n\n");
logger.log(Level.FINE, msg.toString());
|
private void | processAttachments()
for(String aName : (Set<String>)normalizedMessage.getAttachmentNames()) {
logger.log(Level.FINE, "Adding attachment with ID = " + aName);
getAttachments().add(new DataHandlerAttachment(
aName, normalizedMessage.getAttachment(aName)));
}
|
public javax.xml.soap.SOAPMessage | readAsSOAPMessage()
String methodSig =
"\ncom.sun.enterprise.jbi.serviceengine.comm.UnWrappedMessage" +
"::readAsSOAPMessage()";
String usedWith = System.getProperty(USED_WITH);
if(usedWith == null || usedWith.indexOf(USED_WITH_JMAC_PROVIDER) == -1) {
throw new SOAPException(
methodSig + " operation is not supported." +
"\nSet this system property to workaround this issue : " +
"com.sun.enterprise.jbi.se.usedwith=jmacprovider");
}
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
XMLStreamWriter writer = XOF.createXMLStreamWriter(baos);
writer.writeStartDocument();
writer.writeStartElement(SOAP_ENVELOPE);
writer.writeAttribute("xmlns:" + SOAP_PREFIX, SOAP_NAMESPACE);
writer.writeEmptyElement(SOAP_HEADER);
writer.writeStartElement(SOAP_BODY);
if(payLoadAsBaos == null) {
if(payLoadAsSource instanceof DOMSource) {
Node payLoadNode = ((DOMSource)payLoadAsSource).getNode();
DOMUtil.UTIL.writeNode(payLoadNode, writer);
} else {
DOMUtil.UTIL.writeNode(payLoadAsStreamReader, writer);
}
} else {
baos.write(">".getBytes());
baos.write(payLoadAsBaos.toByteArray());
}
writer.writeEndElement();
writer.writeEndElement();
writer.writeEndDocument();
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
SOAPMessage message = MessageFactory.newInstance().createMessage(null, bais);
if(log) {
logger.log(Level.FINE, methodSig + " :: SOAPMessage = " + toString(message));
}
return message;
} catch(Exception ex) {
throw new SOAPException(methodSig + ex.getMessage());
}
|
public javax.xml.transform.Source | readEnvelopeAsSource()
return null;
|
public javax.xml.stream.XMLStreamReader | readPayload()
if(log) {
logger.log(Level.FINE, "UnWrappedMessage :: readPayLoad()");
}
return payLoadAsStreamReader;
|
public T | readPayloadAsJAXB(javax.xml.bind.Unmarshaller unmarshaller)
return (T)unmarshaller.unmarshal(payLoadAsSource);
|
public T | readPayloadAsJAXB(com.sun.xml.bind.api.Bridge bridge)
return bridge.unmarshal(payLoadAsSource);
|
public javax.xml.transform.Source | readPayloadAsSource()
if(log) {
logger.log(Level.FINE, "UnWrappedMessage :: readPayLoadAsSource()");
}
return payLoadAsSource;
|
private void | setLog()
if(logger.isLoggable(Level.FINE)) {
log = true;
}
|
public void | setNormalizedMessage(javax.jbi.messaging.NormalizedMessage normalizedMessage)
this.normalizedMessage = normalizedMessage;
this.nmContent = normalizedMessage.getContent();
|
public void | setPayLoad(javax.xml.transform.Source s)
if(s instanceof DOMSource) {
setPayLoad(((DOMSource)s).getNode());
} else if(s instanceof StreamSource) {
XMLStreamReader reader = XIF.
createXMLStreamReader(((StreamSource)s).getInputStream());
setPayLoad(reader);
} else if(s instanceof SAXSource) {
InputSource source = ((SAXSource) s).getInputSource();
XMLStreamReader reader = (source.getCharacterStream() != null)?
XIF.createXMLStreamReader(source.getCharacterStream()):
XIF.createXMLStreamReader(source.getByteStream());
setPayLoad(reader);
} else {
logger.log(Level.WARNING, "UnWrappedMessage :: Transforming the input message to DOM");
Transformer t = TF.newTransformer();
DOMResult result = new DOMResult();
t.transform(s, result);
setPayLoad(result.getNode());
}
|
public void | setPayLoad(org.w3c.dom.Node n)
if(n.getNodeType() == Node.DOCUMENT_NODE) {
n = n.getFirstChild();
}
payloadLocalName = n.getLocalName();
payloadNamespaceURI = n.getNamespaceURI();
payLoadAsSource = new DOMSource(n);
payLoadAsStreamReader = new DOMStreamReader(n);
printPayLoad("");
|
public void | setPayLoad(javax.xml.stream.XMLStreamReader reader)
if(reader.getEventType() == XMLStreamReader.START_DOCUMENT) {
reader.next();
}
payloadLocalName = reader.getLocalName();
payloadNamespaceURI = reader.getNamespaceURI();
payLoadAsSource = new StAXSource(reader, true); // StAXSource will be available in JDK6.
payLoadAsStreamReader = reader;
XMLStreamReader r = reader;
printPayLoad("");
|
public void | setPayLoad(byte[] data)
ByteArrayInputStream bais = new ByteArrayInputStream(data);
payLoadAsStreamReader = XIF.createXMLStreamReader(bais);
payLoadAsStreamReader.next(); // skip the <?xml ...?> node.
payLoadAsSource = new StAXSource(payLoadAsStreamReader, true);
payloadLocalName = payLoadAsStreamReader.getLocalName();
payloadNamespaceURI = payLoadAsStreamReader.getNamespaceURI();
|
public void | setWSDLBindingStyle(java.lang.String wsdlBindingStyle)
this.wsdlBindingStyle = wsdlBindingStyle;
|
public void | setWSDLMessageType(javax.xml.namespace.QName wsdlMessageType)
this.wsdlMessageType = wsdlMessageType;
|
public void | setWSDLOrderedParts(java.util.List wsdlOrderedParts)
this.wsdlOrderedParts = wsdlOrderedParts;
|
public void | setWSDLPartBindings(int[] wsdlPartBindings)
this.wsdlPartBindings = wsdlPartBindings;
|
public static java.lang.String | toString(javax.xml.soap.SOAPMessage soapMessage)
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
soapMessage.writeTo(baos);
return baos.toString();
} catch(Exception e) {
return e.getMessage();
}
|
public static java.lang.String | toString(org.w3c.dom.Node n)
return toString(new DOMSource(n));
|
public static java.lang.String | toString(javax.xml.stream.XMLStreamReader reader)
return toString(new StAXSource(reader, true));
|
public static java.lang.String | toString(javax.xml.transform.Source s)
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
StreamResult sr = new StreamResult(baos);
TF.newTransformer().transform(s, sr);
return baos.toString();
} catch(Exception ex) {
ex.printStackTrace();
return null;
}
|
private void | unWrapFault()
Source s = this.nmContent;
Node n;
if(s instanceof DOMSource) {
n = ((DOMSource)s).getNode();
} else {
Transformer t = TF.newTransformer();
DOMResult result = new DOMResult();
t.transform(s, result);
n = result.getNode();
}
Document d = (n instanceof Document) ? (Document) n : n.getOwnerDocument();
NodeList nl = d.getElementsByTagNameNS(WRAPPER_DEFAULT_NAMESPACE, WRAPPER_PART_LOCALNAME);
Node jbiPart = (nl != null && nl.getLength() > 0)
? nl.item(0).getFirstChild()
: d.getFirstChild();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
XMLStreamWriter writer = XOF.createXMLStreamWriter(baos);
writer.writeStartDocument();
writer.writeStartElement(SOAP_FAULT);
writer.writeAttribute("xmlns:" + SOAP_PREFIX, SOAP_NAMESPACE);
String faultCode = jbiPart == null ? SERVER_FAULT_CODE : CLIENT_FAULT_CODE;
String faultString = FAULT_STRING;
writer.writeStartElement(FAULT_CODE_ELEMENT);
writer.writeCharacters(SOAP_PREFIX + ":" + faultCode);
writer.writeEndElement();
writer.writeStartElement(FAULT_STRING_ELEMENT);
writer.writeCharacters(faultString);
writer.writeEndElement();
writer.writeStartElement(FAULT_DETAIL_ELEMENT);
if(jbiPart != null)
DOMUtil.UTIL.writeNode(jbiPart, writer);
writer.writeEndElement();
writer.writeEndElement();
writer.writeEndDocument();
writer.flush();
setPayLoad(baos.toByteArray());
printPayLoad("\n\nUnwrapped fault = " + baos.toString());
|
public void | unwrap()
if(log) {
String s = (nmContent instanceof DOMSource) ? toString(nmContent) : "StreamSource";
logger.log(Level.FINE, "bindingStyle = " + wsdlBindingStyle + ", received message = " + s);
}
if(JavaEEServiceEngineContext.getInstance().isServiceMix()) {
if(log) {
logger.log(Level.FINE, "Skipping the unwrapping...");
}
setPayLoad(nmContent);
} else {
if(RPC_STYLE.equalsIgnoreCase(wsdlBindingStyle)) {
new RPCStyleUnWrapper().unwrap();
} else {
new DocumentStyleUnWrapper().unwrap();
}
}
processAttachments();
if(payLoadAsStreamReader == null) {
throw new Exception(StringTranslator.getDefaultInstance().getString(
"serviceengine.unwrapping_failed"));
}
|
public void | unwrapFault()
if(log) {
String s = (nmContent instanceof DOMSource) ? toString(nmContent) : "StreamSource";
logger.log(Level.FINE, "bindingStyle = " + wsdlBindingStyle + ", received fault = " + s);
}
isFault = true;
if(JavaEEServiceEngineContext.getInstance().isServiceMix()) {
if(log) {
logger.log(Level.FINE, "Skipping the unwrapping...");
}
setPayLoad(nmContent);
} else {
unWrapFault();
}
if(payLoadAsStreamReader == null) {
throw new Exception(StringTranslator.getDefaultInstance().getString(
"serviceengine.unwrapping_failed"));
}
|
public void | writePayloadTo(javax.xml.stream.XMLStreamWriter sw)
throw new XMLStreamException("Operaion is not supported.");
|
public void | writeTo(javax.xml.stream.XMLStreamWriter sw)
throw new XMLStreamException("Operaion is not supported.");
|
public void | writeTo(org.xml.sax.ContentHandler contentHandler, org.xml.sax.ErrorHandler errorHandler)
throw new SAXException("Operaion is not supported.");
|