Example usage for org.apache.commons.httpclient.methods PostMethod addParameter

List of usage examples for org.apache.commons.httpclient.methods PostMethod addParameter

Introduction

In this page you can find the example usage for org.apache.commons.httpclient.methods PostMethod addParameter.

Prototype

public void addParameter(String paramString1, String paramString2) throws IllegalArgumentException 

Source Link

Usage

From source file:com.testmax.uri.HttpSoapWebservice.java

public String handleHTTPPostPerformance() throws Exception {
    String resp = null;/*from w  w w. ja v a 2  s. co  m*/
    int startcount = 5;
    boolean isItemIdReplaced = false;
    String replacedParam = "";
    // Create a method instance.
    PostMethod method = new PostMethod(this.url);
    System.out.println(this.url);
    List<NameValuePair> nvps = new ArrayList<NameValuePair>();

    URLConfig urlConf = this.page.getPageURL().getUrlConfig(this.action);
    List<Element> globalItemList = urlConf.getItemListElement();
    if (globalItemList.size() > 0) {
        urlConf.setItemList();
        isItemIdReplaced = true;
    }
    Set<String> s = urlConf.getUrlParamset();

    for (String param : s) {

        if (!isItemIdReplaced) {

            method.addParameter(param, urlConf.getUrlParamValue(param));

        } else {
            replacedParam = urlConf.getUrlReplacedItemIdParamValue(param);
            method.addParameter(param, replacedParam);
        }

    }
    org.apache.commons.httpclient.HttpClient client = new org.apache.commons.httpclient.HttpClient();

    this.startRecording();
    long starttime = this.getCurrentTime();
    int statusCode = 0;
    try {

        // Execute the method.
        statusCode = client.executeMethod(method);

        if (statusCode != HttpStatus.SC_OK) {
            WmLog.getCoreLogger()
                    .info("Auth Server response received, but there was a ParserConfigurationException: ");
        }

        // Read the response body.
        byte[] responseBody = method.getResponseBody();

        resp = new String(responseBody, "UTF-8");

        // log the response
        WmLog.getCoreLogger().info("MDE Request  : " + resp);

    } catch (HttpException e) {
        WmLog.getCoreLogger().info("Unable to retrieve response from MDE webservice : " + e.getMessage());
        return null;
    } catch (IOException e) {
        WmLog.getCoreLogger().info("Unable to retrieve response from MDE webservice : " + e.getMessage());
        return null;
    } finally {
        // Release the connection.
        method.releaseConnection();
    }

    // Measure the time passed between response
    long elaspedTime = this.getElaspedTime(starttime);
    this.stopMethodRecording(statusCode, elaspedTime, startcount);

    //System.out.println(resp);
    System.out.println("ElaspedTime: " + elaspedTime);
    WmLog.getCoreLogger().info("Response XML: " + resp);
    WmLog.getCoreLogger().info("ElaspedTime: " + elaspedTime);
    this.printMethodRecording(statusCode, this.url);
    this.printMethodLog(statusCode, this.url);
    if (statusCode == 200 && validateAssert(urlConf, resp)) {
        this.addThreadActionMonitor(this.action, true, elaspedTime);
    } else {
        this.addThreadActionMonitor(this.action, false, elaspedTime);
        WmLog.getCoreLogger().info("Input XML: " + replacedParam);
        WmLog.getCoreLogger().info("Response XML: " + resp);
    }

    return (resp);

}

From source file:massbank.CallCgi.java

