1

I am trying to do http callout with soap 1.2 request but facing following error..?

Error - System.UnexpectedException: java.lang.IllegalArgumentException: invalid start or end.

request:-

HttpRequest req = new HttpRequest();
req.setMethod('POST');
req.setHeader('Accept-Encoding','gzip,deflate');
req.setHeader('Content-Type','text/xml;charset=UTF-8;action=\"MRBDirectUploads_v1_Binder_ping\"');
req.setHeader('User-Agent','xxx');
req.setHeader('Host', 'bfs-webservices-test.macquarie.com.au');
req.setHeader('Content-Length','xxx');
req.setEndpoint('https://bfs-webservices-test.macquarie.com.au/bfs/b2b/ws/MRBDirectUploads:v1/MRBDirectUploads_v1_Port');

req.setBody(header);          
HTTPResponse res =new HttpResponse();
Http http = new Http();
system.debug('request' +res+'#Header' );
res = http.send(req);
  • As per your above code, you have already set all the header using setHeader method, so there is no need to add "header" as a parameter in setBody() untill you are passing anything else you didn't shown above. Also after removing "header", if above request not work than you may skip adding your endpiont url domain to remote site settings. – Ritesh Gupta Sep 3 '15 at 7:58
  • Is the error you list coming from the remote system or being generated locally? Your header variable will have to contain very precise XML (that is normally generated by tooling because it is hard to achieve through manual coding) that is compliant with the SOAP 1.2 specs. – Keith C Sep 3 '15 at 8:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.