Methods Summary |
---|
public com.sun.xml.ws.api.message.Message | copy()
return null;
|
public com.sun.xml.ws.api.message.HeaderList | getHeaders()
return abstractMessage.getHeaders();
|
private org.w3c.dom.Node | getNodeValue(org.w3c.dom.Document d, java.lang.String localName)
NodeList nl = d.getElementsByTagNameNS("", localName);
Node n = (nl != null && nl.getLength() > 0)
? nl.item(0).getFirstChild()
: null;
return n;
|
public java.lang.String | getPayloadLocalPart()
return abstractMessage.getPayloadLocalPart();
|
public java.lang.String | getPayloadNamespaceURI()
return abstractMessage.getPayloadNamespaceURI();
|
public boolean | hasHeaders()
return abstractMessage.hasHeaders();
|
public boolean | hasPayload()
return abstractMessage.hasPayload();
|
public boolean | isFault()
return abstractMessage.isFault();
|
public javax.xml.soap.SOAPMessage | readAsSOAPMessage()
return abstractMessage.readAsSOAPMessage();
|
public javax.xml.transform.Source | readEnvelopeAsSource()
return abstractMessage.readEnvelopeAsSource();
|
public javax.xml.stream.XMLStreamReader | readPayload()
return abstractMessage.readPayload();
|
public T | readPayloadAsJAXB(javax.xml.bind.Unmarshaller unmarshaller)
return (T) abstractMessage.readPayloadAsJAXB(unmarshaller);
|
public T | readPayloadAsJAXB(com.sun.xml.bind.api.Bridge bridge)
return abstractMessage.readPayloadAsJAXB(bridge);
|
public javax.xml.transform.Source | readPayloadAsSource()
return wrappedMessage;
|
public void | setAbstractMessage(com.sun.xml.ws.api.message.Message abstractMessage) // represents whether the part is bound to 'header', 'body', or 'attachment'.
this.abstractMessage = abstractMessage;
|
private void | setLog()
if(logger.isLoggable(Level.FINE)) {
log = true;
}
|
private void | setMessage(byte[] data)
ByteArrayInputStream bais = new ByteArrayInputStream(data);
String usedWith = System.getProperty(USED_WITH);
if(usedWith != null && usedWith.indexOf(USED_WITH_HTTP_SOAP_BC) != -1) {
DocumentBuilder db = dbf.newDocumentBuilder();
wrappedMessage = new DOMSource(db.parse(bais));
} else {
wrappedMessage = new StreamSource(bais);
}
|
public void | setWSDLBindingStyle(java.lang.String wsdlBindingStyle)
this.wsdlBindingStyle = wsdlBindingStyle;
|
public void | setWSDLMessageName(java.lang.String wsdlMessageName)
this.wsdlMessageName = wsdlMessageName;
|
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 void | wrap()
if(JavaEEServiceEngineContext.getInstance().isServiceMix()) {
if(log) {
logger.log(Level.FINE, "Skipping the wrapping...");
}
wrappedMessage = abstractMessage.readPayloadAsSource();
} else {
if(RPC_STYLE.equalsIgnoreCase(wsdlBindingStyle)) {
new RPCStyleWrapper().wrap();
} else {
new DocumentStyleWrapper().wrap();
}
}
|
public void | wrapFault(java.lang.String operationName, com.sun.enterprise.jbi.serviceengine.util.soap.EndpointMetaData emd)
if(JavaEEServiceEngineContext.getInstance().isServiceMix()) {
if(log) {
logger.log(Level.FINE, "Skipping the wrapping...");
}
wrappedMessage = abstractMessage.readPayloadAsSource();
return;
}
DOMResult result = new DOMResult();
try {
Transformer t = TF.newTransformer();
t.transform(abstractMessage.readPayloadAsSource(), result);
} catch(Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
Document d = (Document)result.getNode();
if(log) {
logger.log(Level.FINE, "Fault received from JAX-WS : " +
UnWrappedMessage.toString(d));
}
Node faultDetail = getNodeValue(d, FAULT_DETAIL_ELEMENT);
/*
* Caused by RuntimeException thrown from JAX-WS.
*/
if(faultDetail == null) {
logger.log(Level.WARNING,
"RuntimeException thrown from the JAX-WS. No <detail> found.");
RuntimeException rt_ex = new RuntimeException(
"RuntimeException thrown from the JAX-WS. No details found.");
// don't send service engine stack trace.
rt_ex.setStackTrace(new StackTraceElement[]{});
throw rt_ex;
}
javax.wsdl.Message wsdlMsg = null;
try {
wsdlMsg = emd.getFaultMessage(operationName,
faultDetail.getLocalName(), faultDetail.getNamespaceURI());
} catch(Exception ex) {
logger.log(Level.WARNING, ex.getMessage(), ex);
}
/*
* Caused by RuntimeException thrown from the Application.
*/
if(wsdlMsg == null) {
logger.log(Level.WARNING, "RuntimeException thrown from the " +
"Application. Fault is not defined in the WSDL");
Node n = getNodeValue(d, FAULT_STRING_ELEMENT);
RuntimeException rt_ex = new RuntimeException(n.getTextContent());
// don't send service engine stack trace.
rt_ex.setStackTrace(new StackTraceElement[]{});
throw rt_ex;
}
/*
* Caused by the Checked exception thrown from the Application.
*/
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
XMLStreamWriter writer = XOF.createXMLStreamWriter(baos);
writer.writeStartDocument();
String wsdlMessageName = faultDetail.getLocalName();
this.wsdlMessageType = wsdlMsg.getQName();
writer.writeStartElement(WRAPPER_MESSAGE_QNAME);
writeMessageAttributes(writer, wsdlMessageName);
writer.writeStartElement(WRAPPER_PART_QNAME);
writer.writeCharacters(""); // Force completion of open elems
DOMUtil.UTIL.writeNode(faultDetail, writer);
writer.writeEndElement();
writer.writeEndElement();
writer.writeEndDocument();
writer.flush();
setMessage(baos.toByteArray());
if(log) {
logger.log(Level.FINE, "\n\nWrapped fault = " +
baos.toString() + "\n\n");
}
} catch(Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
|
private void | writeJBIFooter(javax.xml.stream.XMLStreamWriter writer)
writer.writeEndElement();
writer.writeEndDocument();
writer.flush();
|
private void | writeJBIHeader(javax.xml.stream.XMLStreamWriter writer)
writer.writeStartDocument();
writer.writeStartElement(WRAPPER_MESSAGE_QNAME);
writeMessageAttributes(writer, wsdlMessageName);
|
private void | writeMessageAttributes(javax.xml.stream.XMLStreamWriter sw, java.lang.String wsdlMessageName)
String prefix = wsdlMessageType.getPrefix();
if (prefix == null || prefix.trim().length() == 0) {
prefix = "msgns";
}
sw.writeAttribute(WRAPPER_ATTRIBUTE_VERSION, WRAPPER_ATTRIBUTE_VERSION_VALUE);
if(wsdlMessageName != null) {
sw.writeAttribute(WRAPPER_ATTRIBUTE_NAME, wsdlMessageName);
}
sw.writeAttribute(WRAPPER_ATTRIBUTE_TYPE, prefix + ":" + wsdlMessageType.getLocalPart());
sw.writeAttribute("xmlns:" + prefix, wsdlMessageType.getNamespaceURI());
sw.writeAttribute("xmlns:" + WRAPPER_DEFAULT_NAMESPACE_PREFIX, WRAPPER_DEFAULT_NAMESPACE);
|
public void | writePayloadTo(javax.xml.stream.XMLStreamWriter sw)
try {
sw.flush();
abstractMessage.writePayloadTo(sw);
} catch(Exception ex) {
ex.printStackTrace();
throw new XMLStreamException(ex);
}
|
public void | writeTo(org.xml.sax.ContentHandler contentHandler, org.xml.sax.ErrorHandler errorHandler)
abstractMessage.writeTo(contentHandler, errorHandler);
|
public void | writeTo(javax.xml.stream.XMLStreamWriter sw)Writes the wrapped abstractMessage into the stream writer.
The fault is not wrapped to compensate a bug in HTTP SOAP BC.
It is assumed that the normal response abstractMessage has only one part.
writePayloadTo(sw);
|