Package org.apache.axis2.client

Examples of org.apache.axis2.client.Call


                    }
                    fileObject.close();
                    if (!fileObject.delete()) {
                        String msg = "Cannot delete file : " + fileObject;
                        log.error(msg);
                        throw new AxisFault(msg);
                    }
                } catch (FileSystemException e) {
                    log.error("Error deleting file : " + fileObject, e);
                }
            }
View Full Code Here


                public void run() {
                    MessageReceiver mr = mc.getAxisOperation().getMessageReceiver();
                    try {
                        // This AxisFault is created to create the fault message context
                        // noinspection ThrowableInstanceNeverThrown
                        AxisFault axisFault = exceptionToRaise != null ?
                                new AxisFault(errorMessage, exceptionToRaise) :
                                new AxisFault(errorMessage);

                        MessageContext nioFaultMessageContext =
                            MessageContextBuilder.createFaultMessageContext(mc, axisFault);

                        SOAPEnvelope envelope = nioFaultMessageContext.getEnvelope();
View Full Code Here

            return failedRecordTimestampFormat;
      }

      @Override
    public EndpointReference[] getEndpointReferences(AxisService service, String ip) {
        return new EndpointReference[] { new EndpointReference("vfs:" + fileURI) };
    }
View Full Code Here

        try {

            MessageContext messageOut = MessageHelper.cloneMessageContext(messageIn);
            Options options = new Options();
            options.setTo(new EndpointReference(serviceUrl));
            if(messageIn.getSoapAction() != null) {

                options.setAction(messageIn.getSoapAction());

            } else {
View Full Code Here

        //do send the request. e.g.  http://localhost:8080/example/index.html/example/index.html
        axis2MsgCtx.removeProperty(NhttpConstants.REST_URL_POSTFIX);

        String transport = axis2MsgCtx.getTransportIn().getName();
        String address = synCtx.getTo().getAddress();
        EndpointReference to = getEndpointReferenceAfterURLRewrite(currentMember,
                transport, address);
        synCtx.setTo(to);

        DynamicLoadbalanceFaultHandler faultHandler = new DynamicLoadbalanceFaultHandler(to);
        faultHandler.setCurrentMember(currentMember);
View Full Code Here

                    log.error(msg, e);
                    throw new SynapseException(msg, e);
                }
            }

            return new EndpointReference(transport + "://" + currentMember.getHostName() +
                    ":" + ("http".equals(transport) ? currentMember.getHttpPort() :
                    currentMember.getHttpsPort()) + address);
        } else {
            String msg = "Cannot load balance for non-HTTP/S transport " + transport;
            log.error(msg);
View Full Code Here

                msgContext.setProperty(Constants.OUT_TRANSPORT_INFO,
                        new VFSOutTransportInfo(replyFileURI, entry.isFileLockingEnabled()));
            }

            // Determine the message builder to use
            Builder builder;
            if (contentType == null) {
                log.debug("No content type specified. Using SOAP builder.");
                builder = new SOAPBuilder();
            } else {
                int index = contentType.indexOf(';');
                String type = index > 0 ? contentType.substring(0, index) : contentType;
                builder = BuilderUtil.getBuilderFromSelector(type, msgContext);
                if (builder == null) {
                    if (log.isDebugEnabled()) {
                        log.debug("No message builder found for type '" + type +
                                "'. Falling back to SOAP.");
                    }
                    builder = new SOAPBuilder();
                }
            }

            // set the message payload to the message context
            InputStream in;
            ManagedDataSource dataSource;
            if (builder instanceof DataSourceMessageBuilder && entry.isStreaming()) {
                in = null;
                dataSource = ManagedDataSourceFactory.create(
                        new FileObjectDataSource(file, contentType));
            } else {
                in = content.getInputStream();
                dataSource = null;
            }
           
            try {
                OMElement documentElement;
                if (in != null) {
                    documentElement = builder.processDocument(in, contentType, msgContext);
                } else {
                    documentElement = ((DataSourceMessageBuilder)builder).processDocument(
                            dataSource, contentType, msgContext);
                }
                msgContext.setEnvelope(TransportUtils.createSOAPEnvelope(documentElement));
View Full Code Here

            // Determine the message builder to use
            Builder builder;
            if (contentType == null) {
                log.debug("No content type specified. Using SOAP builder.");
                builder = new SOAPBuilder();
            } else {
                int index = contentType.indexOf(';');
                String type = index > 0 ? contentType.substring(0, index) : contentType;
                builder = BuilderUtil.getBuilderFromSelector(type, msgContext);
                if (builder == null) {
                    if (log.isDebugEnabled()) {
                        log.debug("No message builder found for type '" + type +
                                "'. Falling back to SOAP.");
                    }
                    builder = new SOAPBuilder();
                }
            }

            // set the message payload to the message context
            InputStream in;
View Full Code Here

  public static void main(String[] args) throws AxisFault {
    new MicrosoftAsyncEchoClient ().run();
  }
 
  private void run () throws AxisFault {
    Call call = new Call(AXIS2_CLIENT_PATH);
    Options clientOptions = new Options ();
    call.setClientOptions(clientOptions);
   
    call.engageModule(new QName("sandesha"));
    clientOptions.setProperty(ClientAPI.AcksTo,"http://www-lk.wso2.com:9080/axis2/services/AnonymousService/echoString"); //Optional
   
    clientOptions.setTo(new EndpointReference(to));
    clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportTo);
    clientOptions.setProperty(ClientAPI.OFFERED_SEQUENCE_ID,SandeshaUtil.getUUID())//Optional
    clientOptions.setAction("urn:wsrm:EchoString");
    clientOptions.setSoapAction("urn:wsrm:EchoString");
    clientOptions.setProperty(ClientAPI.LAST_MESSAGE, "true");
    Callback callback3 = new TestCallback ("Callback 3");
    call.invokeNonBlocking("echoString", getEchoOMBlock("echo3"),callback3);
  }
