Subversion Repositories SmartDukaan

Rev

Rev 4710 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4710 Rev 20722
Line 16... Line 16...
16
import org.w3c.dom.Element;
16
import org.w3c.dom.Element;
17
import org.w3c.dom.NodeList;
17
import org.w3c.dom.NodeList;
18
import org.xml.sax.InputSource;
18
import org.xml.sax.InputSource;
19
 
19
 
20
public class AramexTrackingService {
20
public class AramexTrackingService {
21
    //public static String ARAMAX_URL = "http://www.aramex.com/track_xml.asp?ShipmentNumber=";
21
    //public static String ARAMAX_URL = "https://www.aramex.com/track_xml.asp?ShipmentNumber=";
22
    private static Logger log = Logger.getLogger(Class.class);
22
    private static Logger log = Logger.getLogger(Class.class);
23
    
23
    
24
    private static String ARAMEX_URL;
24
    private static String ARAMEX_URL;
25
 
25
 
26
    static{
26
    static{
27
        try {
27
        try {
28
            ARAMEX_URL = ConfigClient.getClient().get("aramex_update_url");
28
            ARAMEX_URL = ConfigClient.getClient().get("aramex_update_url");
29
        } catch (ConfigException e) {
29
        } catch (ConfigException e) {
30
            //ARAMEX_URL = "file:///home/ashish/Downloads/AWB_Track.xml";
-
 
31
            log.error("Unable to get the tracking url from the config service", e);
30
            log.error("Unable to get the tracking url from the config service", e);
32
        }
31
        }
33
    }
32
    }
34
    
33
    
35
    public List<ShipmentUpdate> getUpdates(String awbNumber){
34
    public List<ShipmentUpdate> getUpdates(String awbNumber){
Line 68... Line 67...
68
    private String getElementTextContent(Element element, String tagName){
67
    private String getElementTextContent(Element element, String tagName){
69
        return element.getElementsByTagName(tagName).item(0).getTextContent();
68
        return element.getElementsByTagName(tagName).item(0).getTextContent();
70
    }
69
    }
71
    
70
    
72
    public static void main(String[] args){
71
    public static void main(String[] args){
73
        System.out.println("Aramax number is " + "6199186044");
72
        System.out.println("Aramax number is " + "42227972964");
74
        AramexTrackingService service = new AramexTrackingService();
73
        AramexTrackingService service = new AramexTrackingService();
75
        List<ShipmentUpdate> updates = service.getUpdates("6199186044");
74
        List<ShipmentUpdate> updates = service.getUpdates("42227972964");
76
        for(ShipmentUpdate update: updates){
75
        for(ShipmentUpdate update: updates){
77
            System.out.println(update.toString());
76
            System.out.println(update.toString());
78
        }
77
        }
79
    }
78
    }
80
}
79
}