I have generated an Apex class from my WSDL successfully and was able to authenticate on the remote server by setting the HTTP Authorization header manually. I have double checked on the remote server that…
However, if I inspect the result of the webservice call, I always get a "null" object back. I suspect that Salesforce is not able to generate an Object from the XML response. Any ideas on why that could be and what i could try? Did someone already have the same problem?
This is how i do the call:
String user = 'username';
String pass = 'secret';
MyService.InfoSoap soapClient = new MyService.InfoSoap();
Blob raw = Blob.valueOf( user + ':' + pass );
String token = EncodingUtil.base64Encode( raw );
soapClient.inputHttpHeaders_x = new Map<String, String>{
'Authorization' => 'Basic ' + token
};
Integer externalId = 1234;
System.debug(
soapClient.getObject(externalId)
);
// prints "null" to the debug log
We managed to fix the problem today, by adding a namespace to every single XML element in the response.