Package org.apache.axiom.soap

Examples of org.apache.axiom.soap.SOAPFactory


   * @throws SandeshaException
   */
  public static void addAckMessage(RMMsgContext applicationMsg, String sequencePropertyKey ,String sequenceId, StorageManager storageManager)
      throws AxisFault {
   
    SOAPFactory factory = null;
    SOAPEnvelope envelope = applicationMsg.getSOAPEnvelope();
    factory = (SOAPFactory) envelope.getOMFactory();
   
    envelope = applicationMsg.getSOAPEnvelope();

View Full Code Here


    RMMsgContext ackRMMsgCtx = MsgInitializer.initializeMessage(ackMsgCtx);
    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

    RMMsgContext ackRMMsgCtx = MsgInitializer.initializeMessage(ackMsgCtx);
    ackRMMsgCtx.setRMNamespaceValue(rmMsgCtx.getRMNamespaceValue());

    ackMsgCtx.setMessageID(SandeshaUtil.getUUID());

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

    // Setting new envelope
    SOAPEnvelope envelope = factory.getDefaultEnvelope();
    try {
      ackMsgCtx.setEnvelope(envelope);
    } catch (AxisFault e3) {
      throw new SandeshaException(e3.getMessage());
    }
View Full Code Here

  public void toSOAPEnvelope(SOAPEnvelope envelope) {
    SOAPHeader header = envelope.getHeader();
   
    if (header==null) {
      SOAPFactory factory = (SOAPFactory)envelope.getOMFactory();
      header = factory.createSOAPHeader(envelope);
    }
   
    //detach if already exist.
    OMElement elem = header.getFirstChildWithName(new QName(namespaceValue,
        Sandesha2Constants.WSRM_COMMON.SEQUENCE));
View Full Code Here

    MessageContext ackMsgCtx = ackRMMsgCtx.getMessageContext();

    String rmNamespaceValue = rmMsgCtx.getRMNamespaceValue();
    ackRMMsgCtx.setRMNamespaceValue(rmNamespaceValue);

    SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SandeshaUtil
        .getSOAPVersion(rmMsgCtx.getSOAPEnvelope()));

    // Setting new envelope
    SOAPEnvelope envelope = factory.getDefaultEnvelope();
    try {
      ackMsgCtx.setEnvelope(envelope);
    } catch (AxisFault e3) {
      throw new SandeshaException(e3.getMessage());
    }
View Full Code Here

 
  public void toSOAPEnvelope(SOAPEnvelope envelope) throws SandeshaException {
    SOAPHeader header = envelope.getHeader();
   
    if (header==null) {
      SOAPFactory factory = (SOAPFactory)envelope.getOMFactory();
      header = factory.createSOAPHeader(envelope);
    }
   
    //detach if already exist.
    OMElement elem = header.getFirstChildWithName(new QName(namespaceValue,
        Sandesha2Constants.WSRM_COMMON.MESSAGE_PENDING));
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();
    SOAPFaultCode faultCode = fault.getCode();

    if (isSequenceFault(data)) {
      faultCode.setText(data.getCode());
    } else {
      faultCode.setText(data.getSubcode());
    }

    SOAPFaultReason faultReason = fault.getReason();

    OMNamespace namespace = factory.createOMNamespace(
        OMConstants.XMLNS_URI, OMConstants.XMLNS_PREFIX);

    faultReason.setText(data.getReason());
    faultCode.getValue().setText(data.getSubcode());
    SOAPFaultText faultText = faultReason.getSOAPFaultText("en");
    if (faultText==null)
    {
      faultText = factory.createSOAPFaultText();
      // Add the SOAP text
      faultReason.addSOAPText(faultText);
    }
 
    faultText.addAttribute("lang", "en", namespace);
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

                            XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(xmlResults));
                            StAXOMBuilder resultsBuilder = new StAXOMBuilder(reader);
                            OMElement resultSer = resultsBuilder.getDocumentElement();

                            // create the response soap
                            SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
                            SOAPEnvelope resEnv = factory.createSOAPEnvelope();
                            SOAPBody resBody = factory.createSOAPBody();
                            OMElement resService = factory.createOMElement(new QName(serviceName + "Response"));
                            resService.addChild(resultSer.getFirstElement());
                            resBody.addChild(resService);
                            resEnv.addChild(resBody);

                            // The declareDefaultNamespace method doesn't work see (https://issues.apache.org/jira/browse/AXIS2-3156)
                            // so the following doesn't work:
                            // resService.declareDefaultNamespace(ModelService.TNS);
                            // instead, create the xmlns attribute directly:
                            OMAttribute defaultNS = factory.createOMAttribute("xmlns", null, ModelService.TNS);
                            resService.addAttribute(defaultNS);

                            // log the response message
                            if (Debug.verboseOn()) {
                                try {
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.