Package org.apache.axis2.jaxws.message.util

Examples of org.apache.axis2.jaxws.message.util.SAAJConverter


    SOAPBody body = message.getSOAPBody();
   
    // Step 1: Get the SAAJConverter object from the Factory
    SAAJConverterFactory f = (SAAJConverterFactory)
      FactoryRegistry.getFactory(SAAJConverterFactory.class);
    SAAJConverter converter = f.getSAAJConverter();
   
    // Step 2: Convert OM to SAAJ
    SOAPElement se = converter.toSAAJ(om, body);
   
    // Step 2a: Verify
    assertTrue(se instanceof SOAPBodyElement);
    assertTrue(se.getLocalName().equals("a"));
   
    // Step 3: Convert SAAJ to OM
    om = converter.toOM(se);
   
    // Step 3a: Verify
    assertTrue(om.getLocalName().equals("a"));
   
    // Step 4: Rinse and Repeat
    se = converter.toSAAJ(om, body);
    assertTrue(se instanceof SOAPBodyElement);
    assertTrue(se.getLocalName().equals("a"));
    om = converter.toOM(se);
    assertTrue(om.getLocalName().equals("a"));
  }
View Full Code Here


    public void test3() throws Exception {
     
//       Step 1: Get the SAAJConverter object from the Factory
    SAAJConverterFactory f = (SAAJConverterFactory)
      FactoryRegistry.getFactory(SAAJConverterFactory.class);
    SAAJConverter converter = f.getSAAJConverter();
   
    // Stept 2: Create OM and parent SOAPElement
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace wrapNs = fac.createOMNamespace("namespace", "prefix");
        OMElement ome = fac.createOMElement("localname", wrapNs);
        SOAPFactory sf = SOAPFactory.newInstance();
        SOAPElement se = sf.createElement("name");
       
        // Step 3: Do the conversion
        converter.toSAAJ(ome, se, sf);
    }
View Full Code Here

    org.apache.axiom.soap.SOAPEnvelope omEnvelope = builder.getSOAPEnvelope();
   
    // Step 1: Get the SAAJConverter object from the Factory
    SAAJConverterFactory f = (SAAJConverterFactory)
      FactoryRegistry.getFactory(SAAJConverterFactory.class);
    SAAJConverter converter = f.getSAAJConverter();
   
    // Step 2: Convert the OM SOAPEnvelope to an SAAJ SOAPEnvelope
    SOAPEnvelope saajEnvelope = converter.toSAAJ(omEnvelope);
   
    // Step 3: Verify attribute type is stored after conversion
    Element testElement = (Element) saajEnvelope.getBody().getFirstChild().getFirstChild();
    assertTrue("b".equals(testElement.getLocalName()));
   
View Full Code Here

    org.apache.axiom.soap.SOAPEnvelope omEnvelope = builder.getSOAPEnvelope();
   
    // Step 1: Get the SAAJConverter object from the Factory
    SAAJConverterFactory f = (SAAJConverterFactory)
      FactoryRegistry.getFactory(SAAJConverterFactory.class);
    SAAJConverter converter = f.getSAAJConverter();
   
    // Step 2: Convert the OM SOAPEnvelope to an SAAJ SOAPEnvelope
    SOAPEnvelope saajEnvelope = converter.toSAAJ(omEnvelope);
   
    // Step 2a: Simple assertion check to ensure correctness.
    String name = saajEnvelope.getBody().getFirstChild().getLocalName();
    assertTrue("a".equals(name));
   
    // Step 3: Convert the SAAJ SOAPEnvelope to an OM SOAPEnvelope
    omEnvelope = converter.toOM(saajEnvelope);
   
    // Step 3a: Simple assertion check to ensure correctness
    name = omEnvelope.getBody().getFirstElement().getLocalName();
    assertTrue("a".equals(name));
   
    // Step 4: Rinse and repeat
    saajEnvelope = converter.toSAAJ(omEnvelope);
    name = saajEnvelope.getBody().getFirstChild().getLocalName();
    assertTrue("a".equals(name));
    omEnvelope = converter.toOM(saajEnvelope);
    name = omEnvelope.getBody().getFirstElement().getLocalName();
    assertTrue("a".equals(name));
  }
View Full Code Here

    SOAPBody body = message.getSOAPBody();
   
    // Step 1: Get the SAAJConverter object from the Factory
    SAAJConverterFactory f = (SAAJConverterFactory)
      FactoryRegistry.getFactory(SAAJConverterFactory.class);
    SAAJConverter converter = f.getSAAJConverter();
   
    // Step 2: Convert OM to SAAJ
    SOAPElement se = converter.toSAAJ(om, body);
   
    // Step 2a: Verify
    assertTrue(se instanceof SOAPBodyElement);
    assertTrue(se.getLocalName().equals("a"));
   
    // Step 3: Convert SAAJ to OM
    om = converter.toOM(se);
   
    // Step 3a: Verify
    assertTrue(om.getLocalName().equals("a"));
   
    // Step 4: Rinse and Repeat
    se = converter.toSAAJ(om, body);
    assertTrue(se instanceof SOAPBodyElement);
    assertTrue(se.getLocalName().equals("a"));
    om = converter.toOM(se);
    assertTrue(om.getLocalName().equals("a"));
  }
