Package org.apache.axis2.om

Examples of org.apache.axis2.om.OMOutput


     * @param result
     */
    public void onComplete(AsyncResult result) {
         System.out.println("Responce message received to the ClientCallbackHandler ...");
        try {
            OMOutput omOutput = new OMOutput(XMLOutputFactory.newInstance().createXMLStreamWriter(System.out));
            result.getResponseEnvelope().serialize(omOutput);
            omOutput.flush();
        } catch (XMLStreamException e) {
            System.out.println("Error occured after responce is received");
            e.printStackTrace();
        } catch (FactoryConfigurationError e) {
            System.out.println("Error occured after responce is received");
View Full Code Here


        call.set(Constants.Configuration.ENABLE_MTOM,Constants.VALUE_TRUE);
        call.setTransportInfo(Constants.TRANSPORT_HTTP, Constants.TRANSPORT_HTTP, false);

        OMElement result =
                (OMElement) call.invokeBlocking(operationName.getLocalPart(), payload);
        result.serializeWithCache(new OMOutput(XMLOutputFactory.newInstance().createXMLStreamWriter(System.out)));
        call.close();
        System.out.println(i);
      }
    }
View Full Code Here

                call.setTransportInfo(Constants.TRANSPORT_MAIL, Constants.TRANSPORT_MAIL, true);
                Callback callback = new Callback() {
                    public void onComplete(AsyncResult result) {
                        try {
                            result.getResponseEnvelope().serialize(
                                new OMOutput(XMLOutputFactory.newInstance().createXMLStreamWriter(System.out)));
                        } catch (XMLStreamException e) {
                            reportError(e);
                        } finally {
                            finish = true;
                        }
View Full Code Here

  /* (non-Javadoc)
   * @see javax.xml.soap.SOAPMessage#writeTo(java.io.OutputStream)
   */
  public void writeTo(OutputStream out) throws SOAPException, IOException {
    try{
    OMOutput omOutput = new OMOutput(XMLOutputFactory.newInstance().createXMLStreamWriter(out));
    ((SOAPEnvelopeImpl)mSOAPPart.getEnvelope()).getOMEnvelope().serialize(omOutput);
    omOutput.flush();
    } catch(Exception e){
      throw new SOAPException(e);
    }
  }
View Full Code Here

            //EndpointReference targetEPR = new EndpointReference(AddressingConstants.WSA_TO, "http://127.0.0.1:" + Utils.TESTING_PORT + "/axis/services/EchoXMLService");
           
            call.setTransportInfo(Constants.TRANSPORT_HTTP,Constants.TRANSPORT_HTTP,false);
            call.setTo(targetEPR);
            OMElement result = call.invokeBlocking(operationName.getLocalPart(),method);
            OMOutput omOutput = new OMOutput(XMLOutputFactory.newInstance().createXMLStreamWriter(System.out));
            result.serialize(omOutput);
           omOutput.flush();
            fail("the test must fail due to bad service Name");
        } catch (AxisFault e) {
            e.printStackTrace();
            assertTrue((e.getMessage().indexOf(UtilServer.FAILURE_MESSAGE)) > 0);
            return;
View Full Code Here

    if (envelope != null && msgContext.isDoingREST()) {
      outputMessage = envelope.getBody().getFirstElement();
    }

    if (outputMessage != null) {
      OMOutput omOutput = null;

      try {
        if (msgContext.isDoingMTOM()) {
          omOutput = new OMOutput(out, true);
          outputMessage.serialize(omOutput);
          omOutput.flush();
                    omOutput.complete();
          out.flush();
        } else {
          omOutput = new OMOutput(out, false);
          outputMessage.serialize(omOutput);
          omOutput.flush();
          out.flush();
        }
      } catch (Exception e) {
        throw new AxisFault("Stream error", e);
      }
View Full Code Here

        assertFalse("SOAP 1.2 Fault Test with parser: - getDetail method returns null", soap12FaultWithParser.getDetail() == null);
        assertTrue("SOAP 1.2 Fault Test with parser: - Fault detail local name mismatch", soap12FaultWithParser.getDetail().getLocalName().equals(SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME));
    }

    public void testMoreChildrenAddition() {
        OMOutput output = null;
        try {
            output = new OMOutput(System.out, false);
            SOAPFactory soapFactory = OMAbstractFactory.getSOAP12Factory();
            SOAPEnvelope envelope = soapFactory.getDefaultFaultEnvelope();

            assertNotNull("Default FaultEnvelope must have a SOAPFault in it", envelope.getBody().getFault());
            assertNotNull("Default FaultEnvelope must have a SOAPFaultCode in it", envelope.getBody().getFault().getCode());
View Full Code Here

 
  public void testImageSampleSerialize() throws Exception {
   
    outMTOMFile = getTestResourceFile(outFileName);
    outBase64File = getTestResourceFile(outBase64FileName);
    OMOutput mtomOutput = new OMOutput(new FileOutputStream(outMTOMFile),true);
    OMOutput baseOutput = new OMOutput(new FileOutputStream(outBase64File),false);
   
    OMNamespaceImpl soap = new OMNamespaceImpl(
        "http://schemas.xmlsoap.org/soap/envelope/", "soap");
    OMElement envelope = new OMElementImpl("Envelope", soap);
    OMElement body = new OMElementImpl("Body", soap);
   
    OMNamespaceImpl dataName = new OMNamespaceImpl(
        "http://www.example.org/stuff", "m");
    OMElement data = new OMElementImpl("data", dataName);
   
    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);
   
    envelope.serialize(baseOutput);
    baseOutput.flush();
   
    envelope.serialize(mtomOutput);
    mtomOutput.flush();
    mtomOutput.complete();
  }
View Full Code Here

    }
  }

  public void testComplete() throws Exception {

    OMOutput mtomOutput = new OMOutput(new FileOutputStream(
        outMTOMFile), true);
    OMOutput baseOutput = new OMOutput(new FileOutputStream(
        outBase64File), false);

    envelope.serialize(baseOutput);
    baseOutput.flush();

    envelope.serialize(mtomOutput);

    mtomOutput.complete();
  }
View Full Code Here

    protected void setUp() throws Exception {
        readerOne = XMLInputFactory.newInstance().
                createXMLStreamReader(new InputStreamReader(new ByteArrayInputStream(xmlTextOne.getBytes())));
        readerTwo = XMLInputFactory.newInstance().
                createXMLStreamReader(new InputStreamReader(new ByteArrayInputStream(xmlTextTwo.getBytes())));
        omOutput = new OMOutput(XMLOutputFactory.newInstance().
                createXMLStreamWriter(System.out));
        builderOne = OMXMLBuilderFactory.createStAXSOAPModelBuilder(OMAbstractFactory.getSOAP11Factory(), readerOne);
        builderTwo = OMXMLBuilderFactory.createStAXSOAPModelBuilder(OMAbstractFactory.getSOAP11Factory(), readerTwo);
    }
View Full Code Here

TOP

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

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.