コード例 #1
0
  protected HeaderProperty getHeader(List lista, String key) {
    HeaderProperty res = null;

    if (lista != null) {
      for (int i = 0; i < lista.size(); i++) {
        HeaderProperty hp = (HeaderProperty) lista.get(i);
        if (key.equals(hp.getKey())) {
          res = hp;
          break;
        }
      }
    }

    return res;
  }
コード例 #2
0
  /**
   * set the desired soapAction header field
   *
   * @param soapAction the desired soapAction
   * @param envelope the envelope containing the information for the soap call.
   * @param headers a list of HeaderProperties to be http header properties when establishing the
   *     connection
   * @return <code>CookieJar</code> with any cookies sent by the server
   * @throws IOException
   * @throws XmlPullParserException
   */
  public List call(String soapAction, SoapEnvelope envelope, List headers)
      throws IOException, XmlPullParserException {

    if (headers == null) {
      headers = new ArrayList();
    }

    HeaderProperty ref = getHeader(headers, "Connection");

    if (ref == null) {
      ref = new HeaderProperty("Connection", "keep-alive");
      headers.add(ref);
    } else {
      ref.setValue("keep-alive");
    }

    return super.call(soapAction, envelope, headers);
  }