1. I am trying to create a SkillUser through the soap api because dml operations are not allowed but keep getting the following error below.

  2. we plan on placing this code future call to send multiple records in a single call when a user is updated. The soap api call sounds like it would be the best design option since we can only send 1 record at a time through the rest api. if anyone has a better idea that would be great. thank you!

The prefix "soapenv" for element "soapenv:Header" is not bound.

Http h = new Http(); 
HttpRequest req2 = new HttpRequest();
String sfdcBaseURL = System.URL.getSalesforceBaseUrl().toExternalForm();
System.debug('Base URL: ' + sfdcBaseURL ); 
String url = sfdcBaseURL+'/services/Soap/u/33.0';
req2.setHeader('content-type', 'text/xml'); 
req2.setHeader('SOAPAction', '""');
String xml2= '<?xml version="1.0" encoding="utf-8"?>' +
 +'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com">' +
  '<urn:sessionId>'+ UserInfo.getSession() +'</urn:sessionId>'+
    '</soap:Header>' +
        '<urn:sObjects xsi:type="SkillUser">'+
           '<UserId>'+ '005j00000045gtyuj' + '</UserId>'+
           '<SkillId>' + '005j000000Crtrtrr' + '</SkillId>'+
HttpResponse res = h.send(req2);
String output = res.getBody();
System.debug('Body contains:' +output);    

2 Answers 2


The error:

The prefix "soapenv" for element "soapenv:Header" is not bound.

is most likely from your XML SOAP body.

The first line of your XML has


Notice how you have xmlns:soap namespace, but no xmlns:soapenv namespace.

So, you get the error when you try and reference the undefined soapenv namespace with '<soapenv:Header>'+...


Replacing soap:Envelope with soapenv:Envelopeshould do the trick.

  • I did that and now I am getting this error: Commented Jul 24, 2015 at 6:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .