Package org.apache.axis2.client

Examples of org.apache.axis2.client.Options


      SOAPEnvelope envelope = factory.getDefaultEnvelope();
      outMessageContext.setEnvelope(envelope);
     
      //set the LastMessageAction and the property
      if (outMessageContext.getOptions()==null)
        outMessageContext.setOptions(new Options ());
     
      OperationContext operationContext = outMessageContext.getOperationContext();
      String inboundSequenceId = (String) msgContext.getProperty(Sandesha2Constants.MessageContextProperties.INBOUND_SEQUENCE_ID);
      operationContext.setProperty(Sandesha2Constants.MessageContextProperties.INBOUND_SEQUENCE_ID,
          inboundSequenceId);
View Full Code Here


    if (log.isDebugEnabled())
      log.debug("Enter: SandeshaClient::createSequence , " + offer + ", " + sequenceKey);
   
    setUpServiceClientAnonymousOperations (serviceClient);
   
    Options options = serviceClient.getOptions();
    if (options == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.optionsObjectNotSet));

    EndpointReference toEPR = serviceClient.getOptions().getTo();
    if (toEPR == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.toEPRNotValid, null));

    String to = toEPR.getAddress();
    if (to == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.toEPRNotValid, null));

    if (offer) {
      String offeredSequenceID = SandeshaUtil.getUUID();
      options.setProperty(SandeshaClientConstants.OFFERED_SEQUENCE_ID, offeredSequenceID);
    }

    // setting a new squenceKey if not already set.
    String oldSequenceKey = (String) options.getProperty(SandeshaClientConstants.SEQUENCE_KEY);

    options.setProperty(SandeshaClientConstants.SEQUENCE_KEY, sequenceKey);

    String rmSpecVersion = (String) options.getProperty(SandeshaClientConstants.RM_SPEC_VERSION);

    if (rmSpecVersion == null)
      rmSpecVersion = SpecSpecificConstants.getDefaultSpecVersion();

    //When the message is marked as Dummy the application processor will not actually try to send it.
    //But still the create Sequence will be added.

    options.setProperty(SandeshaClientConstants.DUMMY_MESSAGE, Sandesha2Constants.VALUE_TRUE);

    String oldAction = options.getAction();
    options.setAction(SpecSpecificConstants.getCreateSequenceAction(rmSpecVersion));
   
    ServiceContext serviceContext = serviceClient.getServiceContext();
    if (serviceContext == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.serviceContextNotSet));

    ConfigurationContext configurationContext = serviceContext.getConfigurationContext();

    // cleanup previous sequence
    cleanupTerminatedSequence(to, oldSequenceKey, SandeshaUtil.getSandeshaStorageManager(configurationContext, configurationContext.getAxisConfiguration()));
   
    try {     
      //just to inform the sender.
      serviceClient.fireAndForget (null);
    } catch (AxisFault e) {
      throw new SandeshaException(e);
    }
    finally {
      options.setAction(oldAction);
     
      options.setProperty(SandeshaClientConstants.DUMMY_MESSAGE, Sandesha2Constants.VALUE_FALSE);
      options.setProperty(SandeshaClientConstants.SEQUENCE_KEY, oldSequenceKey);
    }
   
    if (log.isDebugEnabled())
      log.debug("Exit: SandeshaClient::createSequence");
  }
View Full Code Here

    String repoPath = "target" + File.separator + "repos" + File.separator + "client";
    String axis2_xml = "target" + File.separator + "repos" + File.separator + "client" + File.separator + "client_axis2.xml";
   
    ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);

    Options clientOptions = new Options ();
    clientOptions.setAction(echoAction);
    clientOptions.setTo(new EndpointReference (to));
   
    String sequenceKey = SandeshaUtil.getUUID();
    clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
   
    ServiceClient serviceClient = new ServiceClient (configContext,null);
    String acksTo = serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress();
    clientOptions.setProperty(SandeshaClientConstants.AcksTo,acksTo);
   
    clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
   

    serviceClient.setOptions(clientOptions);
    //serviceClient.
   
    clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
    clientOptions.setUseSeparateListener(true);
   
    serviceClient.setOptions(clientOptions);
   
    TestCallback callback1 = new TestCallback ("Callback 1");
    serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo1",sequenceKey),callback1);
