Package org.apache.axiom.soap

Examples of org.apache.axiom.soap.SOAPFactory


    ackRMMsgCtx.setFlow(MessageContext.OUT_FLOW);
    ackRMMsgCtx.setRMNamespaceValue(referenceRMMessage.getRMNamespaceValue());

    ackMsgCtx.setMessageID(SandeshaUtil.getUUID());

    SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SandeshaUtil
        .getSOAPVersion(referenceMsg.getEnvelope()));

    // Setting new envelope
    SOAPEnvelope envelope = factory.getDefaultEnvelope();

    ackMsgCtx.setEnvelope(envelope);

    ackMsgCtx.setTo(acksTo);
   
View Full Code Here


   * @throws SandeshaException
   */
  public static void addSOAPFaultEnvelope(MessageContext faultMsgContext,
      int SOAPVersion, FaultData faultData, String rmNamespaceValue) throws SandeshaException {

    SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SOAPVersion);
    SOAPEnvelope env = factory.getDefaultFaultEnvelope();

    try {
      faultMsgContext.setEnvelope(env);
    } catch (AxisFault e) {
      throw new SandeshaException(e.getMessage());
View Full Code Here

    SOAPEnvelope faultMsgEnvelope = faultMsgContext.getEnvelope();
    if (faultMsgEnvelope == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.soapEnvNotSet));

    SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SandeshaUtil
        .getSOAPVersion(faultMsgEnvelope));

    SOAPFault fault = faultMsgEnvelope.getBody().getFault();

    if (data.getExceptionString() != null)
View Full Code Here

    SOAPEnvelope faultEnvelope = faultMsgContext.getEnvelope();
    if (faultEnvelope == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.soapEnvNotSet));

    SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SandeshaUtil
        .getSOAPVersion(faultEnvelope));

    SOAPFault fault = faultEnvelope.getBody().getFault();
    if (fault == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.noFaultCode,
          faultEnvelope.toString()));

    SOAPFaultCode faultCode = fault.getCode();
    SOAPFaultValue codeValue = faultCode.getValue();
    codeValue.setText(data.getCode());

    SOAPFaultSubCode faultSubCode = factory
        .createSOAPFaultSubCode(faultCode);
    SOAPFaultValue subCodeValue = factory
        .createSOAPFaultValue(faultSubCode);
    subCodeValue.setText(data.getSubcode());

    SOAPFaultReason faultReason = fault.getReason();
    SOAPFaultText faultText = faultReason.getSOAPFaultText("en");
   
    if (faultText==null) {
      faultText = factory.createSOAPFaultText();
      faultReason.addSOAPText(faultText);
    }
   
    if (data!=null && data.getReason()!=null)
      faultText.setText(data.getReason());
View Full Code Here

  private static RMMsgContext createResponseMsg(RMMsgContext requestMsg, RMSequenceBean rmSequenceBean, IOMRMPart part,
      int messagePartId, String action) throws AxisFault {

    MessageContext outMessage = Utils.createOutMessageContext(requestMsg.getMessageContext());
    RMMsgContext responseRMMsg = new RMMsgContext(outMessage);
    SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SandeshaUtil.getSOAPVersion(requestMsg.getSOAPEnvelope()));

    String namespace = requestMsg.getRMNamespaceValue();
    responseRMMsg.setRMNamespaceValue(namespace);

    SOAPEnvelope envelope = factory.getDefaultEnvelope();
    responseRMMsg.setSOAPEnvelop(envelope);
    responseRMMsg.setMessagePart(messagePartId, part);

    outMessage.setWSAAction(action);
    outMessage.setSoapAction(action);
View Full Code Here

        FileDataSource fileDataSource = new FileDataSource(new File(fileName));
        DataHandler dataHandler = new DataHandler(fileDataSource);
        String attachmentID = mc.addAttachment(dataHandler);


        SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
        SOAPEnvelope env = factory.getDefaultEnvelope();
        OMNamespace ns = factory.createOMNamespace("http://services.samples", "m0");
        OMElement payload = factory.createOMElement("uploadFileUsingSwA", ns);
        OMElement request = factory.createOMElement("request", ns);
        OMElement imageId = factory.createOMElement("imageId", ns);
        imageId.setText(attachmentID);
        request.addChild(imageId);
        payload.addChild(request);
        env.getBody().addChild(payload);
        mc.setEnvelope(env);
View Full Code Here

        }
        map.put(COOKIE, value);
    }

    private SOAPEnvelope buildSoapEnvelope(String clientID, String value) {
        SOAPFactory soapFactory = OMAbstractFactory.getSOAP12Factory();

        SOAPEnvelope envelope = soapFactory.createSOAPEnvelope();

        SOAPHeader header = soapFactory.createSOAPHeader();
        envelope.addChild(header);

        OMNamespace synNamespace = soapFactory.
                createOMNamespace("http://ws.apache.org/ns/synapse", "syn");
        OMElement clientIDElement = soapFactory.createOMElement("ClientID", synNamespace);
        clientIDElement.setText(clientID);
        header.addChild(clientIDElement);

        SOAPBody body = soapFactory.createSOAPBody();
        envelope.addChild(body);

        OMElement valueElement = soapFactory.createOMElement("Value", null);
        valueElement.setText(value);
        body.addChild(valueElement);

        return envelope;
    }
View Full Code Here

        log.info("Message: " + sw.toString());
    }
    // END SNIPPET: variant2
   
    public void test() throws XMLStreamException {
        SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
        SOAPEnvelope env = factory.getDefaultEnvelope();
        OMElement element = factory.createOMElement(new QName("urn:testService", "invokeMtom", "ns"), env.getBody());
        element.addChild(factory.createOMText(new DataHandler("test", "text/xml"), true));
        logMessage1(env);
        logMessage2(env);
    }
View Full Code Here

public class MTOMSample extends TestCase {
    // START SNIPPET: retrieveContent
    public void retrieveContent(URL serviceURL, String id, OutputStream result) throws Exception {
        // Build the SOAP request
        SOAPFactory soapFactory = OMAbstractFactory.getSOAP11Factory();
        SOAPEnvelope request = soapFactory.getDefaultEnvelope();
        OMElement retrieveContent = soapFactory.createOMElement(
                new QName("urn:test", "retrieveContent"), request.getBody());
        OMElement fileId = soapFactory.createOMElement(new QName("fileId"), retrieveContent);
        fileId.setText(id);
       
        // Use the java.net.URL API to connect to the service
        URLConnection connection = serviceURL.openConnection();
        connection.setDoOutput(true);
View Full Code Here

        // Create a header OMSE
        String hdrText = "<hdr:myheader xmlns:hdr=\"urn://test\">Hello World</hdr:myheader>";
        ByteArrayDataSource badsHdr =
            new ByteArrayDataSource(hdrText.getBytes(encoding), encoding);
        OMNamespace hdrNS = header.getOMFactory().createOMNamespace("urn://test", "hdr");
        SOAPFactory sf = (SOAPFactory) header.getOMFactory();
        SOAPHeaderBlock shb = sf.createSOAPHeaderBlock("myheader", hdrNS, badsHdr);
        shb.setProcessed()// test setting processing flag
        header.addChild(shb);
       
        // Create a payload
        String text = "<tns:payload xmlns:tns=\"urn://test\">Hello World</tns:payload>";
View Full Code Here

TOP

Related Classes of org.apache.axiom.soap.SOAPFactory

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.