• Thewalking face
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hello, 

I'm a beginner to apex, I want to create a web service to attach and parse an xml file. My file is hosted in an FTP server. The goal is to retrieve the XML file to insert the data into a salesforce object.
I try with the code below: 

webservice static String parse(String url) {
    
    DOM.Document doc = new DOM.Document();     
      try {    
        doc.load(url);       
        DOM.XMLNode root = doc.getRootElement();
        String message = 'File find';        
        return message;    
      } 
      // catch error
      catch (System.XMLException e) {      
        return e.getMessage();    
      }    
    } 

But it doesn't work with the url (C:\files\file.xml)

Can you help me please ?
Thank's in advance
Hello, 

I'm a beginner to apex, I want to create a web service to attach and parse an xml file. My file is hosted in an FTP server. The goal is to retrieve the XML file to insert the data into a salesforce object.
I try with the code below: 

webservice static String parse(String url) {
    
    DOM.Document doc = new DOM.Document();     
      try {    
        doc.load(url);       
        DOM.XMLNode root = doc.getRootElement();
        String message = 'File find';        
        return message;    
      } 
      // catch error
      catch (System.XMLException e) {      
        return e.getMessage();    
      }    
    } 

But it doesn't work with the url (C:\files\file.xml)

Can you help me please ?
Thank's in advance