View Full Code Here

    String axis2_xml = "target" + File.separator + "repos" + File.separator + "client" + File.separator + "client_axis2.xml";

    ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);

    //clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
    Options clientOptions = new Options ();
    clientOptions.setAction(pingAction);
//    clientOptions.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
   
    clientOptions.setTo(new EndpointReference (to));
   
    String sequenceKey1 = "sequence3";
    clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey1);
   
    ServiceClient serviceClient = new ServiceClient (configContext,null);
   
    serviceClient.setOptions(clientOptions);
   
   
    serviceClient.fireAndForget(getPingOMBlock("ping1"));   
    clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
    serviceClient.fireAndForget(getPingOMBlock("ping2"));
   
    String sequenceKey2 = "sequence4";
    clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey2);
   
    clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "false");
    serviceClient.fireAndForget(getPingOMBlock("ping1"));   
   
    long limit = System.currentTimeMillis() + waitTime;
    Error lastError = null;
    while(System.currentTimeMillis() < limit) {
View Full Code Here

        System.exit(0);
    }

    public static MessageContext sendUsingSwA(String fileName, String targetEPR) throws IOException {

        Options options = new Options();
        options.setTo(new EndpointReference(targetEPR));
        options.setAction("urn:uploadFileUsingSwA");
        options.setProperty(Constants.Configuration.ENABLE_SWA, Constants.VALUE_TRUE);

        ServiceClient sender = createServiceClient();
        sender.setOptions(options);
        OperationClient mepClient = sender.createClient(ServiceClient.ANON_OUT_IN_OP);
View Full Code Here

        image.addChild(textData);
        request.addChild(image);
        payload.addChild(request);

        ServiceClient serviceClient = createServiceClient();
        Options options = new Options();
        options.setTo(new EndpointReference(targetEPR));
        options.setAction("urn:uploadFileUsingMTOM");
        options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);

        serviceClient.setOptions(options);
        OMElement response = serviceClient.sendReceive(payload);

        OMText binaryNode = (OMText) response.
View Full Code Here

        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMElement value = fac.createOMElement("Value", null);
        value.setText("Sample string");

        Options options = new Options();
        options.setTo(new EndpointReference("http://localhost:" + synapsePort + "/services/LBService1"));

        options.setAction("urn:sampleOperation");

        String repoLocationProperty = System.getProperty("repository");
        String repo =  repoLocationProperty != null ? repoLocationProperty : DEFAULT_CLIENT_REPO;
        ConfigurationContext configContext =
                ConfigurationContextFactory.createConfigurationContextFromFileSystem(
                        repo, repo + File.separator + "conf" + File.separator + "axis2.xml");

        ServiceClient client = new ServiceClient(configContext, null);
        long timeout = Integer.parseInt(getProperty("timeout", "10000000"));
        System.out.println("timeout=" + timeout);
        options.setTimeOutInMilliSeconds(timeout);

        // set addressing, transport and proxy url
        if (addUrl != null && !"null".equals(addUrl)) {
            client.engageModule("addressing");
            options.setTo(new EndpointReference(addUrl));
        }
        if (trpUrl != null && !"null".equals(trpUrl)) {
            options.setProperty(Constants.Configuration.TRANSPORT_URL, trpUrl);
        } else {
            client.engageModule("addressing");
        }
        if (prxUrl != null && !"null".equals(prxUrl)) {
            HttpTransportProperties.ProxyProperties proxyProperties =
                    new HttpTransportProperties.ProxyProperties();
            try {
                URL url = new URL(prxUrl);
                proxyProperties.setProxyName(url.getHost());
                proxyProperties.setProxyPort(url.getPort());
                proxyProperties.setUserName("");
                proxyProperties.setPassWord("");
                proxyProperties.setDomain("");
                options.setProperty(HTTPConstants.PROXY, proxyProperties);
            } catch (MalformedURLException e) {
                throw new AxisFault("Error creating proxy URL", e);
            }
        }
