}
// connect and post
HTTPConnection httpConnection = getHTTPConnection(url);
HTTPResponse httpResponse;
if (xmlRqst != null && xmlRqst.length() > MP_FORM_DATA_TRESHOLD)
{
// multipart form data (faster?)
NVPair[] ct_hdr = new NVPair[1];
byte[] data = Codecs.mpFormDataEncode(formData,null,ct_hdr);
httpResponse = httpConnection.Post(url.getFile(),data,ct_hdr);
}
else
{
// urlencoded (slow?)
httpResponse = httpConnection.Post(url.getFile(),formData);
}
if (httpResponse.getStatusCode() >= 200 && httpResponse.getStatusCode() < 300)
{
// ok
sessionData = httpResponse.getHeader("XMLDispatcher-SessionData");
return getResponseText(httpResponse);
}
else
{
// error
if (httpResponse.getStatusCode() == 510)
{
// xmldispatcher error
RplyEnvelopeError error = ErrorMarshallerXML.unmarshallError(getResponseText(httpResponse));
XMLDispatcherException exception = error.getException();
if (exception instanceof XMLDispatcherAppException)
{
throw (XMLDispatcherAppException)exception;
}
else if (exception instanceof XMLDispatcherUserException)
{
throw (XMLDispatcherUserException)exception;
}
else
{
throw (XMLDispatcherSystemException)exception;
}
}
else
{
// any other error
throw new XMLDispatcherCommException("HTTP error " +
httpResponse.getStatusCode() +
": " +
httpResponse.getReasonLine());
}
}
}
catch(ModuleException e)
{