You need to sign in to do that
Don't have an account?

XMLdom fails in sandbox
I have some apex-class code in a developers enviroment, works just fine!
I copy the code in a sandbox and de compilation fails on the line:
XMLDom responseXML = new XMLDom(res.getBody());
why?
public class SFService { //Future annotation to mark the method as async. // methods may call this class =callout=true @Future(callout=true) public static void SFservice(String id, String uid, String upw, Integer mskey ) { //construct an HTTP request HttpRequest req = new HttpRequest(); req.setEndpoint('http://www.url.com/cgi-bin/jsmdirect?SFservice'); req.setMethod('POST'); req.setHeader('Content-Type', 'text/xml; charset=utf-8'); // Create the soap message envelope String soapMsg = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://soapserver.jsm.marktselect.com">'+ '<soapenv:Header/>'+ '<soapenv:Body>'+ '<soap:NewAccount>'+ '<soap:UserId>'+uid+'</soap:UserId>'+ '<soap:UserPw>'+upw+'</soap:UserPw>'+ '<soap:Mskey>'+mskey+'</soap:Mskey>'+ '</soap:NewAccount>'+ '</soapenv:Body>'+ '</soapenv:Envelope>'; // set the soapbody to the message envelope req.setBody(soapMsg); //send the request Http http = new Http(); HttpResponse res = http.send(req); //check the response if (res.getStatusCode() == 200) { XMLDom responseXML = new XMLDom(res.getBody()); string rlcode = responseXML.getElementByTagName('relatiecode').nodeValue; //update account Account acc = new Account(Id=id); acc.AccountNumber = rlcode; acc.Description = res.getStatus() ; update acc; } else { System.debug('Callout failed: ' + res); Account acc = new Account(Id=id); acc.Description = res.getStatus() ; update acc; } } }
All Answers
Hi,
The error is: Invalid type: XMLDom
...where can i find the xmldom package ? do you have a link?