View Full Code Here

    public void test3() throws Exception {
     
//       Step 1: Get the SAAJConverter object from the Factory
    SAAJConverterFactory f = (SAAJConverterFactory)
      FactoryRegistry.getFactory(SAAJConverterFactory.class);
    SAAJConverter converter = f.getSAAJConverter();
   
    // Stept 2: Create OM and parent SOAPElement
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace wrapNs = fac.createOMNamespace("namespace", "prefix");
        OMElement ome = fac.createOMElement("localname", wrapNs);
        SOAPFactory sf = SOAPFactory.newInstance();
        SOAPElement se = sf.createElement("name");
       
        // Step 3: Do the conversion
        converter.toSAAJ(ome, se, sf);
    }
View Full Code Here

        ServerWorker worker = (ServerWorker) msgContext.getProperty(Constants.OUT_TRANSPORT_INFO);
        HttpResponse response = worker.getResponse();

        OMOutputFormat format = NhttpUtil.getOMOutputFormat(msgContext);
        MessageFormatter messageFormatter =
                MessageFormatterDecoratorFactory.createMessageFormatterDecorator(msgContext);
        Boolean noEntityBody = (Boolean) msgContext.getProperty(NhttpConstants.NO_ENTITY_BODY);
        if (noEntityBody == null || Boolean.FALSE == noEntityBody) {
            response.setHeader(
                HTTP.CONTENT_TYPE,
                messageFormatter.getContentType(msgContext, format, msgContext.getSoapAction()));
        }
        response.setStatusCode(determineHttpStatusCode(msgContext, response));

        // set any transport headers
        Map transportHeaders = (Map) msgContext.getProperty(MessageContext.TRANSPORT_HEADERS);
        if (transportHeaders != null && !transportHeaders.values().isEmpty()) {
            Iterator iter = transportHeaders.keySet().iterator();
            while (iter.hasNext()) {
                Object header = iter.next();
                Object value = transportHeaders.get(header);
                if (value != null && header instanceof String && value instanceof String) {
                    response.setHeader((String) header, (String) value);
                }
            }
        }

        boolean forceContentLength = msgContext.isPropertyTrue(
                NhttpConstants.FORCE_HTTP_CONTENT_LENGTH);
        boolean forceContentLengthCopy = msgContext.isPropertyTrue(
                NhttpConstants.COPY_CONTENT_LENGTH_FROM_INCOMING);

        BasicHttpEntity entity = (BasicHttpEntity) response.getEntity();

        MetricsCollector lstMetrics = worker.getServiceHandler().getMetrics();
        try {
            if (forceContentLength) {
                entity.setChunked(false);
                if (forceContentLengthCopy && contentLength > 0) {
                    entity.setContentLength(contentLength);
                } else {
                    setStreamAsTempData(entity, messageFormatter, msgContext, format);
                }
            }

            worker.getServiceHandler().commitResponse(worker.getConn(), response);
            lstMetrics.reportResponseCode(response.getStatusLine().getStatusCode());
            OutputStream out = worker.getOutputStream();

            /*
             * if this is a dummy message to handle http 202 case with non-blocking IO
             * write an empty byte array as body
             */
            if (msgContext.isPropertyTrue(NhttpConstants.SC_ACCEPTED)
                || Boolean.TRUE == noEntityBody) {
                out.write(new byte[0]);
            } else {
                if (forceContentLength) {
                    if (forceContentLengthCopy && contentLength > 0) {
                        messageFormatter.writeTo(msgContext, format, out, false);
                    } else {
                        writeMessageFromTempData(out, msgContext);
                    }
                } else {
                    messageFormatter.writeTo(msgContext, format, out, false);
                }
            }
            out.close();
            if (lstMetrics != null) {
                lstMetrics.incrementMessagesSent();
View Full Code Here

            String charSetEncoding = BuilderUtil.getCharSetEncoding(contentTypeStr);
            msgContext.setProperty(
                    Constants.Configuration.CHARACTER_SET_ENCODING, charSetEncoding);
            boolean eprFound = false;
            if (endpointsConfiguration != null) {
                URLEndpoint epr = endpointsConfiguration.getEndpoint(request.getRequestLine().getUri());
                if (epr != null) {
                    eprFound = true;
                    String type = TransportUtils.getContentType(contentTypeStr, msgContext);
                    msgContext.setProperty(Constants.Configuration.MESSAGE_TYPE, type);
                    epr.setParameters(msgContext);

                    Builder builder = epr.getBuilder(type);
                    if (HTTPTransportUtils.isRESTRequest(contentTypeStr)) {
                        RESTUtil.processPOSTRequest(msgContext, is, os,
                                request.getRequestLine().getUri(), contentType, builder, isRestDispatching);
                    } else {
View Full Code Here

            String contentTypeStr = contentType != null ?
                    contentType.getValue() : inferContentType();

            boolean eprFound = false;
            if (endpointsConfiguration != null) {
                URLEndpoint epr = endpointsConfiguration.getEndpoint(request.getRequestLine().getUri());
                if (epr != null) {
                    eprFound = true;
                    String type = TransportUtils.getContentType(contentTypeStr, msgContext);
                    msgContext.setProperty(Constants.Configuration.MESSAGE_TYPE, type);

                    epr.setParameters(msgContext);

                    Builder builder = epr.getBuilder(type);
                    RESTUtil.processGetAndDeleteRequest(
                            msgContext, os, request.getRequestLine().getUri(),
                            request.getFirstHeader(HTTP.CONTENT_TYPE), builder,
                            method, isRestDispatching);
                }
View Full Code Here

        params = getListenerParameters();


        param = transportIn.getParameter(NhttpConstants.ENDPOINTS_CONFIGURATION);
        if (param != null && param.getValue() != null) {
            endpoints = new URLEndpointsConfigurationFactory().create(param.getValue().toString());
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.axis2.jaxws.message.util.SAAJConverter

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.