public static String sendDhlRequest(String xmlString,Delegator delegator,String shipmentGatewayConfigId,String resource,Locale locale) throws DhlConnectException {
  String conStr=getShipmentGatewayConfigValue(delegator,shipmentGatewayConfigId,"connectUrl",resource,"shipment.dhl.connect.url");
  if (conStr == null) {
    throw new DhlConnectException(UtilProperties.getMessage(resourceError,"FacilityShipmentDhlConnectUrlIncomplete",locale));
  }
  if (xmlString == null) {
    throw new DhlConnectException(UtilProperties.getMessage(resourceError,"FacilityShipmentDhlXmlCannotBeNull",locale));
  }
  conStr=conStr.trim();
  String timeOutStr=getShipmentGatewayConfigValue(delegator,shipmentGatewayConfigId,"connectTimeout",resource,"shipment.dhl.connect.timeout","60");
  int timeout=60;
  try {
    timeout=Integer.parseInt(timeOutStr);
  }
 catch (  NumberFormatException e) {
    Debug.logError(e,"Unable to set timeout to " + timeOutStr + " using default "+ timeout);
  }
  if (Debug.verboseOn()) {
    Debug.logVerbose("DHL Connect URL : " + conStr,module);
    Debug.logVerbose("DHL XML String : " + xmlString,module);
  }
  HttpClient http=new HttpClient(conStr);
  http.setTimeout(timeout * 1000);
  String response=null;
  try {
    response=http.post(xmlString);
  }
 catch (  HttpClientException e) {
    Debug.logError(e,"Problem connecting with DHL server",module);
    throw new DhlConnectException(UtilProperties.getMessage(resourceError,"FacilityShipmentDhlConnectUrlProblem",UtilMisc.toMap("errorString",e),locale),e);
  }
  if (response == null) {
    throw new DhlConnectException(UtilProperties.getMessage(resourceError,"FacilityShipmentDhlReceivedNullResponse",locale));
  }
  if (Debug.verboseOn()) {
    Debug.logVerbose("DHL Response : " + response,module);
  }
  return response;
}

public static String sendDhlRequest ( String xmlString , Delegator delegator , String shipmentGatewayConfigId , String resource , Locale locale ) throws DhlConnectException { String conStr = getShipmentGatewayConfigValue ( delegator , shipmentGatewayConfigId , "connectUrl" , resource , "shipment.dhl.connect.url" ) ; if ( conStr == null ) { throw new DhlConnectException ( UtilProperties . getMessage ( resourceError , "FacilityShipmentDhlConnectUrlIncomplete" , locale ) ) ; } if ( xmlString == null ) { throw new DhlConnectException ( UtilProperties . getMessage ( resourceError , "FacilityShipmentDhlXmlCannotBeNull" , locale ) ) ; } conStr = conStr . trim ( ) ; String timeOutStr = getShipmentGatewayConfigValue ( delegator , shipmentGatewayConfigId , "connectTimeout" , resource , "shipment.dhl.connect.timeout" , "60" ) ; int timeout = 60 ; try { timeout = Integer . parseInt ( timeOutStr ) ; } catch ( NumberFormatException e ) { Debug . logError ( e , "Unable to set timeout to " + timeOutStr + " using default " + timeout ) ; } if ( Debug . verboseOn ( ) ) { Debug . logVerbose ( "DHL Connect URL : " + conStr , module ) ; Debug . logVerbose ( "DHL XML String : " + xmlString , module ) ; } HttpClient http = new HttpClient ( conStr ) ; http . setTimeout ( timeout * 1000 ) ; String response = null ; try { response = http . post ( xmlString ) ; } catch ( HttpClientException e ) { Debug . logError ( e , "Problem connecting with DHL server" , module ) ; throw new DhlConnectException ( UtilProperties . getMessage ( resourceError , "FacilityShipmentDhlConnectUrlProblem" , UtilMisc . toMap ( "errorString" , e ) , locale ) , e ) ; } if ( response == null ) { throw new DhlConnectException ( UtilProperties . getMessage ( resourceError , "FacilityShipmentDhlReceivedNullResponse" , locale ) ) ; } if ( Debug . verboseOn ( ) ) { Debug . logVerbose ( "DHL Response : " + response , module ) ; } return response ; }
opens a url to dhl and makes a request .
