Package org.apache.axis2.om

Examples of org.apache.axis2.om.OMText


    public void testOptimizedEnvelope(){
        SOAPEnvelope soapEnvelope = factory.getDefaultEnvelope();

        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


    public void testNonOptimizedEnvelope(){
        SOAPEnvelope soapEnvelope = factory.getDefaultEnvelope();

        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

    OMElement result = (OMElement) call.invokeBlocking(operationName
        .getLocalPart(), payload);
    // result.serializeWithCache(new
    // OMOutput(XMLOutputFactory.newInstance().createXMLStreamWriter(System.out)));
    OMElement ele = (OMElement) result.getFirstChild();
    OMText binaryNode = (OMText) ele.getFirstChild();
    DataHandler actualDH;
    actualDH = binaryNode.getDataHandler();
    Image actualObject = new JDK13IO().loadImage(actualDH.getDataSource()
        .getInputStream());
    FileOutputStream imageOutStream = new FileOutputStream("testout.jpg");
    new JDK13IO().saveImage("image/jpeg", actualObject, imageOutStream);
View Full Code Here

    }

    //SOAP 1.1 Fault Detail Test (With Parser)
    public void testSOAP11GetAllDetailEntriesWithParser() {
        Iterator iterator = soap11FaultDetailWithParser.getAllDetailEntries();
        OMText textEntry = (OMText)iterator.next();
        assertFalse("SOAP 1.1 Fault Detail Test With Parser : - getAllDetailEntries method returns empty iterator",textEntry == null);
        assertTrue("SOAP 1.1 Fault Detail Test With Parser : - text value mismatch",textEntry.getText().trim().equals("Details of error"));
        OMElement detailEntry1 = (OMElement)iterator.next();
        assertFalse("SOAP 1.1 Fault Detail Test With Parser : - getAllDetailEntries method returns an itrator without detail entries",detailEntry1 == null);
        assertTrue("SOAP 1.1 Fault Detail Test With Parser : - detailEntry1 localname mismatch",detailEntry1.getLocalName().equals("MaxTime"));
        iterator.next();
        OMElement detailEntry2 = (OMElement)iterator.next();
View Full Code Here

    }

    //SOAP 1.2 Fault Detail Test (With Parser)
    public void testSOAP12GetAllDetailEntriesWithParser() {
        Iterator iterator = soap12FaultDetailWithParser.getAllDetailEntries();
        OMText textEntry = (OMText)iterator.next();
        assertFalse("SOAP 1.2 Fault Detail Test With Parser : - getAllDetailEntries method returns empty iterator",textEntry == null);
        assertTrue("SOAP 1.2 Fault Detail Test With Parser : - text value mismatch",textEntry.getText().trim().equals("Details of error"));
        OMElement detailEntry1 = (OMElement)iterator.next();
        assertFalse("SOAP 1.2 Fault Detail Test With Parser : - getAllDetailEntries method returns an itrator without detail entries",detailEntry1 == null);
        assertTrue("SOAP 1.2 Fault Detail Test With Parser : - detailEntry1 localname mismatch",detailEntry1.getLocalName().equals("MaxTime"));
        iterator.next();
        OMElement detailEntry2 = (OMElement)iterator.next();
View Full Code Here

        return in;
    }
   
    public OMElement echoMTOMtoBase64(OMElement omEle)
    {
      OMText omText  = (OMText)omEle.getFirstChild();
      omText.doOptimize(false);
      return omEle;
    }
View Full Code Here

    expectedImage = new JDK13IO().loadImage(new FileInputStream(
        getTestResourceFile(imageInFileName)));
    ImageDataSource dataSource = new ImageDataSource("WaterLilies.jpg",
        expectedImage);
    expectedDH = new DataHandler(dataSource);
    OMText binaryNode = new OMTextImpl(expectedDH, true);
   
    envelope.addChild(body);
    body.addChild(data);
    data.addChild(binaryNode);
   
View Full Code Here

            .getSOAPPartInputStream())));
    builder = new MTOMStAXSOAPModelBuilder(reader, mimeHelper);
    OMElement root = (OMElement) builder.getDocumentElement();
    OMElement body = (OMElement) root.getFirstChild();
    OMElement data = (OMElement) body.getFirstChild();
    OMText blob = (OMText) data.getFirstChild();
    /*
     * Following is the procedure the user has to follow to read objects in
     * OBBlob User has to know the object type & whether it is serializable.
     * If it is not he has to use a Custom Defined DataSource to get the
     * Object.
     */
   
    DataHandler actualDH;
    actualDH = blob.getDataHandler();
    Image actualObject = new JDK13IO().loadImage(actualDH.getDataSource()
        .getInputStream());
    FileOutputStream imageOutStream = new FileOutputStream(
        getTestResourceFile(imageOutFileName));
    new JDK13IO().saveImage("image/jpeg", actualObject, imageOutStream);
View Full Code Here

    System.out.println(data.getLocalName() + " : "
        + data.getNamespace().getName());
    Iterator childIt = data.getChildren();
    //while (childIt.hasNext()) {
    OMElement child = (OMElement) childIt.next();
    OMText blob = (OMText) child.getFirstChild();
    /*
     * Following is the procedure the user has to follow to read objects in
     * OBBlob User has to know the object type & whether it is serializable.
     * If it is not he has to use a Custom Defined DataSource to get the
     * Object.
     */
    byte[] expectedObject = new byte[] { 13, 56, 65, 32, 12, 12, 7, -3, -2,
        -1, 98 };
    DataHandler actualDH;
    actualDH = blob.getDataHandler();
    //ByteArrayInputStream object = (ByteArrayInputStream) actualDH
    //.getContent();
    //byte[] actualObject= null;
    //  object.read(actualObject,0,10);
   
View Full Code Here

    private void processText(XMLStreamReader parser, OMElement value) {
        try {
            int token = parser.next();
            while (token != XMLStreamReader.END_ELEMENT) {
                if (token == XMLStreamReader.CHARACTERS) {
                    OMText text = factory.createText(value, parser.getText());
                    value.addChild(text);
                } else {
                    throw new SOAPProcessingException("Only Characters are allowed here");
                }
                token = parser.next();
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.