4

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…

  • the HTTP authentication works corrently
  • the webservice returns the correct response XML
  • no errors are thrown (no try/catch statements in the entire code)

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
2

One way to verify these silent failures is to try the parsing of WSDL in developer edition org and making the callout.Silent failures are captured in developer edition than trying out the same in sandbox environment

| improve this answer | |
  • Thanks for the suggestion! Good idea, but didn't actually yield different results. – Patrick Oscity May 16 '13 at 11:02
2

We managed to fix the problem today, by adding a namespace to every single XML element in the response.

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.