View Full Code Here

    if ("<SANDESHA2_HOME>".equals(SANDESHA2_HOME)){
      System.out.println("ERROR: Please set the directory you unzipped Sandesha2 as the first option.");
      return;
    }
   
    Call call = new Call(AXIS2_CLIENT_PATH);
    call.engageModule(new QName("Sandesha2-0.9"));
    Options clientOptions = new Options ();
    clientOptions.setProperty(Options.COPY_PROPERTIES,new Boolean (true));
    call.setClientOptions(clientOptions);
   
    //You must set the following two properties in the request-reply case.
    clientOptions.setListenerTransportProtocol(Constants.TRANSPORT_HTTP);
    clientOptions.setUseSeparateListener(true);
   
    clientOptions.setProperty(Sandesha2ClientAPI.AcksTo,acksToEPR);
    clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
    clientOptions.setTo(new EndpointReference(toEPR));
    clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,toEPR);
    clientOptions.setProperty(Sandesha2ClientAPI.SEQUENCE_KEY,"sequence1")//Optional
    clientOptions.setSoapAction("test:soap:action");
    clientOptions.setProperty(Sandesha2ClientAPI.OFFERED_SEQUENCE_ID,SandeshaUtil.getUUID())//Optional
    Callback callback1 = new TestCallback ("Callback 1");
    call.invokeNonBlocking("echoString", getEchoOMBlock("echo1"),callback1);
    Callback callback2 = new TestCallback ("Callback 2");
    call.invokeNonBlocking("echoString", getEchoOMBlock("echo2"),callback2);
    clientOptions.setProperty(Sandesha2ClientAPI.LAST_MESSAGE, "true");
    Callback callback3 = new TestCallback ("Callback 3");
    call.invokeNonBlocking("echoString", getEchoOMBlock("echo3"),callback3);
   
        while (!callback3.isComplete()) {
            Thread.sleep(1000);
        }
   
    call.close();
  }
View Full Code Here

TOP

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

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.