public static QName getPayloadRootQName(Source source, TransformerHelper transformerHelper) throws TransformerException { if (source == null) { return null; } try { PayloadRootSourceCallback callback = new PayloadRootSourceCallback(); TraxUtils.doWithSource(source, callback); if (callback.result != null) { return callback.result; } else { // we have no other option than to transform DOMResult domResult = new DOMResult(); transformerHelper.transform(source, domResult); Document document = (Document) domResult.getNode(); return QNameUtils.getQNameForNode(document.getDocumentElement()); } } catch (TransformerException ex) { throw ex; } catch (Exception ex) { return null; } }
public static QName getPayloadRootQName(Source source, TransformerHelper transformerHelper) throws TransformerException { if (source == null) { return null; } try { PayloadRootSourceCallback callback = new PayloadRootSourceCallback(); TraxUtils.doWithSource(source, callback); if (callback.result != null) { return callback.result; } else { // we have no other option than to transform DOMResult domResult = new DOMResult(); transformerHelper.transform(source, domResult); Document document = (Document) domResult.getNode(); return QNameUtils.getQNameForNode(document.getDocumentElement()); } } catch (TransformerException ex) { throw ex; } catch (Exception ex) { return null; } }
public static QName getPayloadRootQName(Source source, TransformerHelper transformerHelper) throws TransformerException { if (source == null) { return null; } try { PayloadRootSourceCallback callback = new PayloadRootSourceCallback(); TraxUtils.doWithSource(source, callback); if (callback.result != null) { return callback.result; } else { // we have no other option than to transform DOMResult domResult = new DOMResult(); transformerHelper.transform(source, domResult); Document document = (Document) domResult.getNode(); return QNameUtils.getQNameForNode(document.getDocumentElement()); } } catch (TransformerException ex) { throw ex; } catch (Exception ex) { return null; } }
/** * Unmarshals the request payload of the given message context as {@link JAXBElement}. * * @param messageContext the message context to unmarshal from * @param clazz the class to unmarshal * @return the unmarshalled element, or {@code null} if the request has no payload * @throws JAXBException in case of JAXB2 errors */ protected final <T> JAXBElement<T> unmarshalElementFromRequestPayload(MessageContext messageContext, Class<T> clazz) throws JAXBException { Source requestPayload = getRequestPayload(messageContext); if (requestPayload == null) { return null; } try { JaxbElementSourceCallback<T> callback = new JaxbElementSourceCallback<T>(clazz); TraxUtils.doWithSource(requestPayload, callback); if (logger.isDebugEnabled()) { logger.debug("Unmarshalled payload request to [" + callback.result + "]"); } return callback.result; } catch (Exception ex) { throw convertToJaxbException(ex); } }
public static QName getPayloadRootQName(Source source, TransformerHelper transformerHelper) throws TransformerException { if (source == null) { return null; } try { PayloadRootSourceCallback callback = new PayloadRootSourceCallback(); TraxUtils.doWithSource(source, callback); if (callback.result != null) { return callback.result; } else { // we have no other option than to transform DOMResult domResult = new DOMResult(); transformerHelper.transform(source, domResult); Document document = (Document) domResult.getNode(); return QNameUtils.getQNameForNode(document.getDocumentElement()); } } catch (TransformerException ex) { throw ex; } catch (Exception ex) { return null; } }
/** * Unmarshals the request payload of the given message context. * * @param messageContext the message context to unmarshal from * @param clazz the class to unmarshal * @return the unmarshalled object, or {@code null} if the request has no payload * @throws JAXBException in case of JAXB2 errors */ protected final Object unmarshalFromRequestPayload(MessageContext messageContext, Class<?> clazz) throws JAXBException { Source requestPayload = getRequestPayload(messageContext); if (requestPayload == null) { return null; } try { Jaxb2SourceCallback callback = new Jaxb2SourceCallback(clazz); TraxUtils.doWithSource(requestPayload, callback); if (logger.isDebugEnabled()) { logger.debug("Unmarshalled payload request to [" + callback.result + "]"); } return callback.result; } catch (Exception ex) { throw convertToJaxbException(ex); } }
/** * Unmarshals the request payload of the given message context. * * @param messageContext the message context to unmarshal from * @param clazz the class to unmarshal * @return the unmarshalled object, or {@code null} if the request has no payload * @throws JAXBException in case of JAXB2 errors */ protected final Object unmarshalFromRequestPayload(MessageContext messageContext, Class<?> clazz) throws JAXBException { Source requestPayload = getRequestPayload(messageContext); if (requestPayload == null) { return null; } try { Jaxb2SourceCallback callback = new Jaxb2SourceCallback(clazz); TraxUtils.doWithSource(requestPayload, callback); if (logger.isDebugEnabled()) { logger.debug("Unmarshalled payload request to [" + callback.result + "]"); } return callback.result; } catch (Exception ex) { throw convertToJaxbException(ex); } }
/** * Unmarshals the request payload of the given message context. * * @param messageContext the message context to unmarshal from * @param clazz the class to unmarshal * @return the unmarshalled object, or {@code null} if the request has no payload * @throws JAXBException in case of JAXB2 errors */ protected final Object unmarshalFromRequestPayload(MessageContext messageContext, Class<?> clazz) throws JAXBException { Source requestPayload = getRequestPayload(messageContext); if (requestPayload == null) { return null; } try { Jaxb2SourceCallback callback = new Jaxb2SourceCallback(clazz); TraxUtils.doWithSource(requestPayload, callback); if (logger.isDebugEnabled()) { logger.debug("Unmarshalled payload request to [" + callback.result + "]"); } return callback.result; } catch (Exception ex) { throw convertToJaxbException(ex); } }
/** * Unmarshals the request payload of the given message context. * * @param messageContext the message context to unmarshal from * @param clazz the class to unmarshal * @return the unmarshalled object, or {@code null} if the request has no payload * @throws JAXBException in case of JAXB2 errors */ protected final Object unmarshalFromRequestPayload(MessageContext messageContext, Class<?> clazz) throws JAXBException { Source requestPayload = getRequestPayload(messageContext); if (requestPayload == null) { return null; } try { Jaxb2SourceCallback callback = new Jaxb2SourceCallback(clazz); TraxUtils.doWithSource(requestPayload, callback); if (logger.isDebugEnabled()) { logger.debug("Unmarshalled payload request to [" + callback.result + "]"); } return callback.result; } catch (Exception ex) { throw convertToJaxbException(ex); } }
/** * Unmarshals the request payload of the given message context as {@link JAXBElement}. * * @param messageContext the message context to unmarshal from * @param clazz the class to unmarshal * @return the unmarshalled element, or {@code null} if the request has no payload * @throws JAXBException in case of JAXB2 errors */ protected final <T> JAXBElement<T> unmarshalElementFromRequestPayload(MessageContext messageContext, Class<T> clazz) throws JAXBException { Source requestPayload = getRequestPayload(messageContext); if (requestPayload == null) { return null; } try { JaxbElementSourceCallback<T> callback = new JaxbElementSourceCallback<T>(clazz); TraxUtils.doWithSource(requestPayload, callback); if (logger.isDebugEnabled()) { logger.debug("Unmarshalled payload request to [" + callback.result + "]"); } return callback.result; } catch (Exception ex) { throw convertToJaxbException(ex); } }
/** * Unmarshals the request payload of the given message context as {@link JAXBElement}. * * @param messageContext the message context to unmarshal from * @param clazz the class to unmarshal * @return the unmarshalled element, or {@code null} if the request has no payload * @throws JAXBException in case of JAXB2 errors */ protected final <T> JAXBElement<T> unmarshalElementFromRequestPayload(MessageContext messageContext, Class<T> clazz) throws JAXBException { Source requestPayload = getRequestPayload(messageContext); if (requestPayload == null) { return null; } try { JaxbElementSourceCallback<T> callback = new JaxbElementSourceCallback<T>(clazz); TraxUtils.doWithSource(requestPayload, callback); if (logger.isDebugEnabled()) { logger.debug("Unmarshalled payload request to [" + callback.result + "]"); } return callback.result; } catch (Exception ex) { throw convertToJaxbException(ex); } }
/** * Unmarshals the request payload of the given message context as {@link JAXBElement}. * * @param messageContext the message context to unmarshal from * @param clazz the class to unmarshal * @return the unmarshalled element, or {@code null} if the request has no payload * @throws JAXBException in case of JAXB2 errors */ protected final <T> JAXBElement<T> unmarshalElementFromRequestPayload(MessageContext messageContext, Class<T> clazz) throws JAXBException { Source requestPayload = getRequestPayload(messageContext); if (requestPayload == null) { return null; } try { JaxbElementSourceCallback<T> callback = new JaxbElementSourceCallback<T>(clazz); TraxUtils.doWithSource(requestPayload, callback); if (logger.isDebugEnabled()) { logger.debug("Unmarshalled payload request to [" + callback.result + "]"); } return callback.result; } catch (Exception ex) { throw convertToJaxbException(ex); } }
@Override public final Source invoke(Source request) throws Exception { Element requestElement = null; if (request != null) { XomSourceCallback sourceCallback = new XomSourceCallback(); try { TraxUtils.doWithSource(request, sourceCallback); } catch (XomParsingException ex) { throw (ParsingException) ex.getCause(); } requestElement = sourceCallback.element; } Element responseElement = invokeInternal(requestElement); return responseElement != null ? convertResponse(responseElement) : null; }
public final Source invoke(Source request) throws Exception { Element requestElement = null; if (request != null) { XomSourceCallback sourceCallback = new XomSourceCallback(); try { TraxUtils.doWithSource(request, sourceCallback); } catch (XomParsingException ex) { throw (ParsingException) ex.getCause(); } requestElement = sourceCallback.element; } Element responseElement = invokeInternal(requestElement); return responseElement != null ? convertResponse(responseElement) : null; }
@Override public final Source invoke(Source request) throws Exception { Element requestElement = null; if (request != null) { XomSourceCallback sourceCallback = new XomSourceCallback(); try { TraxUtils.doWithSource(request, sourceCallback); } catch (XomParsingException ex) { throw (ParsingException) ex.getCause(); } requestElement = sourceCallback.element; } Element responseElement = invokeInternal(requestElement); return responseElement != null ? convertResponse(responseElement) : null; }
@Override public final Source invoke(Source request) throws Exception { Element requestElement = null; if (request != null) { XomSourceCallback sourceCallback = new XomSourceCallback(); try { TraxUtils.doWithSource(request, sourceCallback); } catch (XomParsingException ex) { throw (ParsingException) ex.getCause(); } requestElement = sourceCallback.element; } Element responseElement = invokeInternal(requestElement); return responseElement != null ? convertResponse(responseElement) : null; }
private Object evaluate(String expression, Source context, QName returnType) throws XPathException { XPath xpath = createXPath(); if (getNamespaces() != null && !getNamespaces().isEmpty()) { SimpleNamespaceContext namespaceContext = new SimpleNamespaceContext(); namespaceContext.setBindings(getNamespaces()); xpath.setNamespaceContext(namespaceContext); } try { EvaluationCallback callback = new EvaluationCallback(xpath, expression, returnType); TraxUtils.doWithSource(context, callback); return callback.result; } catch (javax.xml.xpath.XPathException ex) { throw new XPathException("Could not evaluate XPath expression [" + expression + "]", ex); } catch (TransformerException ex) { throw new XPathException("Could not transform context to DOM Node", ex); } catch (Exception ex) { throw new XPathException(ex.getMessage(), ex); } }
private Object evaluate(String expression, Source context, QName returnType) throws XPathException { XPath xpath = createXPath(); if (getNamespaces() != null && !getNamespaces().isEmpty()) { SimpleNamespaceContext namespaceContext = new SimpleNamespaceContext(); namespaceContext.setBindings(getNamespaces()); xpath.setNamespaceContext(namespaceContext); } try { EvaluationCallback callback = new EvaluationCallback(xpath, expression, returnType); TraxUtils.doWithSource(context, callback); return callback.result; } catch (javax.xml.xpath.XPathException ex) { throw new XPathException("Could not evaluate XPath expression [" + expression + "]", ex); } catch (TransformerException ex) { throw new XPathException("Could not transform context to DOM Node", ex); } catch (Exception ex) { throw new XPathException(ex.getMessage(), ex); } }