/**
   * Invoke a SOAP call.
   *
   * @param soapCall the call to make to a SOAP web service
   * @return information about the SOAP response
   */
  @Override
  public SoapCallReturn invokeSoapCall(SoapCall<Stub> soapCall) {
    Stub stub = soapCall.getSoapClient();
    SoapCallReturn.Builder builder = new SoapCallReturn.Builder();
    synchronized (stub) {
      Object result = null;
      try {
        result = invoke(soapCall);
      } catch (InvocationTargetException e) {
        builder.withException(e.getTargetException());
      } catch (Exception e) {
        builder.withException(e);
      } finally {
        MessageContext messageContext = stub._getCall().getMessageContext();
        try {
          builder.withRequestInfo(
              new RequestInfo.Builder()
                  .withSoapRequestXml(messageContext.getRequestMessage().getSOAPPartAsString())
                  .withMethodName(stub._getCall().getOperationName().getLocalPart())
                  .withServiceName(stub.getPortName().getLocalPart())
                  .withUrl(stub._getCall().getTargetEndpointAddress())
                  .build());
        } catch (AxisFault e) {
          builder.withException(e);
        }
        try {
          builder.withResponseInfo(
              new ResponseInfo.Builder()
                  .withSoapResponseXml(messageContext.getResponseMessage().getSOAPPartAsString())
                  .build());
        } catch (AxisFault e) {
          builder.withException(e);
        }
      }

      return builder.withReturnValue(result).build();
    }
  }
예제 #2
0
  public void init(String urlStr, String cookieString) throws Exception {
    if (_service != null) {
      disconnect();
    }
    _locator = new VimServiceLocator();
    _locator.setMaintainSession(true);
    _service = _locator.getVimPort(new URL(urlStr));
    _sic = _service.retrieveServiceContent(_svcRef);

    org.apache.axis.client.Stub st = (org.apache.axis.client.Stub) _service;
    org.apache.axis.client.Call callObj = st._getCall();
    org.apache.axis.MessageContext msgContext = callObj.getMessageContext();
    msgContext.setProperty(
        org.apache.axis.transport.http.HTTPConstants.HEADER_COOKIE, cookieString);

    _svcState = ConnectionState_Connected;
  }