public void run() {
    String progName = "CallCgi";
    String msg = "";

    HttpClient client = new HttpClient();
    // ^CAEgl(msec)Zbg
    client.setTimeout(m_timeout * 1000);
    PostMethod method = new PostMethod(this.m_url);
    String strParam = "";
    if (m_params != null && m_params.size() > 0) {
        for (Enumeration keys = m_params.keys(); keys.hasMoreElements();) {
            String key = (String) keys.nextElement();
            if (!key.equals("inst_grp") && !key.equals("inst") && !key.equals("ms")
                    && !key.equals("inst_grp_adv") && !key.equals("inst_adv") && !key.equals("ms_adv")) {
                // L?[InstrumentType,MSTypeO??Stringp??[^
                String val = (String) m_params.get(key);
                strParam += key + "=" + val + "&";
                method.addParameter(key, val);
            } else {
                // L?[InstrumentType,MSType??Stringzp??[^
                String[] vals = (String[]) m_params.get(key);
                for (int i = 0; i < vals.length; i++) {
                    strParam += key + "=" + vals[i] + "&";
                    method.addParameter(key, vals[i]);
                }//from   ww  w. j a va  2 s. co  m
            }
        }
        strParam = strParam.substring(0, strParam.length() - 1);
    }

    try {
        // ?s
        int statusCode = client.executeMethod(method);
        // Xe?[^XR?[h`FbN
        if (statusCode != HttpStatus.SC_OK) {
            // G?[
            msg = method.getStatusLine().toString() + "\n" + "URL  : " + this.m_url;
            msg += "\nPARAM : " + strParam;
            MassBankLog.ErrorLog(progName, msg, m_context);
            return;
        }
        // X|X
        //         this.result = method.getResponseBodyAsString();

        /**
         * modification start
         * Use method.getResponseBodyAsStream() rather 
         * than method.getResponseBodyAsString() (marked as deprecated) for updated HttpClient library.
         * Prevents logging of message:
         * "Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended."
         */

        String charset = method.getResponseCharSet();
        InputStream is = method.getResponseBodyAsStream();
        StringBuilder sb = new StringBuilder();
        String line = "";
        if (is != null) {
            BufferedReader reader = new BufferedReader(new InputStreamReader(is, charset));
            while ((line = reader.readLine()) != null) {
                reader.mark(2000);
                String forward = reader.readLine();
                if ((line.equals("") || line.equals("\n") || line.equals("OK")) && forward == null)
                    sb.append(line); // append last line to StringBuilder
                else if (forward != null)
                    sb.append(line).append("\n"); // append current line with explicit line break
                else
                    sb.append(line);

                reader.reset();
            }
            reader.close();
            is.close();

            //            this.result = sb.toString().trim();
            this.result = sb.toString(); // trim() deleted. because the last [\t] and [\n] are removed.
            if (this.result.endsWith("\n")) // remove trailing line break
            {
                int pos = this.result.lastIndexOf("\n");
                this.result = this.result.substring(0, pos);
            }
        } else {
            this.result = "";
        }

        /**
         * modification end
         */
    } catch (Exception e) {
        // G?[
        msg = e.toString() + "\n" + "URL  : " + this.m_url;
        msg += "\nPARAM : " + strParam;
        MassBankLog.ErrorLog(progName, msg, m_context);
    } finally {
        // RlNV
        method.releaseConnection();
    }
}

From source file:com.kaltura.client.KalturaClientBase.java

private PostMethod addParams(PostMethod method, KalturaParams kparams) {

    for (Entry<String, String> itr : kparams.entrySet()) {
        method.addParameter(itr.getKey(), itr.getValue());
    }/*  www.  j a  va 2  s .c  o m*/

    return method;

}

From source file:JiraWebClient.java

