當前位置: 首頁>>代碼示例>>Java>>正文


Java OMElement.getFirstOMChild方法代碼示例

本文整理匯總了Java中org.apache.axiom.om.OMElement.getFirstOMChild方法的典型用法代碼示例。如果您正苦於以下問題:Java OMElement.getFirstOMChild方法的具體用法?Java OMElement.getFirstOMChild怎麽用?Java OMElement.getFirstOMChild使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.axiom.om.OMElement的用法示例。


在下文中一共展示了OMElement.getFirstOMChild方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: oneWayUploadUsingMTOM

import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
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());
    }
 
開發者ID:wso2,項目名稱:product-ei,代碼行數:21,代碼來源:MTOMSwASampleService.java

示例2: mediate

import org.apache.axiom.om.OMElement; //導入方法依賴的package包/類
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;
}
 
開發者ID:wso2,項目名稱:product-ei,代碼行數:24,代碼來源:BinaryExtractMediator.java


注:本文中的org.apache.axiom.om.OMElement.getFirstOMChild方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。