Package org.apache.axiom.soap.impl.llom.soap11

Examples of org.apache.axiom.soap.impl.llom.soap11.SOAP11Factory


        if (documentElement instanceof SOAPEnvelope) {
            envelope = (SOAPEnvelope) documentElement;
        } else {
            // If it is not a SOAPEnvelope we wrap that with a fake
            // SOAPEnvelope.
            SOAPFactory soapFactory = new SOAP11Factory();
            envelope = soapFactory.getDefaultEnvelope();
            envelope.getBody().addChild(documentElement);
        }
        return envelope;
    }
View Full Code Here


            throws AxisFault {
        String[] values =
                Utils.parseRequestURLForServiceAndOperation(requestUrl,
                                                            configCtx.getServiceContextPath());
        if (values == null) {
            return new SOAP11Factory().getDefaultEnvelope();
        }

        if ((values[1] != null) && (values[0] != null)) {
            String srvice = values[0];
            AxisService service = configCtx.getAxisConfiguration().getService(srvice);
            if (service == null) {
                throw new AxisFault("service not found: " + srvice);
            }
            String operation = values[1];
            SOAPFactory soapFactory = new SOAP11Factory();
            SOAPEnvelope envelope = soapFactory.getDefaultEnvelope();
            OMNamespace omNs = soapFactory.createOMNamespace(service.getSchemaTargetNamespace(),
                                                             service.getSchemaTargetNamespacePrefix());
            soapFactory.createOMNamespace(service.getSchemaTargetNamespace(),
                                          service.getSchemaTargetNamespacePrefix());
            OMElement opElement = soapFactory.createOMElement(operation, omNs);
            Iterator it = map.keySet().iterator();

            while (it.hasNext()) {
                String name = (String) it.next();
                String value = (String) map.get(name);
                OMElement omEle = soapFactory.createOMElement(name, omNs);

                omEle.setText(value);
                opElement.addChild(omEle);
            }
View Full Code Here

     * @return
     */
    private static SOAPFactory _getFactory(Protocol protocol) {
        SOAPFactory soapFactory;
        if (protocol == Protocol.soap11) {
            soapFactory = new SOAP11Factory();
        } else if (protocol == Protocol.soap12) {
            soapFactory = new SOAP12Factory();
        } else if (protocol == Protocol.rest) {
            // For REST, create a SOAP 1.1 Envelope to contain the message
            // This is consistent with Axis2.
            soapFactory = new SOAP11Factory();
        } else {
            throw ExceptionFactory
                    .makeWebServiceException(Messages.getMessage("RESTIsNotSupported"), null);
        }
        return soapFactory;
View Full Code Here

   *
   * @return
   */
  private byte[] getAppMessageAsBytes(String uuid) throws Exception
  {
    SOAPFactory factory = new SOAP11Factory();
    SOAPEnvelope dummyEnvelope = factory.getDefaultEnvelope();
   
    // Create a "new" application message
    MessageContext messageContext = new MessageContext();
    messageContext.setConfigurationContext(serverConfigContext);
    messageContext.setAxisService(serverConfigContext.getAxisConfiguration().getService("RMSampleService"));   
View Full Code Here

   *
   * @return
   */
  private byte[] getCloseMessageAsBytes(String uuid) throws Exception
  {
    SOAPFactory factory = new SOAP11Factory();
    SOAPEnvelope dummyEnvelope = factory.getDefaultEnvelope();
   
    // Create a "new" application message
    MessageContext messageContext = new MessageContext();
    messageContext.setConfigurationContext(serverConfigContext);
    messageContext.setAxisService(serverConfigContext.getAxisConfiguration().getService("RMSampleService"));   
View Full Code Here

   *
   * @return
   */
  private byte[] getAckRequestMessageAsBytes(String uuid) throws Exception
  {
    SOAPFactory factory = new SOAP11Factory();
    SOAPEnvelope dummyEnvelope = factory.getDefaultEnvelope();
   
    // Create a "new" application message
    MessageContext messageContext = new MessageContext();
    messageContext.setConfigurationContext(serverConfigContext);
    messageContext.setAxisService(serverConfigContext.getAxisConfiguration().getService("RMSampleService"));   
View Full Code Here

    SOAPEnvelope dummyEnvelope = null;
    if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapNamespaceURI)) {
      factory = new SOAP12Factory();
      dummyEnvelope = factory.getDefaultEnvelope();
    } else {
      factory = new SOAP11Factory();
      dummyEnvelope = factory.getDefaultEnvelope();
    }

    String rmNamespaceValue = SpecSpecificConstants.getRMNamespaceValue(rmSpecVersion);
View Full Code Here

    String soapNamespaceURI = options.getSoapVersionURI();
    if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapNamespaceURI)) {
      factory = new SOAP12Factory();
      dummyEnvelope = factory.getDefaultEnvelope();
    } else {
      factory = new SOAP11Factory();
      dummyEnvelope = factory.getDefaultEnvelope();
    }

    String rmNamespaceValue = SpecSpecificConstants.getRMNamespaceValue(rmSpecVersion);
View Full Code Here

    String soapNamespaceURI = options.getSoapVersionURI();
    if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapNamespaceURI)) {
      factory = new SOAP12Factory();
      dummyEnvelope = factory.getDefaultEnvelope();
    } else {
      factory = new SOAP11Factory();
      dummyEnvelope = factory.getDefaultEnvelope();
    }

    String rmNamespaceValue = SpecSpecificConstants.getRMNamespaceValue(rmSpecVersion);
    TerminateSequence terminateSequence = new TerminateSequence(rmNamespaceValue);
