Examples of Call


Examples of org.apache.axis.client.Call

        if (operationInfo == null) {
            throw new RuntimeException("Operation not mapped: " + method.getName() + " index: " + index + "\n OperationInfos: " + Arrays.asList(operations));
        }
        stub.checkCachedEndpoint();

        Call call = stub.createCall();

        operationInfo.prepareCall(call);

        stub.setUpCall(call);
        if (credentialsName != null) {
            Subject subject = ContextManager.getCurrentCaller();
            if (subject == null) {
                throw new IllegalStateException("Subject missing but authentication turned on");
            } else {
                Set creds = subject.getPrivateCredentials(NamedUsernamePasswordCredential.class);
                boolean found = false;
                for (Iterator iterator = creds.iterator(); iterator.hasNext();) {
                    NamedUsernamePasswordCredential namedUsernamePasswordCredential = (NamedUsernamePasswordCredential) iterator.next();
                    if (credentialsName.equals(namedUsernamePasswordCredential.getName())) {
                        call.setUsername(namedUsernamePasswordCredential.getUsername());
                        call.setPassword(new String(namedUsernamePasswordCredential.getPassword()));
                        found = true;
                        break;
                    }
                }
                if (!found) {
                    throw new IllegalStateException("no NamedUsernamePasswordCredential found for name " + credentialsName);
                }
            }
        }
        Object response = null;
        List parameterDescs = operationInfo.getOperationDesc().getParameters();
        Object[] unwrapped = extractFromHolders(objects, parameterDescs, operationInfo.getOperationDesc().getNumInParams());
        if (operationInfo.getOperationDesc().getMep() == OperationType.REQUEST_RESPONSE) {
            try {
                response = call.invoke(unwrapped);
            } catch (RemoteException e) {
                throw operationInfo.unwrapFault(e);
            }

            if (response instanceof RemoteException) {
                throw operationInfo.unwrapFault((RemoteException) response);
            } else {
                stub.extractAttachments(call);
                Map outputParameters = call.getOutputParams();
                putInHolders(outputParameters, objects, parameterDescs);
                Class returnType = operationInfo.getOperationDesc().getReturnClass();
                //return type should never be null... but we are not objecting if wsdl-return-value-mapping is not set.
                if (response == null || returnType == null || returnType.isAssignableFrom(response.getClass())) {
                    return response;
                } else {
                    return JavaUtils.convert(response, returnType);
                }
            }
        } else if (operationInfo.getOperationDesc().getMep() == OperationType.ONE_WAY) {
            //one way
            call.invokeOneWay(unwrapped);
            return null;
        } else {
            throw new RuntimeException("Invalid messaging style: " + operationInfo.getOperationDesc().getMep());
        }
    }
View Full Code Here

