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

Error with POST request
Hi,
Iam trying to implement webservices where i need to post the data from salesforce to external syatem and i wrote an apex class with POST request and i get the below error
The message with To '' cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver's EndpointAddresses agree".
What does the error mean??
Thanks. Any help is appreciated.
Iam trying to implement webservices where i need to post the data from salesforce to external syatem and i wrote an apex class with POST request and i get the below error
The message with To '' cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver's EndpointAddresses agree".
What does the error mean??
Thanks. Any help is appreciated.
You just need to verify that your endpoint is correct. For some reason, the code is not being able to find the valid endpoint hence, it is not being able to POST the information.
I suggest, if you like to see if your POST message is working or not, you could POST information into a test endpoint just to check and then finally put your required endpoint to make the magic happen.
Test endpoint URL: http://requestb.in/
Create a Request Bin Here and grab that url and put it as your endpoint and add it to your remote site settings and run your POST request. Then go back to this URL and see if it posted the information that you sent or not.
Hope that helped!
Thanks
@Future(callout=true)
global static void sendCommunication(Integer ChildNumber, String CommType, Integer ClientID) {
HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
Http http = new Http();
req.setEndpoint('https://xxx.xx');
req.setMethod('POST');
String username = test';
String password = 'test';
Blob headerValue = Blob.valueOf(username + '' + password);
String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue);
req.setHeader('Authorization', authorizationHeader);
req.setTimeout(100000);
req.setHeader('Content-Type', 'application/soap+xml; charset=utf-8');
req.setCompressed(false);
String reqBody = '<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:tem="http://tempuri.org/" xmlns:plan="http://schemas.datacontract.org/2004/07/">'
+'<soap:Header/>'+
'<soap:Body>'+
'<tem:AddCommunicationItem>'+
'<tem:lstCommunicationItems>'+
'<plan:CommunicationItem>'+
'<plan:CommunicationType>CommType</plan:CommunicationType>'+
'<plan:Description>Testing123</plan:Description>'+
'<plan:SCNumber>ChildNumber</plan:SCNumber>'+
'<plan:SPNumber>ClientID</plan:SPNumber>'+
'</plan:CommunicationItem>'+
'</tem:lstCommunicationItems>'+
'</tem:AddCommunicationItem>'+
'</soap:Body>'+
'</soap:Envelope>';
req.setBody(reqBody);
try {
res = http.send(req);
} catch(System.CalloutException e) {
System.debug('Callout error: '+ e);
}
System.debug(res.getBody());
}
Thanks
Could you try 2 things;
1. comment out the code;
req.setCompressed(false);
2. If that does not work then try changing BASIC to Basic: String authorizationHeader = 'Basic ' + EncodingUtil.base64Encode(headerValue);
Let me know where you stand?
Thanks