views:

17

answers:

0
public Connection(String serviceName){


  try{  
   _connection=(HttpConnection)Connector.open(WebServiceLocator._webServiceLocation+serviceName);
   DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory. newInstance(); 
   DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
   docBuilder.isValidating();
   _doc = docBuilder.parse(_connection.openInputStream());
   _doc.getDocumentElement ().normalize ();
  }
  catch(Exception e){

  }

 }// end of constructor


 public int[] getProdId(){
  NodeList list = _doc.getElementsByTagName("AGT_DIM_ID");
     _agntID = new int[list.getLength()];
     for (int i=0;i<list.getLength();i++){
         Node value=list.item(i).getChildNodes().item(0);
         _element=value.getNodeValue().trim();
         _agntID[i] = Integer.parseInt(_element);
     }
     return _agntID;
    }


 public String[] getProdName(){

  String agntName[];
  NodeList list1 = _doc.getElementsByTagName("AGT_FULL_NM");
  agntName = new String[list1.getLength()];
  for (int i=0;i<list1.getLength();i++){
   Node value=list1.item(i).getChildNodes().item(0);
   _element=value.getNodeValue().trim();
   agntName[i] = _element;

  }
  return agntName;

}