View Full Code Here

            } catch (NumberFormatException e) {
                // run with default values
            }
        }

        Options options = new Options();
        options.setTo(new EndpointReference("http://localhost:" + synapsePort + "/services/LBService1"));
        options.setAction("urn:sampleOperation");
        options.setTimeOutInMilliSeconds(10000000);


        try {

            SOAPEnvelope env1 = buildSoapEnvelope("c1", "v1");
            SOAPEnvelope env2 = buildSoapEnvelope("c2", "v1");
            SOAPEnvelope env3 = buildSoapEnvelope("c3", "v1");
            SOAPEnvelope[] envelopes = {env1, env2, env3};

            String repoLocationProperty = System.getProperty("repository");
            String repo =  repoLocationProperty != null ? repoLocationProperty : DEFAULT_CLIENT_REPO;
            ConfigurationContext configContext =
                    ConfigurationContextFactory.createConfigurationContextFromFileSystem(
                            repo, repo + File.separator + "conf" + File.separator + "axis2.xml");
           
            ServiceClient client = new ServiceClient(configContext, null);

            // set addressing, transport and proxy url
            if (addUrl != null && !"null".equals(addUrl)) {
                client.engageModule("addressing");
                options.setTo(new EndpointReference(addUrl));
            }
            if (trpUrl != null && !"null".equals(trpUrl)) {
                options.setProperty(Constants.Configuration.TRANSPORT_URL, trpUrl);
            } else {
                client.engageModule("addressing");
            }
            if (prxUrl != null && !"null".equals(prxUrl)) {
                HttpTransportProperties.ProxyProperties proxyProperties =
                        new HttpTransportProperties.ProxyProperties();
                try {
                    URL url = new URL(prxUrl);
                    proxyProperties.setProxyName(url.getHost());
                    proxyProperties.setProxyPort(url.getPort());
                    proxyProperties.setUserName("");
                    proxyProperties.setPassWord("");
                    proxyProperties.setDomain("");
                    options.setProperty(HTTPConstants.PROXY, proxyProperties);
                } catch (MalformedURLException e) {
                    throw new AxisFault("Error creating proxy URL", e);
                }
            }
            client.setOptions(options);
View Full Code Here

        double price = 0;
        int quantity = 0;
        ConfigurationContext configContext = null;

        Options options = new Options();
        OMElement payload = null;
        ServiceClient serviceClient;

        if (repo != null && !"null".equals(repo)) {
            configContext =
                    ConfigurationContextFactory.
                            createConfigurationContextFromFileSystem(repo,
                                    repo + File.separator + "conf" + File.separator + "axis2.xml");
            serviceClient = new ServiceClient(configContext, null);
        } else {
            serviceClient = new ServiceClient();
        }

        if ("customquote".equals(mode)) {
            payload = StockQuoteHandler.createCustomQuoteRequest(symbol);
            options.setAction("urn:getQuote");
        } else if ("fullquote".equals(mode)) {
            payload = StockQuoteHandler.createFullQuoteRequest(symbol);
            options.setAction("urn:getFullQuote");
        } else if ("placeorder".equals(mode)) {
            price = getRandom(100, 0.9, true);
            quantity = (int) getRandom(10000, 1.0, true);
            payload = StockQuoteHandler.createPlaceOrderRequest(price, quantity, symbol);
            options.setAction("urn:placeOrder");
        } else if ("marketactivity".equals(mode)) {
            payload = StockQuoteHandler.createMarketActivityRequest();
            options.setAction("urn:getMarketActivity");
        } else if ("quote".equals(mode) || "dualquote".equals(mode)) {
            payload = StockQuoteHandler.createStandardQuoteRequest(
                    symbol, Integer.parseInt(itr));
            options.setAction("urn:getQuote");
            if ("dualquote".equals(mode)) {
                serviceClient.engageModule("addressing");
                options.setUseSeparateListener(true);
            }
        }

        // set addressing, transport and proxy url
        if (addUrl != null && !"null".equals(addUrl)) {
            serviceClient.engageModule("addressing");
            options.setTo(new EndpointReference(addUrl));
        }
        if (trpUrl != null && !"null".equals(trpUrl)) {
            options.setProperty(Constants.Configuration.TRANSPORT_URL, trpUrl);
        }
        if (prxUrl != null && !"null".equals(prxUrl)) {
            HttpTransportProperties.ProxyProperties proxyProperties =
                    new HttpTransportProperties.ProxyProperties();
            URL url = new URL(prxUrl);
            proxyProperties.setProxyName(url.getHost());
            proxyProperties.setProxyPort(url.getPort());
            proxyProperties.setUserName("");
            proxyProperties.setPassWord("");
            proxyProperties.setDomain("");
            options.setProperty(HTTPConstants.PROXY, proxyProperties);
        }

        // apply any service policies if any
        if (svcPolicy != null && !"null".equals(svcPolicy) && svcPolicy.length() > 0) {
            System.out.println("Using WS-Security");
            serviceClient.engageModule("addressing");
            serviceClient.engageModule("rampart");
            options.setProperty(
                    RampartMessageData.KEY_RAMPART_POLICY, loadPolicy(svcPolicy));
        }

        if (Boolean.parseBoolean(rest)) {
            System.out.println("Sending as REST");
            options.setProperty(Constants.Configuration.ENABLE_REST, Constants.VALUE_TRUE);
        }
        if (Boolean.parseBoolean(wsrm) || Boolean.parseBoolean(wsrm11)) {
            System.out.println("Using WS-RM");
            serviceClient.engageModule("sandesha2");
            if (Boolean.parseBoolean(wsrm11)){
               options.setProperty(SandeshaClientConstants.RM_SPEC_VERSION, Sandesha2Constants.SPEC_VERSIONS.v1_1);
            }
            options.setProperty(SandeshaClientConstants.LAST_MESSAGE, Constants.VALUE_TRUE);
            options.setProperty(SandeshaClientConstants.OFFERED_SEQUENCE_ID, UIDGenerator.generateURNString());
        }

        if ("soap12".equals(soapVer)) {
            options.setSoapVersionURI(SOAP12Constants. SOAP_ENVELOPE_NAMESPACE_URI);
        }

        serviceClient.setOptions(options);

        InnerStruct.MODE = mode;
View Full Code Here

        }
        return result;
    }

    public static void executeClient() throws Exception {
        Options options = new Options();
        ServiceClient serviceClient;
        ConfigurationContext configContext = null;

        String addUrl = getProperty("addurl", "http://localhost:8280/services/SampleEventSource");
        String trpUrl = getProperty("trpurl", null);
        String prxUrl = getProperty("prxurl", null);
        String repo = getProperty("repository", "client_repo");
        String topic = getProperty("topic", "synapse/event/test");
        String address =
                getProperty("address", "http://localhost:9000/services/SimpleStockQuoteService");
        String mode = getProperty("mode", "subscribe");
        String identifier = getProperty("identifier", "90000");
        String expires = getProperty("expires", "*"); //Format: 2020-12-31T21:07:00.000-08:00

        if (repo != null && !"null".equals(repo)) {
            configContext =
                    ConfigurationContextFactory.
                            createConfigurationContextFromFileSystem(repo,
                                    repo + File.separator + "conf" + File.separator + "axis2.xml");
            serviceClient = new ServiceClient(configContext, null);
        } else {
            serviceClient = new ServiceClient();
        }
        OMFactory factory = OMAbstractFactory.getOMFactory();
        OMElement message = factory.createOMElement("message", null);

        OMNamespace nsxmlins =
                factory.createOMNamespace("http://www.w3.org/2001/XMLSchema", "xmlns");
        OMNamespace nss11 =
                factory.createOMNamespace("http://schemas.xmlsoap.org/soap/envelope", "s11");
        OMNamespace nswsa = factory.createOMNamespace(
                "http://schemas.xmlsoap.org/ws/2004/08/addressing", "wsa");
        OMNamespace nswse =
                factory.createOMNamespace("http://schemas.xmlsoap.org/ws/2004/08/eventing", "wse");

        if (mode.equals("subscribe")) {
            OMElement subscribeOm = factory.createOMElement("Subscribe", nswse);
            OMElement deliveryOm = factory.createOMElement("Delivery", nswse);
            deliveryOm.addAttribute(factory.createOMAttribute("Mode", null,
                    "http://schemas.xmlsoap.org/ws/2004/08/eventing/DeliveryModes/Push"));
            OMElement notifyToOm = factory.createOMElement("NotifyTo", nswse);
            OMElement addressOm = factory.createOMElement("Address", nswsa);
            factory.createOMText(addressOm, address);
            OMElement expiresOm = factory.createOMElement("Expires", nswse);
            factory.createOMText(expiresOm, expires);
            OMElement filterOm = factory.createOMElement("Filter", nswse);
            filterOm.addAttribute(factory.createOMAttribute("Dialect", null,
                    "http://synapse.apache.org/eventing/dialect/topicFilter"));
            factory.createOMText(filterOm, topic);


            notifyToOm.addChild(addressOm);
            deliveryOm.addChild(notifyToOm);
            subscribeOm.addChild(deliveryOm);
            if (!(expires.equals("*"))) {
                subscribeOm.addChild(expiresOm); // Add only if the value provided
            }
            subscribeOm.addChild(filterOm);

            // set addressing, transport and proxy url

            serviceClient.engageModule("addressing");
            options.setTo(new EndpointReference(addUrl));

            options.setAction("http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe");
            serviceClient.setOptions(options);
            System.out.println("Subscribing \n" + subscribeOm.toString());
            try {
                OMElement response = serviceClient.sendReceive(subscribeOm);
                System.out.println("Subscribed to topic " + topic);
                Thread.sleep(1000);
                System.out.println("Response Received: " + response.toString());
                String subId =
                        response.getFirstChildWithName(
                                new QName(nswse.getNamespaceURI(), "SubscriptionManager"))
                                .getFirstChildWithName(
                                        new QName(nswsa.getNamespaceURI(), "ReferenceParameters"))
                                .getFirstChildWithName(
                                        new QName(nswse.getNamespaceURI(), "Identifier")).getText();
                System.out.println("Subscription identifier: " + subId);
            } catch (AxisFault e) {
                System.out.println("Fault Received : " + e.toString());
                System.out.println("Fault Code     : " + e.getFaultCode().toString());
            }
        } else if (mode.equals("unsubscribe")) {
            /** Send unsubscribe message
             (01) <s12:Envelope
             (02)     xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
             (03)     xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
             (04)     xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing"
             (05)     xmlns:ow="http://www.example.org/oceanwatch" >
             (06)   <s12:Header>
             (07)     <wsa:Action>
             (08)       http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe
             (09)     </wsa:Action>
             (10)     <wsa:MessageID>
             (11)       uuid:2653f89f-25bc-4c2a-a7c4-620504f6b216
             (12)     </wsa:MessageID>
             (13)     <wsa:ReplyTo>
             (14)      <wsa:Address>http://www.example.com/MyEventSink</wsa:Address>
             (15)     </wsa:ReplyTo>
             (16)     <wsa:To>
             (17)       http://www.example.org/oceanwatch/SubscriptionManager
             (18)     </wsa:To>
             (19)     <wse:Identifier>
             (20)       uuid:22e8a584-0d18-4228-b2a8-3716fa2097fa
             (21)     </wse:Identifier>
             (22)   </s12:Header>
             (23)   <s12:Body>
             (24)     <wse:Unsubscribe />
             (25)   </s12:Body>
             (26) </s12:Envelope>*/
            OMElement subscribeOm = factory.createOMElement("Unsubscribe", nswse);
            serviceClient.engageModule("addressing");
            options.setTo(new EndpointReference(addUrl));
            options.setAction("http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe");
            OMElement identifierOm = factory.createOMElement("Identifier", nswse);
            factory.createOMText(identifierOm, identifier);
            serviceClient.addHeader(identifierOm);
            serviceClient.setOptions(options);
            System.out.println("UnSubscribing \n" + subscribeOm.toString());
            try {
                OMElement response = serviceClient.sendReceive(subscribeOm);
                System.out.println("UnSubscribed to ID " + identifier);
                Thread.sleep(1000);
                System.out.println("UnSubscribe Response Received: " + response.toString());
            } catch (AxisFault e) {
                System.out.println("Fault Received : " + e.toString());
                System.out.println("Fault Code     : " + e.getFaultCode().toString());
            }

        } else if (mode.equals("renew")) {
            /**
             * (01) <s12:Envelope
             (02)     xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
             (03)     xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
             (04)     xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing"
             (05)     xmlns:ow="http://www.example.org/oceanwatch" >
             (06)   <s12:Header>
             (07)     <wsa:Action>
             (08)       http://schemas.xmlsoap.org/ws/2004/08/eventing/Renew
             (09)     </wsa:Action>
             (10)     <wsa:MessageID>
             (11)       uuid:bd88b3df-5db4-4392-9621-aee9160721f6
             (12)     </wsa:MessageID>
             (13)     <wsa:ReplyTo>
             (14)      <wsa:Address>http://www.example.com/MyEventSink</wsa:Address>
             (15)     </wsa:ReplyTo>
             (16)     <wsa:To>
             (17)       http://www.example.org/oceanwatch/SubscriptionManager
             (18)     </wsa:To>
             (19)     <wse:Identifier>
             (20)       uuid:22e8a584-0d18-4228-b2a8-3716fa2097fa
             (21)     </wse:Identifier>
             (22)   </s12:Header>
             (23)   <s12:Body>
             (24)     <wse:Renew>
             (25)       <wse:Expires>2004-06-26T21:07:00.000-08:00</wse:Expires>
             (26)     </wse:Renew>
             (27)   </s12:Body>
             (28) </s12:Envelope>
             */
            OMElement subscribeOm = factory.createOMElement("Renew", nswse);
            OMElement expiresOm = factory.createOMElement("Expires", nswse);
            factory.createOMText(expiresOm, expires);
            subscribeOm.addChild(expiresOm);
            serviceClient.engageModule("addressing");
            options.setTo(new EndpointReference(addUrl));
            options.setAction("http://schemas.xmlsoap.org/ws/2004/08/eventing/Renew");
            OMElement identifierOm = factory.createOMElement("Identifier", nswse);
            factory.createOMText(identifierOm, identifier);
            serviceClient.addHeader(identifierOm);
            serviceClient.setOptions(options);
            System.out.println("SynapseSubscription Renew \n" + subscribeOm.toString());
            try {
                OMElement response = serviceClient.sendReceive(subscribeOm);
                System.out.println("SynapseSubscription Renew to ID " + identifier);
                Thread.sleep(1000);
                System.out.println(
                        "SynapseSubscription Renew Response Received: " + response.toString());
            } catch (AxisFault e) {
                System.out.println("Fault Received : " + e.toString());
                System.out.println("Fault Code     : " + e.getFaultCode().toString());
            }

        } else if (mode.equals("getstatus")) {
            /**
             * (01) <s12:Envelope
             (02)     xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
             (03)     xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
             (04)     xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing"
             (05)     xmlns:ow="http://www.example.org/oceanwatch" >
             (06)   <s12:Header>
             (07)     <wsa:Action>
             (08)       http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatus
             (09)     </wsa:Action>
             (10)     <wsa:MessageID>
             (11)       uuid:bd88b3df-5db4-4392-9621-aee9160721f6
             (12)     </wsa:MessageID>
             (13)     <wsa:ReplyTo>
             (14)       <wsa:Address>http://www.example.com/MyEventSink</wsa:Address>
             (15)     </wsa:ReplyTo>
             (16)     <wsa:To>
             (17)       http://www.example.org/oceanwatch/SubscriptionManager
             (18)     </wsa:To>
             (19)     <wse:Identifier>
             (20)       uuid:22e8a584-0d18-4228-b2a8-3716fa2097fa
             (21)     </wse:Identifier>
             (22)   </s12:Header>
             (23)   <s12:Body>
             (24)     <wse:GetStatus />
             (25)   </s12:Body>
             (26) </s12:Envelope>
             */
            OMElement subscribeOm = factory.createOMElement("GetStatus", nswse);
            serviceClient.engageModule("addressing");
            options.setTo(new EndpointReference(addUrl));
            options.setAction("http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatus");
            OMElement identifierOm = factory.createOMElement("Identifier", nswse);
            factory.createOMText(identifierOm, identifier);
            serviceClient.addHeader(identifierOm);
            serviceClient.setOptions(options);
            System.out.println("GetStatus using \n" + subscribeOm.toString());
View Full Code Here

TOP

Related Classes of org.apache.axis2.client.Options

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.