public void addCommentToIssue(final JiraIssue issue, final String comment, IProgressMonitor monitor)
        throws JiraException {
    doInSession(monitor, new JiraWebSessionCallback() {
        @Override/* ww  w  .j av  a 2  s .c  om*/
        public void run(JiraClient client, String baseUrl, IProgressMonitor monitor) throws JiraException {
            StringBuilder rssUrlBuffer = new StringBuilder(baseUrl);
            rssUrlBuffer.append("/secure/AddComment.jspa"); //$NON-NLS-1$

            PostMethod post = new PostMethod(rssUrlBuffer.toString());
            post.setRequestHeader("Content-Type", getContentType(monitor)); //$NON-NLS-1$
            prepareSecurityToken(post);
            post.addParameter("comment", comment); //$NON-NLS-1$
            post.addParameter("commentLevel", ""); //$NON-NLS-1$ //$NON-NLS-2$
            post.addParameter("id", issue.getId()); //$NON-NLS-1$

            try {
                execute(post);
                if (!expectRedirect(post, "/browse/" + issue.getKey(), false)) { //$NON-NLS-1$
                    handleErrorMessage(post);
                }
            } finally {
                post.releaseConnection();
            }
        }

    });
}

From source file:JiraWebClient.java

public void assignIssueTo(final JiraIssue issue, final int assigneeType, final String user,
        final String comment, IProgressMonitor monitor) throws JiraException {
    doInSession(monitor, new JiraWebSessionCallback() {
        @Override//  w ww.  j a v a  2  s .  c om
        public void run(JiraClient server, String baseUrl, IProgressMonitor monitor) throws JiraException {
            StringBuilder rssUrlBuffer = new StringBuilder(baseUrl);
            rssUrlBuffer.append("/secure/AssignIssue.jspa"); //$NON-NLS-1$

            PostMethod post = new PostMethod(rssUrlBuffer.toString());
            post.setRequestHeader("Content-Type", getContentType(monitor)); //$NON-NLS-1$
            prepareSecurityToken(post);

            post.addParameter("assignee", client.getAssigneeParam(issue, assigneeType, user)); //$NON-NLS-1$

            if (comment != null) {
                post.addParameter("comment", comment); //$NON-NLS-1$
            }
            post.addParameter("commentLevel", ""); //$NON-NLS-1$ //$NON-NLS-2$
            post.addParameter("id", issue.getId()); //$NON-NLS-1$

            try {
                execute(post);
                if (!expectRedirect(post, issue)) {
                    handleErrorMessage(post);
                }
            } finally {
                post.releaseConnection();
            }
        }

    });
}

From source file:application.draw.SaveButtonDebuggFrame.java

private void updateButtonActionPerformed(ActionEvent evt) {
    // System.out.println("updateButton.actionPerformed, event="+evt);
    //TODO add your code for updateButton.actionPerformed

    /* make the body (fig) */
    String fig = this.applet.frm.editdispatch.getFigString();
    /*/*  ww  w. j  av a 2  s  . co m*/
    try{
       fig=new String(fig.getBytes("UTF-8"),  "UTF-8");
    }
    catch(Exception e){
       return;
    }
    */
    this.updateText = this.updateText + "\n " + insertSpaceAfterNewLine(fig);

    this.urlField.setText(this.actionUrl);
    String url = this.urlField.getText();
    this.messageTextArea.setText(url + "\n");
    //      this.messageTextArea.append(this.updateText);
    BufferedReader br = null;
    //      System.out.println("updateText="+this.updateText);
    System.out.println("editWriteValue=" + this.editWriteValue);
    System.out.println("editCmd=" + this.editCmd);
    System.out.println("editPage=" + this.editPage);
    System.out.println("digest=" + this.editDigest);
    try {
        PostMethod method = new PostMethod(url);
        if (this.client == null)
            return;
        method.getParams().setContentCharset(this.pageCharSet);
        method.setParameter("msg", this.updateText);
        //          method.setParameter("encode_hint",this.editEncodeHint);
        method.addParameter("write", this.editWriteValue);
        method.addParameter("cmd", this.editCmd);
        method.addParameter("page", this.editPage);
        method.addParameter("digest", this.editDigest);
        int status = client.executeMethod(method);
        if (status != HttpStatus.SC_OK) {
            System.err.println("Method failed: " + method.getStatusLine());
            method.getResponseBodyAsString();
        } else {
            br = new BufferedReader(new InputStreamReader(method.getResponseBodyAsStream()));
            String readLine;
            while (((readLine = br.readLine()) != null)) {
                System.err.println(readLine);
            }
        }
        method.releaseConnection();
    } catch (Exception e) {
        //         this.messageTextArea.append(e.toString()+"\n");
        System.out.println("" + e);
        e.printStackTrace();
    }

}

