Package org.apache.axis.client

Examples of org.apache.axis.client.Call


  {
    byte[] returnByteArray = null;
    try {
      Service service = new Service();

      Call call = (Call)service.createCall();
      call.setTargetEndpointAddress(new java.net.URL(WEB_SERVICE_URL));
      call.setOperationName(new QName("LicenseAdminSoapService", "obtainLicenseFile"));
      call.addParameter("arg1", XMLType.XSD_BASE64, ParameterMode.IN);
      call.addParameter("arg2", XMLType.XSD_BASE64, ParameterMode.IN);
      call.setReturnType(XMLType.XSD_BASE64);
      returnByteArray = (byte[])call.invoke(new Object[] { blowfishKey, serverData });
    } catch (RemoteException remoteException) {
      logger.error("[obtainLicenseFile] Exception thrown.", remoteException);
      throw new AxisFault(SERVER_DOWN_MESSAGE);
    } catch (Exception exception) {
      logger.error("[obtainLicenseFile] Exception thrown.", exception);
View Full Code Here


    {
      String endpoint = "http://" + host + ":" + port
          + "/xbus/services/xBusAdministration";

      Service service = new Service();
      Call call = (Call) service.createCall();

      call.setTargetEndpointAddress(new URL(endpoint));
      call.setOperationName(new QName("http://soapinterop.org/",
          "restart"));

      return (String) call.invoke(new Object[0]);

    }
    catch (Exception e)
    {
      throw new XException(Constants.LOCATION_INTERN,
View Full Code Here

        // Method Name to invoke for the SparePartInfo Web Service
        String methodName  = "getPartInfo";
       
        // Create the Service call
        Service service = new Service();
        Call call = (Call) service.createCall();
        call.setTargetEndpointAddress(new java.net.URL(endpointURL));
        call.setOperationName(new QName("SparePartInfo",methodName));
        call.addParameter( "sku",
                           XMLType.XSD_STRING,
                           ParameterMode.IN );
                          
        call.setReturnType( XMLType.XSD_FLOAT );
     
        //Setup the Parameters i.e. the Part SKU to be passed as input parameter to th
        //SparePartInfo Web Service
        Object[] params = new Object[] { PartSKU };
     
        //Invoke the SparePartInfo Web Service
        return (String) call.invoke(params);
    }
View Full Code Here

  void getServices() {
    String endpoint = urlBase + "axisadmin";
    try {
 
      Service  service = new Service();
      Call     call    = (Call) service.createCall();
     
      call.setTargetEndpointAddress( new URL(endpoint) );
      call.setOperationName(new QName("getPublishedServiceNames"));
     
      Object[]       params = new Object[] { };
     
      String[] result  = (String[])call.invoke(params);
     
      synchronized(services) {
  services.clear();
  for(int i = 0; i < result.length; i++) {
    services.add(result[i]);
View Full Code Here

      }

      String endpoint = wsdl.endPoint;

      Service  service = new Service();
      Call     call    = (Call) service.createCall();

      call.setTargetEndpointAddress( new URL(endpoint) );
      call.setOperationName(new QName(op.getName()));
     
      java.util.List values = new ArrayList();

      Object         result  = null;
      java.util.List names = null;

      try {
  getParams(call, values, inComp, 0)

  if(Activator.bVerbose) {
    System.out.println("call with values=" + values);
  }

  Object[]       params = values.toArray();
 
        result  = call.invoke(params);

  if(Activator.bVerbose) {
    System.out.println("got result=" + result);
  }
  names   = Util.getPartNames(msg_out);
View Full Code Here

    public String doit(String[] args) throws Exception {
        Options opts = new Options(args);
        opts.setDefaultURL("http://localhost:8080/services/MessageService");

        Service  service = new Service();
        Call     call    = (Call) service.createCall();

        call.setTargetEndpointAddress( new URL(opts.getURL()) );
        SOAPBodyElement[] input = new SOAPBodyElement[3];

        input[0] = new SOAPBodyElement(XMLUtils.StringToElement("urn:foo",
                                                                "e1", "Hello"));
        input[1] = new SOAPBodyElement(XMLUtils.StringToElement("urn:foo",
                                                                "e1", "World"));

        DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
        Document doc            = builder.newDocument();  
        Element cdataElem       = doc.createElementNS("urn:foo", "e3");
        CDATASection cdata      = doc.createCDATASection("Text with\n\tImportant  <b>  whitespace </b> and tags! ");     
        cdataElem.appendChild(cdata);
   
        input[2] = new SOAPBodyElement(cdataElem);
       
        Vector          elems = (Vector) call.invoke( input );
        SOAPBodyElement elem  = null ;
        Element         e     = null ;

        elem = (SOAPBodyElement) elems.get(0);
        e    = elem.getAsDOM();
View Full Code Here

        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.getNextCaller();
            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

        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

        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

        }

        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

TOP

Related Classes of org.apache.axis.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.