public InputStream newInputStream(XmlOptions options) { return underlyingXmlObject().newInputStream(options); }
public InputStream newInputStream() { return underlyingXmlObject().newInputStream(); }
public InputStream newInputStream() { return underlyingXmlObject().newInputStream(); }
public InputStream newInputStream() { return underlyingXmlObject().newInputStream(); }
public InputStream newInputStream(XmlOptions options) { return underlyingXmlObject().newInputStream(options); }
public InputStream newInputStream(XmlOptions options) { return underlyingXmlObject().newInputStream(options); }
public Response post(Reference uri, XmlObject document) throws NotSuccessException { return post(uri, new InputRepresentation( document.newInputStream(xmlOptions), restType)); }
public Response put(Reference uri, XmlObject document) throws NotSuccessException { return put(uri, new InputRepresentation( document.newInputStream(xmlOptions), restType)); }
public static void assign(MessageDAO m, XmlObject o) throws Exception { NodeList nodes = DOMUtils.parse(o.newInputStream(new XmlOptions().setSaveOuter())).getDocumentElement().getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { Node n = nodes.item(i); if (n instanceof Element) { m.setData((Element) n); } } }
@Override public InputStream generateStream(IData data, String mimeType, String schema) throws IOException { if(data instanceof GenericXMLDataBinding){ XmlObject xmlData = ((GenericXMLDataBinding)data).getPayload(); XmlOptions xmlOptions = new XmlOptions(); xmlOptions.setSaveNoXmlDecl(); return xmlData.newInputStream(xmlOptions); } return XmlObject.Factory.newInstance().newInputStream(); }
@SuppressWarnings("unchecked") private static OMElement convertToOM(Object obj) { if (obj instanceof XmlObject) { try { return new StAXOMBuilder(((XmlObject)obj).newInputStream()).getDocumentElement(); } catch (XMLStreamException e) { throw new RuntimeException("Couldn't serialize result to an outgoing messages.", e); } } else if (obj instanceof List) { OMElement listElmt = OM.createOMElement("list", null); for (Object stuff : ((List) obj)) { OMElement stuffElmt = OM.createOMElement("element", null); stuffElmt.setText(stuff.toString()); listElmt.addChild(stuffElmt); } return listElmt; } else throw new RuntimeException("Couldn't convert object " + obj + " into a response element."); }
@Override public OperationResult doOperation(Operation operation, ParameterContainer parameters) throws ExceptionReport, OXFException { try { String httpGETRequest = createHttpGETRequest(operation, parameters); LOGGER.debug("Send GET request '{}'", httpGETRequest); HttpResponse httpResponse = httpClient.executeGet(httpGETRequest); HttpEntity responseEntity = httpResponse.getEntity(); String responseString = inputStreamToString(responseEntity.getContent()); XmlObject response = parseToXmlObject(responseString); OperationResult result = new OperationResult(response.newInputStream(), parameters, httpGETRequest); checkForExceptionReport(result, response); return result; } catch (IOException e) { throw new OXFException("Error while reading operation result.", e); } catch (XmlException e) { throw new OXFException("Could not parse response to XML.", e); } catch (HttpClientException e) { throw new OXFException("Could not send request.", e); } }
public OMElement toOMElement(Object scriptXML) throws ScriptException { if (scriptXML == null) { return null; } if (!(scriptXML instanceof XMLObject)) { return null; } // TODO: E4X Bug? Shouldn't need this copy, but without it the outer element gets lost??? Scriptable jsXML = (Scriptable) ScriptableObject.callMethod((Scriptable) scriptXML, "copy", new Object[0]); Wrapper wrapper = (Wrapper) ScriptableObject.callMethod(jsXML, "getXmlObject", new Object[0]); XmlObject xmlObject = (XmlObject) wrapper.unwrap(); try { StAXOMBuilder builder = new StAXOMBuilder(xmlObject.newInputStream()); return builder.getDocumentElement(); } catch (XMLStreamException e) { throw new ScriptException(e); } }
public static InputStream createInputStream(XmlObject xmlObject, boolean writeXMLDeclaration) throws GenericException, ValidationException { // Create an XmlOptions instance and set the error listener. XmlOptions validateOptions = new XmlOptions(); List<XmlValidationError> errorList = new ArrayList<>(); validateOptions.setErrorListener(errorList); // Validate the XML. boolean isValid = xmlObject.validate(validateOptions); if (isValid) { XmlOptions xmlSaveOptions = new XmlOptions().setUseDefaultNamespace().setSavePrettyPrint() .setSaveAggressiveNamespaces(); if (!writeXMLDeclaration) { xmlSaveOptions = xmlSaveOptions.setSaveNoXmlDecl(); } return xmlObject.newInputStream(xmlSaveOptions); } else { throw new ValidationException(xmlValidationErrorsToValidationReport(errorList)); } }
try { soapMessageRequest = SoapHelper.getSoapMessageForProtocol(SOAPConstants.SOAP_1_1_PROTOCOL, doc.newInputStream()); } catch (IOException | SOAPException ioe) { throw new NoApplicableCodeException().causedBy(ioe)
try { soapMessageRequest = SoapHelper.getSoapMessageForProtocol(SOAPConstants.SOAP_1_1_PROTOCOL, doc.newInputStream()); } catch (IOException ioe) { throw new NoApplicableCodeException().causedBy(ioe).withMessage(
smlDoc = SensorMLDocument.Factory.newInstance(); Member member = smlDoc.addNewSensorML().addNewMember(); member.set(XMLBeansParser.parse(object.newInputStream())); } else { smlDoc = SensorMLDocument.Factory.parse(dataDescription.newInputStream());
SOAPMessage message; try { message = SoapHelper.getSoapMessageForProtocol(SOAPConstants.SOAP_1_2_PROTOCOL, doc.newInputStream()); } catch (IOException | SOAPException ioe) { throw new NoApplicableCodeException().causedBy(ioe)
SOAPMessage message; try { message = SoapHelper.getSoapMessageForProtocol(SOAPConstants.SOAP_1_2_PROTOCOL, doc.newInputStream()); } catch (IOException ioe) { throw new NoApplicableCodeException().causedBy(ioe).withMessage(