Package org.apache.axiom.soap

Examples of org.apache.axiom.soap.SOAPBody


     * Gets the OMElement that is the parent of where the the body blocks are located
     *
     * @return
     */
    private OMElement _getBodyBlockParent() {
        SOAPBody body = root.getBody();
        if (!body.hasFault() && indirection == 1) {
            //  For RPC the blocks are within the operation element
            OMElement op = body.getFirstElement();
            if (op == null) {
                // Create one
                OMNamespace ns = soapFactory.createOMNamespace("", "");
                op = soapFactory.createOMElement("PLACEHOLDER_OPERATION", ns, body);
            }
View Full Code Here


        return (ServiceClient.ANON_OUT_IN_OP.equals(op.getName()) ||
                ServiceClient.ANON_OUT_ONLY_OP.equals(op.getName()));
    }
   
    private QName getFirstBodyElement(SOAPEnvelope envelope) {
        SOAPBody body = envelope.getBody();
        if (body != null) {
            OMElement firstElement = body.getFirstElement();
            if (firstElement != null) {
                return firstElement.getQName();
            }
        }
        return null;
View Full Code Here

        SOAPEnvelope dummyEnv = (SOAPEnvelope) m.getAsOMElement();       
       
        StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(dummyEnv.getXMLStreamReaderWithoutCaching());
        SOAPEnvelope newEnv = (SOAPEnvelope) builder.getDocumentElement();
       
        SOAPBody body = newEnv.getBody();
        SOAPFault fault = body.getFault();
       
        Block[] details = getDetailBlocks(fault);
       
        return XMLFaultUtils.createXMLFault(fault, details);
    }
View Full Code Here

      this.name = name;
    }
   
    public void onComplete(AsyncResult result) {
      //System.out.println("On Complete Called for " + text);
      SOAPBody body = result.getResponseEnvelope().getBody();
     
      OMElement echoStringResponseElem = body.getFirstChildWithName(new QName (applicationNamespaceName,echoStringResponse));
      if (echoStringResponseElem==null) {
        System.out.println("Error: SOAPBody does not have a 'echoStringResponse' child");
        return;
      }
     
View Full Code Here

      this.name = name;
    }
   
    public void onComplete(AsyncResult result) {
      //System.out.println("On Complete Called for " + text);
      SOAPBody body = result.getResponseEnvelope().getBody();
     
      OMElement echoStringResponseElem = body.getFirstChildWithName(new QName (applicationNamespaceName,echoStringResponse));
      if (echoStringResponseElem==null) {
        System.out.println("Error: SOAPBody does not have a 'echoStringResponse' child");
        return;
      }
     
View Full Code Here

  public void setIdentifier(Identifier identifier) {
    this.identifier = identifier;
  }

  public void toSOAPEnvelope(SOAPEnvelope envelope) {
    SOAPBody body = envelope.getBody();
   
    //detach if already exist.
    OMElement elem = body.getFirstChildWithName(new QName(namespaceValue,
        Sandesha2Constants.WSRM_COMMON.TERMINATE_SEQUENCE_RESPONSE));
    if (elem!=null)
      elem.detach();
   
    toOMElement(body);
View Full Code Here

  public void setIdentifier(Identifier identifier) {
    this.identifier = identifier;
  }

  public void toSOAPEnvelope(SOAPEnvelope envelope) {
    SOAPBody body = envelope.getBody();
   
    //detach if already exist.
    OMElement elem = body.getFirstChildWithName(new QName(namespaceValue,
        Sandesha2Constants.WSRM_COMMON.CLOSE_SEQUENCE));
    if (elem!=null)
      elem.detach();
   
    toOMElement(body);
View Full Code Here

        Debug.logVerbose("[Processing]: SOAP Event", module);

        try {
            // each is a different service call
            SOAPBody reqBody = reqEnv.getBody();
            Iterator serviceIter = reqBody.getChildElements();
            while (serviceIter.hasNext()) {
                Object serviceObj = serviceIter.next();
                if (serviceObj instanceof OMElement) {
                    OMElement serviceElement = (OMElement) serviceObj;
                    String serviceName = serviceElement.getLocalName();
                    Map<String, Object> parameters = UtilGenerics.cast(SoapSerializer.deserialize(serviceElement.toString(), delegator));
                    try {
                        // verify the service is exported for remote execution and invoke it
                        ModelService model = dispatcher.getDispatchContext().getModelService(serviceName);

                        if (model != null && model.export) {
                            Map<String, Object> results = dispatcher.runSync(serviceName, parameters);
                            Debug.logVerbose("[EventHandler] : Service invoked", module);

                            // setup the response
                            Debug.logVerbose("[EventHandler] : Setting up response message", module);
                            String xmlResults = SoapSerializer.serialize(results);
                            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);
View Full Code Here

            OMElement resultSer = resultsBuilder.getDocumentElement();

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

            // log the response message
            if (Debug.verboseOn()) {
                try {
View Full Code Here

                // send the request and wait for response
                MessageContext response = send(msgctx);
                // call the callback
                if (response != null) {
                    SOAPEnvelope resenvelope = response.getEnvelope();
                    SOAPBody body = resenvelope.getBody();
                    if (body.hasFault()) {
                        Exception ex = body.getFault().getException();

                        if (ex != null) {
                            callback.onError(ex);
                        } else {
                            callback.onError(new Exception(body.getFault()
                                    .getReason().getText()));
                        }
                    } else {
                        AsyncResult asyncResult = new AsyncResult(response);
View Full Code Here

TOP

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

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.