Examples of org.apache.axis.client.Call

        if (operationInfo == null) {
            throw new RuntimeException("Operation not mapped: " + method.getName() + " index: " + index + "\n OperationInfos: " + Arrays.asList(operations));
        }
        stub.checkCachedEndpoint();

        Call call = stub.createCall();

        operationInfo.prepareCall(call);

        stub.setUpCall(call);
        if (credentialsName != null) {
            Subject subject = ContextManager.getCurrentCaller();
            if (subject == null) {
                throw new IllegalStateException("Subject missing but authentication turned on");
            } else {
                Set creds = subject.getPrivateCredentials(NamedUsernamePasswordCredential.class);
                boolean found = false;
                for (Iterator iterator = creds.iterator(); iterator.hasNext();) {
                    NamedUsernamePasswordCredential namedUsernamePasswordCredential = (NamedUsernamePasswordCredential) iterator.next();
                    if (credentialsName.equals(namedUsernamePasswordCredential.getName())) {
                        call.setUsername(namedUsernamePasswordCredential.getUsername());
                        call.setPassword(new String(namedUsernamePasswordCredential.getPassword()));
                        found = true;
                        break;
                    }
                }
                if (!found) {
                    throw new IllegalStateException("no NamedUsernamePasswordCredential found for name " + credentialsName);
                }
            }
        }
        Object response = null;
        List parameterDescs = operationInfo.getOperationDesc().getParameters();
        Object[] unwrapped = extractFromHolders(objects, parameterDescs, operationInfo.getOperationDesc().getNumInParams());
        if (operationInfo.getOperationDesc().getMep() == OperationType.REQUEST_RESPONSE) {
            try {
                response = call.invoke(unwrapped);
            } catch (RemoteException e) {
                throw operationInfo.unwrapFault(e);
            }

            if (response instanceof RemoteException) {
                throw operationInfo.unwrapFault((RemoteException) response);
            } else {
                stub.extractAttachments(call);
                Map outputParameters = call.getOutputParams();
                putInHolders(outputParameters, objects, parameterDescs);
                Class returnType = operationInfo.getOperationDesc().getReturnClass();
                //return type should never be null... but we are not objecting if wsdl-return-value-mapping is not set.
                if (response == null || returnType == null || returnType.isAssignableFrom(response.getClass())) {
                    return response;
                } else {
                    return JavaUtils.convert(response, returnType);
                }
            }
        } else if (operationInfo.getOperationDesc().getMep() == OperationType.ONE_WAY) {
            //one way
            call.invokeOneWay(unwrapped);
            return null;
        } else {
            throw new RuntimeException("Invalid messaging style: " + operationInfo.getOperationDesc().getMep());
        }
    }
View Full Code Here