From source file:it.eng.spagobi.commons.utilities.ExecutionProxy.java

/**
 * Executes a document in background with the given profile.
 * /*from  w  w w .j  a  v a 2 s.  c om*/
 * @param profile The user profile
 * @param modality The execution modality (for auditing)
 * @param defaultOutputFormat The default output format (optional)
 * , considered if the document has no output format parameter set
 * 
 * @return the byte[]
 */
public byte[] exec(IEngUserProfile profile, String modality, String defaultOutputFormat) {
    logger.debug("IN");
    byte[] response = new byte[0];
    try {
        if (biObject == null)
            return response;
        // get the engine of the biobject
        Engine eng = biObject.getEngine();
        // if engine is not an external it's not possible to call it using
        // url
        if (!EngineUtilities.isExternal(eng))
            if (eng.getClassName().equals("it.eng.spagobi.engines.kpi.SpagoBIKpiInternalEngine")) {
                SourceBean request = null;
                SourceBean resp = null;
                EMFErrorHandler errorHandler = null;

                try {
                    request = new SourceBean("");
                    resp = new SourceBean("");
                } catch (SourceBeanException e1) {
                    e1.printStackTrace();
                }
                RequestContainer reqContainer = new RequestContainer();
                ResponseContainer resContainer = new ResponseContainer();
                reqContainer.setServiceRequest(request);
                resContainer.setServiceResponse(resp);
                DefaultRequestContext defaultRequestContext = new DefaultRequestContext(reqContainer,
                        resContainer);
                resContainer.setErrorHandler(new EMFErrorHandler());
                RequestContainer.setRequestContainer(reqContainer);
                ResponseContainer.setResponseContainer(resContainer);
                Locale locale = new Locale("it", "IT", "");
                SessionContainer session = new SessionContainer(true);
                reqContainer.setSessionContainer(session);
                SessionContainer permSession = session.getPermanentContainer();
                //IEngUserProfile profile = new AnonymousCMSUserProfile();
                permSession.setAttribute(IEngUserProfile.ENG_USER_PROFILE, profile);
                errorHandler = defaultRequestContext.getErrorHandler();

                String className = eng.getClassName();
                logger.debug("Try instantiating class " + className + " for internal engine " + eng.getName()
                        + "...");
                InternalEngineIFace internalEngine = null;
                // tries to instantiate the class for the internal engine
                try {
                    if (className == null && className.trim().equals(""))
                        throw new ClassNotFoundException();
                    internalEngine = (InternalEngineIFace) Class.forName(className).newInstance();
                } catch (ClassNotFoundException cnfe) {
                    logger.error("The class ['" + className + "'] for internal engine " + eng.getName()
                            + " was not found.", cnfe);
                    Vector params = new Vector();
                    params.add(className);
                    params.add(eng.getName());
                    errorHandler.addError(new EMFUserError(EMFErrorSeverity.ERROR, 2001, params));
                    return response;
                } catch (Exception e) {
                    logger.error("Error while instantiating class " + className, e);
                    errorHandler.addError(new EMFUserError(EMFErrorSeverity.ERROR, 100));
                    return response;
                }
                try {
                    reqContainer.setAttribute("scheduledExecution", "true");
                    internalEngine.execute(reqContainer, biObject, resp);
                } catch (EMFUserError e) {
                    logger.error("Error during engine execution", e);
                    errorHandler.addError(e);
                } catch (Exception e) {
                    logger.error("Error while engine execution", e);
                    errorHandler.addError(new EMFUserError(EMFErrorSeverity.ERROR, 100));
                }
                return response;
            } else if (eng.getClassName().equals("it.eng.spagobi.engines.chart.SpagoBIChartInternalEngine")) {
                SourceBean request = null;
                EMFErrorHandler errorHandler = null;
                try {
                    request = new SourceBean("");
                } catch (SourceBeanException e1) {
                    e1.printStackTrace();
                }
                RequestContainer reqContainer = new RequestContainer();
                SpagoBIChartInternalEngine sbcie = new SpagoBIChartInternalEngine();

                // Call chart engine
                File file = sbcie.executeChartCode(reqContainer, biObject, null, profile);

                // read input from file
                InputStream is = new FileInputStream(file);

                // Get the size of the file
                long length = file.length();

                if (length > Integer.MAX_VALUE) {
                    logger.error("file too large");
                    return null;
                }

                // Create the byte array to hold the data
                byte[] bytes = new byte[(int) length];

                // Read in the bytes
                int offset = 0;
                int numRead = 0;
                while (offset < bytes.length
                        && (numRead = is.read(bytes, offset, bytes.length - offset)) >= 0) {
                    offset += numRead;
                }

                // Ensure all the bytes have been read in
                if (offset < bytes.length) {
                    logger.warn("Could not read all the file");
                }
                // Close the input stream and return bytes
                is.close();
                return bytes;
            } // end chart case
            else {
                return response;
            }
        // get driver class
        String driverClassName = eng.getDriverName();

        // build an instance of the driver
        IEngineDriver aEngineDriver = (IEngineDriver) Class.forName(driverClassName).newInstance();

        // get the map of parameter to send to the engine
        Map mapPars = aEngineDriver.getParameterMap(biObject, profile, "");
        if (defaultOutputFormat != null && !defaultOutputFormat.trim().equals("")) {
            List params = biObject.getBiObjectParameters();
            Iterator iterParams = params.iterator();
            boolean findOutPar = false;
            while (iterParams.hasNext()) {
                BIObjectParameter par = (BIObjectParameter) iterParams.next();
                String parUrlName = par.getParameterUrlName();
                List values = par.getParameterValues();
                logger.debug("processing biparameter with url name " + parUrlName);
                if (parUrlName.equalsIgnoreCase("outputType") && values != null && values.size() > 0) {
                    findOutPar = true;
                    break;
                }
            }
            if (!findOutPar) {
                mapPars.put("outputType", defaultOutputFormat);
            }
        }

        adjustParametersForExecutionProxy(aEngineDriver, mapPars, modality);

        // pass ticket ...
        String pass = SingletonConfig.getInstance().getConfigValue("SPAGOBI_SSO.PASS");
        if (pass == null)
            logger.warn("Pass Ticket is null");
        mapPars.put(SpagoBIConstants.PASS_TICKET, pass);

        // TODO merge with ExecutionInstance.addSystemParametersForExternalEngines for SBI_CONTEXT, locale parameters, etc...

        // set spagobi context
        if (!mapPars.containsKey(SpagoBIConstants.SBI_CONTEXT)) {
            String sbicontext = GeneralUtilities.getSpagoBiContext();
            if (sbicontext != null) {
                mapPars.put(SpagoBIConstants.SBI_CONTEXT, sbicontext);
            }
        }

        // set country and language (locale)
        Locale locale = GeneralUtilities.getDefaultLocale();
        if (!mapPars.containsKey(SpagoBIConstants.SBI_COUNTRY)) {
            String country = locale.getCountry();
            mapPars.put(SpagoBIConstants.SBI_COUNTRY, country);
        }
        if (!mapPars.containsKey(SpagoBIConstants.SBI_LANGUAGE)) {
            String language = locale.getLanguage();
            mapPars.put(SpagoBIConstants.SBI_LANGUAGE, language);
        }

        //set userId if it's a send mail operation (backend operation)
        if (sendMailOperation.equals(modality) || exportOperation.equals(modality)) {
            mapPars.put(SsoServiceInterface.USER_ID, ((UserProfile) profile).getUserUniqueIdentifier());
        }

        // adding SBI_EXECUTION_ID parameter
        if (!mapPars.containsKey("SBI_EXECUTION_ID")) {
            UUIDGenerator uuidGen = UUIDGenerator.getInstance();
            UUID uuidObj = uuidGen.generateTimeBasedUUID();
            String executionId = uuidObj.toString();
            executionId = executionId.replaceAll("-", "");
            mapPars.put("SBI_EXECUTION_ID", executionId);
        }

        // AUDIT
        AuditManager auditManager = AuditManager.getInstance();
        Integer auditId = auditManager.insertAudit(biObject, null, profile, "",
                modality != null ? modality : "");
        // adding parameters for AUDIT updating
        if (auditId != null) {
            mapPars.put(AuditManager.AUDIT_ID, auditId.toString());
        }

        // built the request to sent to the engine
        Iterator iterMapPar = mapPars.keySet().iterator();
        HttpClient client = new HttpClient();
        // get the url of the engine
        String urlEngine = getExternalEngineUrl(eng);
        PostMethod httppost = new PostMethod(urlEngine);
        while (iterMapPar.hasNext()) {
            String parurlname = (String) iterMapPar.next();
            String parvalue = "";
            if (mapPars.get(parurlname) != null)
                parvalue = mapPars.get(parurlname).toString();
            httppost.addParameter(parurlname, parvalue);
        }
        // sent request to the engine
        int statusCode = client.executeMethod(httppost);
        logger.debug("statusCode=" + statusCode);
        response = httppost.getResponseBody();
        logger.debug("response=" + response.toString());
        Header headContetType = httppost.getResponseHeader("Content-Type");
        if (headContetType != null) {
            returnedContentType = headContetType.getValue();
        } else {
            returnedContentType = "application/octet-stream";
        }

        auditManager.updateAudit(auditId, null, new Long(GregorianCalendar.getInstance().getTimeInMillis()),
                "EXECUTION_PERFORMED", null, null);
        httppost.releaseConnection();
    } catch (Exception e) {
        logger.error("Error while executing object ", e);
    }
    logger.debug("OUT");
    return response;
}

