Package org.apache.axis2.om

Examples of org.apache.axis2.om.OMText


        //check if there is an href attribute
        OMAttribute hrefAttr = (OMAttribute)child.getFirstAttribute(new QName("href"));
        String hrefContentId = validateHref(hrefAttr);
       
        if (hrefContentId!=null) {//This is an element referencing an attachment!
          OMText omText = getOMTextForReferencedAttachment(hrefContentId, soapMsg);
          child.build();
          child.removeAttribute(hrefAttr);
          child.addChild(omText);
         
        } else { //possibly there can be references in the children of this element
View Full Code Here


    private void extractAttachmentNodes(OMElement element, SOAPMessage soapMsg){
      Iterator childIter = element.getChildren();
      while(childIter.hasNext()) {
        OMNode child = (OMNode)childIter.next();
        if(child instanceof OMText){
          OMText binaryNode = (OMText)child;
          DataHandler actualDH = (DataHandler)binaryNode.getDataHandler();
          if(actualDH != null){
            AttachmentPart ap = soapMsg.createAttachmentPart(actualDH);
            String contentId = SessionUtils.generateSessionId();
            ap.setContentId(contentId);
            ap.setContentType(actualDH.getContentType());
            OMElement parent = (OMElement)child.getParent();
            OMAttribute attr = org.apache.axis2.om.OMAbstractFactory.getOMFactory().createOMAttribute("href", null,"cid:"+contentId);
            parent.addAttribute(attr);
            binaryNode.detach();
            soapMsg.addAttachmentPart(ap);
          }
        } else{
        if(child instanceof OMElement) {
          OMElement childElement = (OMElement)child;
View Full Code Here

        OMNamespace ns1 = factory.createOMNamespace("bar", "x");
        OMElement root = factory.createOMElement("root", ns1);
        OMNamespace ns2 = root.declareNamespace("bar", "y");
        OMElement elt1 = factory.createOMElement("foo", ns1);
        OMElement elt2 = factory.createOMElement("yuck", ns2);
        OMText txt1 = factory.createText(elt2, "blah");
        elt2.addChild(txt1);
        elt1.addChild(elt2);
        root.addChild(elt1);
        root.serialize(writer);
    }
View Full Code Here

            OMElement result = call.invokeBlocking(operationName
                    .getLocalPart(),
                    payload);
            OMElement ele = (OMElement) result.getFirstOMChild();
            OMElement ele1 = (OMElement) ele.getFirstOMChild();
            OMText binaryNode = (OMText) ele1.getFirstOMChild();
            compareWithActualOMText(binaryNode);
            log.info("" + i);
            UtilServer.unDeployClientService();
        }
    }
View Full Code Here

        ImageDataSource dataSource = new ImageDataSource("test.jpg",
                expectedImage);
        expectedDH = new DataHandler(dataSource);
        OMElement subData = fac.createOMElement("subData", omNs);
        OMText textData = new OMTextImpl(expectedDH);
        subData.addChild(textData);
        data.addChild(subData);
        rpcWrapEle.addChild(data);
        return rpcWrapEle;
View Full Code Here

        OMElement element = factory.createOMElement(
                new QName("MyFirstBodyElement"), soapEnvelope.getBody());
        OMElement element11 = factory.createOMElement(
                new QName("MyFirstBodyElement"), element);
        OMText optimizedText = factory.createText("Hi", "text/plain", true);
        element11.addChild(optimizedText);
        assertTrue(
                "optmization check has not performed correctly in SOAPEnvelope",
                HTTPTransportUtils.checkEnvelopeForOptimise(soapEnvelope));
    }
View Full Code Here

        OMElement element = factory.createOMElement(
                new QName("MyFirstBodyElement"), soapEnvelope.getBody());
        OMElement element11 = factory.createOMElement(
                new QName("MyFirstBodyElement"), element);
        OMText optimizedText = factory.createText("Hi", "text/plain", false);
        element11.addChild(optimizedText);
        assertFalse(
                "optmization check has not performed correctly in SOAPEnvelope",
                HTTPTransportUtils.checkEnvelopeForOptimise(soapEnvelope));
    }
View Full Code Here

        Callback callback = new Callback() {
            public void onComplete(AsyncResult result) {
                SOAPEnvelope envelope = result.getResponseEnvelope();
               
                OMElement ele = (OMElement) envelope.getBody().getFirstElement().getFirstOMChild();
                OMText binaryNode = (OMText) ele.getFirstOMChild();
               
                // to the assert equal
                compareWithCreatedOMText(binaryNode);
                finish = true;
            }
View Full Code Here

                .getLocalPart(),
                payload);
        // result.serializeAndConsume(new
        // OMOutput(XMLOutputFactory.newInstance().createXMLStreamWriter(System.out)));
        OMElement ele = (OMElement) result.getFirstOMChild();
        OMText binaryNode = (OMText) ele.getFirstOMChild();
       
        // to the assert equal
        compareWithCreatedOMText(binaryNode);
       
        // Save the image
        DataHandler actualDH;
        actualDH = (DataHandler)binaryNode.getDataHandler();
        Image actualObject = new ImageIO().loadImage(actualDH.getDataSource()
                .getInputStream());
//        FileOutputStream imageOutStream = new FileOutputStream("target/testout.jpg");
//        new ImageIO().saveImage("image/jpeg", actualObject, imageOutStream);
View Full Code Here

                .loadImage(new FileInputStream(inputFile));

        ImageDataSource dataSource = new ImageDataSource("test.jpg",
                expectedImage);
        expectedDH = new DataHandler(dataSource);
        OMText textData = fac.createText(expectedDH, true);
        image.addChild(textData);

        OMElement imageName = fac.createOMElement("fileName", omNs);
        if (fileName != null) {
            imageName.setText(fileName);
View Full Code Here

TOP

Related Classes of org.apache.axis2.om.OMText

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.