Examples of org.apache.axis.client.Call

        }

        public void run() {
            LocalTransport transport = new LocalTransport(server);
            transport.setRemoteService(SERVICE_NAME);
            Call call = new Call(new Service());
            call.setTransport(transport);

            for (int i = 0; i < reps; i++) {
                try {
                    String ret = (String)call.invoke("hello", null);
                    if (ret == null) {
                        MessageContext msgContext = call.getMessageContext();
                        String respStr = msgContext.getResponseMessage().getSOAPPartAsString();

                        String reqStr = msgContext.getRequestMessage().getSOAPPartAsString();
                        String nullStr = "Got null response! Request message:\r\n" + reqStr + "\r\n\r\n" +
                                  "Response message:\r\n" + respStr;
View Full Code Here

Examples of org.apache.axis2.client.Call

  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

Examples of org.apache.axis2.clientapi.Call

  public static void main(String[] args) throws AxisFault,IOException {

    System.out.println ("\nTHIS IS A SAMPLE APPLICATION TO DEMONSTRATE THE FUNCTIONALITY OF SERVICE GROUPS");
    System.out.println ("===============================================================================");
    Call call = new Call();
    call.setTransportInfo(Constants.TRANSPORT_HTTP,
        Constants.TRANSPORT_HTTP, false);
   
   
    boolean exit = false;
    String serviceGroupContextId = null;
    while (!exit) {
      BufferedReader reader = new BufferedReader (new InputStreamReader (System.in));

      System.out.print ("\n\nNew round (n) /continue round (c).../exit (e)");
      String option = reader.readLine();
      if ("e".equalsIgnoreCase(option)){
        System.out.println ("Exiting calculator...");
        return;
      }
     
      if (!"n".equalsIgnoreCase(option) && !"c".equalsIgnoreCase(option)){
        System.out.println ("Error: Invalid option");
        continue;
      }
     
      System.out.print ("Please Select the service ( '+' / '-' / '*' )....");
      String operation = reader.readLine();
      if (!"+".equalsIgnoreCase(operation) && !"-".equalsIgnoreCase(operation) && !"*".equalsIgnoreCase(operation)){
        System.out.println ("Error: Invalid option");
        continue;
      }
     
      if ("+".equals(operation))
        call.setTo(new EndpointReference (addService));
      else if ("-".equals(operation))
        call.setTo(new EndpointReference (substractService));
      else if ("*".equals(operation))
        call.setTo(new EndpointReference (multiplyService));
     
      if ("n".equalsIgnoreCase(option)){
        System.out.print ("Enter parameter 1...");
        String param1Str = reader.readLine();
        System.out.print ("Enter parameter 2...");
        String param2Str = reader.readLine();
        int param1 = Integer.parseInt(param1Str);
        int param2 = Integer.parseInt(param2Str);
       
        String opStr = null;
        if ("+".equals(operation)){
          opStr = "add";
        }else if ("-".equals(operation)){
          opStr = "substract";
        }else if ("*".equals(operation)){
          opStr = "multiply";
        }
        System.out.println("Invoking...");
        SOAPEnvelope result = call.invokeBlocking(opStr,getRequestEnvelope(opStr,param1,param2,
            serviceGroupContextId));
        printResult(result);
       
        if (serviceGroupContextId==null)
          serviceGroupContextId = getServiceGroupContextId(result);
       
       
      }else if ("c".equalsIgnoreCase(option)){
        if (serviceGroupContextId==null)
        {
          System.out.println ("Error: First operation must be a New one. Please select 'n'");
          continue;
        }
       
        System.out.print ("Enter parameter...");
        String paramStr = reader.readLine();
        int param = Integer.parseInt(paramStr);
        String opStr = null;
        if ("+".equals(operation)){
          opStr = "addPrevious";
        }else if ("-".equals(operation)){
          opStr = "substractPrevious";
        }else if ("*".equals(operation)){
          opStr = "multiplyPrevious";
        }
       
        System.out.println("Invoking...");
        SOAPEnvelope result = call.invokeBlocking(opStr,getPreviousRequestEnvelope(opStr,param,
            serviceGroupContextId));
        printResult(result);
       
      }
     
View Full Code Here

Examples of org.apache.cocoon.template.instruction.Call

                    ev = ev.execute(consumer, objectModel,
                            executionContext, macroContext, namespaces, startEvent, endEvent);
                    continue;
                }

                Call call = new Call( def, startElement );
                ev = call.execute(consumer, objectModel,
                        executionContext, macroContext, namespaces, startEvent, endEvent);
            } else
                ev = ev.execute(consumer, objectModel, executionContext,
                        macroContext, namespaces, startEvent, endEvent);
        }
View Full Code Here

Examples of org.apache.hadoop.hbase.ipc.RpcServer.Call

    countDownLatch.await();
    assertEquals(3, ImmutableSet.copyOf(handlerThreads.values()).size());
  }

  private CallRunner createMockTask() {
    Call call = mock(Call.class);
    CallRunner task = mock(CallRunner.class);
    when(task.getCall()).thenReturn(call);
    return task;
  }
View Full Code Here

Examples of org.apache.harmony.pack200.NewAttributeBands.Call

        List firstBody = firstCallable.getBody();
        assertEquals(1, firstBody.size());
        Replication rep = (Replication) firstBody.get(0);
        List repBody = rep.getLayoutElements();
        assertEquals(1, repBody.size());
        Call call = (Call) repBody.get(0);
        assertEquals(1, call.getCallableIndex());
        assertEquals(secondCallable, call.getCallable());
    }
View Full Code Here

Examples of org.apache.soap.rpc.Call

    }

    public Call getCall() {
        Trc.entry(this);
        if ( call == null ) {
           call = new Call();
           call.setSOAPMappingRegistry(
               new WSIFSOAPMappingRegistry(createSOAPMappingRegistry( call )));
           prepareTypeMappings();
        }
        Trc.exit(call);
View Full Code Here

Examples of org.cipango.client.test.SipTester.Call

  public void testCall() throws Exception
  {
    SipTester alice = SipTest.create("alice");
    SipTester bob = SipTest.create("bob");
   
    Call call = alice.createCall(bob);
    SipServletRequest invite = call.createInvite();
    invite.send();
   
   
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.