From source file:net.sf.sail.webapp.domain.webservice.http.impl.HttpRestTransportImpl.java

/**
 * @see net.sf.sail.webapp.domain.webservice.http.HttpRestTransport#post(net.sf.sail.webapp.domain.webservice.http.HttpPostRequest)
 *///from www.j a  va2 s . c om
public Map<String, String> post(final HttpPostRequest httpPostRequestData) throws HttpStatusCodeException {
    final PostMethod method = new PostMethod(this.baseUrl + httpPostRequestData.getRelativeUrl());

    this.setHeaders(httpPostRequestData, method);

    // set body data
    final String bodyData = httpPostRequestData.getBodyData();
    if (StringUtils.hasText(bodyData)) {
        method.setRequestEntity(new StringRequestEntity(bodyData));
    }

    // set parameters
    final Map<String, String> requestParameters = httpPostRequestData.getRequestParameters();
    if (requestParameters != null && !requestParameters.isEmpty()) {
        final Set<String> keys = requestParameters.keySet();
        for (Iterator<String> i = keys.iterator(); i.hasNext();) {
            String key = i.next();
            method.addParameter(key, requestParameters.get(key));
        }
    }

    final Map<String, String> responseHeaders = new HashMap<String, String>();
    try {
        // Execute the method.
        logRequest(method, bodyData);
        final int statusCode = this.client.executeMethod(method);
        httpPostRequestData.isValidResponseStatus(method, statusCode);
        final Header[] headers = method.getResponseHeaders();
        for (int i = 0; i < headers.length; i++) {
            responseHeaders.put(headers[i].getName(), headers[i].getValue());
        }
    } catch (HttpException e) {
        logAndThrowRuntimeException(e);
    } catch (IOException e) {
        logAndThrowRuntimeException(e);
    } finally {
        method.releaseConnection();
    }

    return responseHeaders;
}

