Java Code Examples for org.apache.axiom.om.OMElement#getFirstOMChild()
The following examples show how to use
org.apache.axiom.om.OMElement#getFirstOMChild() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MTOMSwASampleService.java From micro-integrator with Apache License 2.0 | 6 votes |
public void oneWayUploadUsingMTOM(OMElement element) throws Exception { OMText binaryNode = (OMText) element.getFirstOMChild(); DataHandler dataHandler = (DataHandler) binaryNode.getDataHandler(); InputStream is = dataHandler.getInputStream(); File tempFile = File.createTempFile("mtom-", ".gif"); FileOutputStream fos = new FileOutputStream(tempFile); BufferedOutputStream dest = new BufferedOutputStream(fos, BUFFER); byte data[] = new byte[BUFFER]; int count; while ((count = is.read(data, 0, BUFFER)) != -1) { dest.write(data, 0, count); } dest.flush(); dest.close(); System.out.println("Wrote to file : " + tempFile.getAbsolutePath()); }
Example 2
Source File: MTOMSwASampleService.java From micro-integrator with Apache License 2.0 | 6 votes |
public void oneWayUploadUsingMTOM(OMElement element) throws Exception { OMText binaryNode = (OMText) element.getFirstOMChild(); DataHandler dataHandler = (DataHandler) binaryNode.getDataHandler(); InputStream is = dataHandler.getInputStream(); File tempFile = File.createTempFile("mtom-", ".gif"); FileOutputStream fos = new FileOutputStream(tempFile); BufferedOutputStream dest = new BufferedOutputStream(fos, BUFFER); byte data[] = new byte[BUFFER]; int count; while ((count = is.read(data, 0, BUFFER)) != -1) { dest.write(data, 0, count); } dest.flush(); dest.close(); System.out.println("Wrote to file : " + tempFile.getAbsolutePath()); }
Example 3
Source File: BinaryExtractMediator.java From micro-integrator with Apache License 2.0 | 6 votes |
public boolean mediate(MessageContext msgCtx) { try { log.debug("BinaryExtractMediator Process, with offset: "+offset+" ,length "+length); SOAPBody soapBody = msgCtx.getEnvelope().getBody(); OMElement firstElement = soapBody.getFirstElement(); log.debug("First Element : "+firstElement.getLocalName()); log.debug("First Element Text : "+firstElement.getText()); OMText binaryNode =(OMText) firstElement.getFirstOMChild(); log.debug("First Element Node Text : "+binaryNode.getText()); DataHandler dataHandler =(DataHandler) binaryNode.getDataHandler(); InputStream inputStream = dataHandler.getInputStream(); byte[] searchByte = new byte[length]; inputStream.skip(offset - 1); int readBytes = inputStream.read(searchByte,0,length); String outString = new String(searchByte,binaryEncoding); msgCtx.setProperty(variableName,outString); log.debug("Set property to MsgCtx, "+variableName+" = "+outString); inputStream.close(); } catch (IOException e) { log.error("Excepton on mediation : "+e.getMessage()); } return true; }
Example 4
Source File: MTOMSwASampleService.java From micro-integrator with Apache License 2.0 | 6 votes |
public void oneWayUploadUsingMTOM(OMElement element) throws Exception { OMText binaryNode = (OMText) element.getFirstOMChild(); DataHandler dataHandler = (DataHandler) binaryNode.getDataHandler(); InputStream is = dataHandler.getInputStream(); File tempFile = File.createTempFile("mtom-", ".gif"); FileOutputStream fos = new FileOutputStream(tempFile); BufferedOutputStream dest = new BufferedOutputStream(fos, BUFFER); byte data[] = new byte[BUFFER]; int count; while ((count = is.read(data, 0, BUFFER)) != -1) { dest.write(data, 0, count); } dest.flush(); dest.close(); System.out.println("Wrote to file : " + tempFile.getAbsolutePath()); }
Example 5
Source File: BinaryExtractMediator.java From micro-integrator with Apache License 2.0 | 6 votes |
public boolean mediate(MessageContext msgCtx) { try { log.debug("BinaryExtractMediator Process, with offset: "+offset+" ,length "+length); SOAPBody soapBody = msgCtx.getEnvelope().getBody(); OMElement firstElement = soapBody.getFirstElement(); log.debug("First Element : "+firstElement.getLocalName()); log.debug("First Element Text : "+firstElement.getText()); OMText binaryNode =(OMText) firstElement.getFirstOMChild(); log.debug("First Element Node Text : "+binaryNode.getText()); DataHandler dataHandler =(DataHandler) binaryNode.getDataHandler(); InputStream inputStream = dataHandler.getInputStream(); byte[] searchByte = new byte[length]; inputStream.skip(offset - 1); int readBytes = inputStream.read(searchByte,0,length); String outString = new String(searchByte,binaryEncoding); msgCtx.setProperty(variableName,outString); log.debug("Set property to MsgCtx, "+variableName+" = "+outString); inputStream.close(); } catch (IOException e) { log.error("Excepton on mediation : "+e.getMessage()); } return true; }
Example 6
Source File: MTOMSwASampleService.java From product-ei with Apache License 2.0 | 6 votes |
public void oneWayUploadUsingMTOM(OMElement element) throws Exception { OMText binaryNode = (OMText) element.getFirstOMChild(); DataHandler dataHandler = (DataHandler) binaryNode.getDataHandler(); InputStream is = dataHandler.getInputStream(); File tempFile = File.createTempFile("mtom-", ".gif"); FileOutputStream fos = new FileOutputStream(tempFile); BufferedOutputStream dest = new BufferedOutputStream(fos, BUFFER); byte data[] = new byte[BUFFER]; int count; while ((count = is.read(data, 0, BUFFER)) != -1) { dest.write(data, 0, count); } dest.flush(); dest.close(); System.out.println("Wrote to file : " + tempFile.getAbsolutePath()); }
Example 7
Source File: BinaryExtractMediator.java From product-ei with Apache License 2.0 | 6 votes |
public boolean mediate(MessageContext msgCtx) { try { log.debug("BinaryExtractMediator Process, with offset: "+offset+" ,length "+length); SOAPBody soapBody = msgCtx.getEnvelope().getBody(); OMElement firstElement = soapBody.getFirstElement(); log.debug("First Element : "+firstElement.getLocalName()); log.debug("First Element Text : "+firstElement.getText()); OMText binaryNode =(OMText) firstElement.getFirstOMChild(); log.debug("First Element Node Text : "+binaryNode.getText()); DataHandler dataHandler =(DataHandler) binaryNode.getDataHandler(); InputStream inputStream = dataHandler.getInputStream(); byte[] searchByte = new byte[length]; inputStream.skip(offset - 1); int readBytes = inputStream.read(searchByte,0,length); String outString = new String(searchByte,binaryEncoding); msgCtx.setProperty(variableName,outString); log.debug("Set property to MsgCtx, "+variableName+" = "+outString); inputStream.close(); } catch (IOException e) { log.error("Excepton on mediation : "+e.getMessage()); } return true; }
Example 8
Source File: Mtom.java From openxds with Apache License 2.0 | 6 votes |
public void decode(OMElement document) throws XdsIOException, IOException { this.document = document; OMText binaryNode = (OMText) document.getFirstOMChild(); //System.out.println("isOptimized: " + binaryNode.isOptimized()); xop = binaryNode.isOptimized(); if (xop) { javax.activation.DataHandler datahandler = (javax.activation.DataHandler) binaryNode.getDataHandler(); InputStream is = null; try { is = datahandler.getInputStream(); contents = Io.getBytesFromInputStream(is); } catch (IOException e) { throw new XdsIOException("Error accessing XOP encoded document content from message"); } this.content_type = datahandler.getContentType(); } else { String base64 = binaryNode.getText(); contents = Base64.decodeBase64(base64.getBytes()); this.content_type = null; } }
Example 9
Source File: BatchDataServiceRequest.java From micro-integrator with Apache License 2.0 | 5 votes |
/** * @see DataServiceRequest#processRequest() */ @Override public OMElement processRequest() throws DataServiceFault { boolean error = true; try { /* signal that we are batch processing */ DispatchStatus.setBatchRequest(); List<SingleDataServiceRequest> requests = this.getDSRequests(); int count = requests.size(); /* set the batch request count in TL */ DispatchStatus.setBatchRequestCount(count); /* dispatch individual requests */ OMElement result = null; for (int i = 0; i < count; i++) { /* set the current batch request number in TL */ DispatchStatus.setBatchRequestNumber(i); /* execute/enqueue request */ OMElement element = requests.get(i).dispatch(); if (element != null && element.getFirstOMChild() != null) { result = element; } } /* signal that there aren't any errors */ error = false; /* no result in batch requests */ return result; } finally { /* finalize transactions */ this.finalizeTx(error); /* release participants */ releaseParticipantResources(); clearParticipants(); clearStatus(); } }