View Full Code Here

        if (log.isDebugEnabled()) {
            log.debug("Creating SOAP envelope for FIX message...");
        }

        SOAPFactory soapFactory = new SOAP11Factory();
        OMElement msg = soapFactory.createOMElement(FIXConstants.FIX_MESSAGE, null);
        msg.addAttribute(soapFactory.createOMAttribute(FIXConstants.FIX_MESSAGE_INCOMING_SESSION,
                null, sessionID));
        msg.addAttribute(soapFactory.createOMAttribute
                (FIXConstants.FIX_MESSAGE_COUNTER, null, String.valueOf(counter)));

        OMElement header = soapFactory.createOMElement(FIXConstants.FIX_HEADER, null);
        OMElement body = soapFactory.createOMElement(FIXConstants.FIX_BODY, null);
        OMElement trailer = soapFactory.createOMElement(FIXConstants.FIX_TRAILER, null);

        //process FIX header
        Iterator<Field<?>> iter = message.getHeader().iterator();
        if (iter != null) {
            while (iter.hasNext()) {
                Field<?> field = iter.next();
                OMElement msgField = soapFactory.createOMElement(FIXConstants.FIX_FIELD, null);
                msgField.addAttribute(soapFactory.createOMAttribute(FIXConstants.FIX_FIELD_ID,
                        null, String.valueOf(field.getTag())));
                Object value = field.getObject();

                if (value instanceof byte[]) {
                    DataSource dataSource = new ByteArrayDataSource((byte[]) value);
                    DataHandler dataHandler = new DataHandler(dataSource);
                    String contentID = msgCtx.addAttachment(dataHandler);
                    OMElement binaryData = soapFactory.createOMElement(
                            FIXConstants.FIX_BINARY_FIELD, null);
                    String binaryCID = "cid:" + contentID;
                    binaryData.addAttribute(FIXConstants.FIX_MESSAGE_REFERENCE, binaryCID, null);
                    msgField.addChild(binaryData);
                } else {
                    soapFactory.createOMText(msgField, value.toString(),
                            OMElement.CDATA_SECTION_NODE);
                }
                header.addChild(msgField);
            }
        }
        //process FIX body
        convertFIXBodyToXML(message, body, soapFactory, msgCtx);

        //process FIX trailer
        iter = message.getTrailer().iterator();
        if (iter != null) {
            while (iter.hasNext()) {
                Field<?> field = iter.next();
                OMElement msgField = soapFactory.createOMElement(FIXConstants.FIX_FIELD, null);
                msgField.addAttribute(soapFactory.
                        createOMAttribute(FIXConstants.FIX_FIELD_ID, null,
                        String.valueOf(field.getTag())));
                Object value = field.getObject();

                if (value instanceof byte[]) {
                    DataSource dataSource = new ByteArrayDataSource((byte[]) value);
                    DataHandler dataHandler = new DataHandler(dataSource);
                    String contentID = msgCtx.addAttachment(dataHandler);
                    OMElement binaryData = soapFactory.createOMElement(
                            FIXConstants.FIX_BINARY_FIELD, null);
                    String binaryCID = "cid:" + contentID;
                    binaryData.addAttribute(FIXConstants.FIX_MESSAGE_REFERENCE, binaryCID, null);
                    msgField.addChild(binaryData);
                } else {
                    soapFactory.createOMText(msgField, value.toString(),
                            OMElement.CDATA_SECTION_NODE);
                }
                trailer.addChild(msgField);
            }
        }

        msg.addChild(header);
        msg.addChild(body);
        msg.addChild(trailer);
        SOAPEnvelope envelope = soapFactory.getDefaultEnvelope();
        envelope.getBody().addChild(msg);
        msgCtx.setEnvelope(envelope);
    }
View Full Code Here

TOP

Related Classes of org.apache.axiom.soap.impl.llom.soap11.SOAP11Factory

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.