From source file:JiraWebClient.java

public void advanceIssueWorkflow(final JiraIssue issue, final String actionKey, final String comment,
        final String[] fields, IProgressMonitor monitor) throws JiraException {
    doInSession(monitor, new JiraWebSessionCallback() {
        @Override/*from  w  ww .  ja v  a 2s .c  o m*/
        public void run(JiraClient server, String baseUrl, IProgressMonitor monitor) throws JiraException {
            PostMethod post = new PostMethod(baseUrl + "/secure/CommentAssignIssue.jspa"); //$NON-NLS-1$
            post.setRequestHeader("Content-Type", getContentType(monitor)); //$NON-NLS-1$
            prepareSecurityToken(post);

            post.addParameter("id", issue.getId()); //$NON-NLS-1$
            post.addParameter("action", actionKey); //$NON-NLS-1$
            // method.addParameter("assignee", issue.getAssignee());

            if (comment != null) {
                post.addParameter("comment", comment); //$NON-NLS-1$
            }
            post.addParameter("commentLevel", ""); //$NON-NLS-1$ //$NON-NLS-2$

            addFields(server, issue, post, fields);

            try {
                execute(post);
                if (!expectRedirect(post, issue)) {
                    handleErrorMessage(post);
                }
            } finally {
                post.releaseConnection();
            }
        }
    });
}

From source file:autohit.call.modules.SimpleHttpModule.java

/**
 * Post method. It will set the target address for the client, as well as
 * clearing any state.//w w  w . j  a v  a2  s  .com
 * 
 * @param url
 *            the Url path, not to include protocol, address, and port (ie.
 *            "/goats/index.html").
 * @param nv
 *            set of name/value pairs for the post. it can be empty.
 * @return the data from the page as a String
 * @throws CallException
 */
private String post(String url, Hashtable nv) throws CallException {

    if (started == false) {
        throw buildException("Tried to post when a session wasn't started.", CallException.CODE_MODULE_FAULT);
    }

    String result = null;
    String name;
    Object value;

    // Construct our method.
    PostMethod method = new PostMethod(url);
    method.setFollowRedirects(true);
    method.setStrictMode(false);

    //build the rest of the method
    try {
        // Construct the headers
        Enumeration eNV = nv.keys();
        while (eNV.hasMoreElements()) {
            name = (String) eNV.nextElement();
            value = nv.get(name);
            if (value instanceof String) {
                // Only take it if it is a string
                method.addParameter(name, (String) value);
                debug("ADD POST - name=" + name + " value=" + (String) value);
            }
        }
        //DEBUG
        debug("DUMP POST-------------------------------");
        debug(method.toString());
        debug("DUMP POST-------------------------------");

        // Do it
        debug("(post)post=" + url);
        httpClient.executeMethod(method);

        // Process result
        result = method.getResponseBodyAsString();
        log("(post)" + method.getStatusLine().toString() + " size=" + result.length());

    } catch (HttpException he) {
        // Bad but not fatal
        error("(post)Error on connect to url " + url + ".  Error=" + he.getMessage());
    } catch (IOException ioe) {
        // Fatal
        throw buildException("(post)Unable to connect.  Session is invalid.", CallException.CODE_MODULE_FAULT,
                ioe);

    } catch (Exception ex) {
        // Fatal
        throw buildException("(post)Serious general error.", CallException.CODE_MODULE_FAULT, ex);
    } finally {
        try {
            method.releaseConnection();
            method.recycle();
        } catch (Exception e) {
            // Already FUBAR
        }
    }
    return result;
}