• pidrus
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 8
    Replies

Hi,

 

I've been struggling with this for almost a week and can use some help from the community...

 

 

I'm making a call from SalesForce to a JSP on an external web-server (in our control) using the following code:

 

 

 

HttpRequest req = new HttpRequest(); //Set HTTPRequest params req.setMethod('POST'); req.setEndpoint('https://somehost/somefile.jsp'); // set the client certificate.

  String s_certificate = 'certificate goes here';

req.setClientCertificate(s_certificate,'password'); //Set the HTTPRequest body

String body = 'the body of the message'; req.setBody(body); Http http = new Http(); try { //Execute web service call here HTTPResponse res = http.send(req); //Helpful debug messages System.debug(res.toString()); System.debug('STATUS:'+res.getStatus()); System.debug('STATUS_CODE:'+res.getStatusCode()); } catch(System.CalloutException e) { System.debug('Got exception: ' + e); }

 

When I execute this code (either with or without @future), I get the following exception:

 

System.CalloutException: DER input, Integer tag error

 

I believe there is something wrong with either the certifate I'm using for req.setClientCertificate(), the certificate on the server, or the server configuration, but I'm sure what is going on exactly.

 

If somebody has experience making an Apex call over HTTPS, please reply with some overview on how it works, what the setup needs to be, what kind of certificates are needed, how the web-server needs to be configured (e.g. require client authentication?) and if there is anything wrong with the code.

 

This is becoming an urgent matter so please help!!

 

Thanks, 

 

IM.

 

 

 

  • January 22, 2010
  • Like
  • 0

I'm a newbie taking my very first steps, so please bear with me :)

 

Note: (I'm using the enterprise WSDL file)

 

We've created some custom fields for Leads, for example:

 

Field Label: Customer ID
Object Name: Lead
Field Name: Customer_ID
Data Type: Text
API Name: Customer_ID__c

 

 

I need to periodically update these values using the API (in Java).

 

How do I update custom fields?

 

I was looking for something like:

 

SObject[] leads = new Lead[1];
Lead lead = new Lead();
Lead oldLead = _leads[oldLeadId];
lead.setId(oldLead.getId());

// and here's where I got stuck since I was expecting something like

lead.setCustomField("Customer_ID__c",newValue);

// or something like:

lead.setCustomer_ID__c(newValue);

 


 

I spent the last couple of hours searching the documentation and the web and couldn't figure this out.

 

I'm sure it's so simple that I'll feel a little stupid once I get it... :)

 

Thanks for the help! 

Message Edited by pidrus on 06-26-2009 10:25 AM

Hi!

 

I have a Java application that logd in fine to the production account, but I'd like to have it connect to the sandbox account for testing purposes.

 

I have:

 

1. changed the username by appending the sandbox name at the end

2. made sure the password is correct

3. re-generated the security token and appended it at the end of the password

4. re-generated the WSDL file and replaced the production WSDL with the sandbox one

 

However, I'm still getting this error.

 

Searching this forum, I found:

 

http://community.salesforce.com/sforce/board/message?board.id=JAVA_development&message.id=4885&query.id=64302#M4885

 

But that didn't help either.

 

My gut feeling tells me the production WSDL was somehow cached.

 

So:

 

1. Does anyone know how to force re-cache or alternatively disable caching all together? (I found some PHP code for that but not for Java)?

 

2. Does anyone have another idea on how to approach this problem.

 

I'm a senior developer but a newbie to both Java and SalesForce, so please explain slowly using simple words... :)

 

Thank!

 

Ilan.

I am getting the following error when making a call to a webservice that we host through apex code:

sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

 

I have done some research and found that it has to do with certificates. Our certificate is signed by Verisign. I saw that your certificate has to be added to the keystore. Does it have to be added to the keystore if we are not using 2 way trust? Also, does my Apex code have to send the certificate to the webservice somehow or is that not necessary?

 

 

public class CallESB{
@Future(callout=true)
public static void getRasID(String SSN_nodashes, string id) {
rasmussenidentificationservice.ServiceHTTPBehaviour newSSn = new rasmussenidentificationservice.ServiceHTTPBehaviour();
string output = newSSn.GetRasIDBySSN(SSN_nodashes);
// String output back to the contact record
System.debug('RasID: '+output);
if (output!=null) {
Contact c=[select rasid__c,id FROM Contact where id=:id];
c.RasId__c=output;

try{
update c;
}

catch(Exception e){
System.debug('Error ' + e.getMessage() );
}
}

}
}

 

 

 

I'm a newbie taking my very first steps, so please bear with me :)

 

Note: (I'm using the enterprise WSDL file)

 

We've created some custom fields for Leads, for example:

 

Field Label: Customer ID
Object Name: Lead
Field Name: Customer_ID
Data Type: Text
API Name: Customer_ID__c

 

 

I need to periodically update these values using the API (in Java).

 

How do I update custom fields?

 

I was looking for something like:

 

SObject[] leads = new Lead[1];
Lead lead = new Lead();
Lead oldLead = _leads[oldLeadId];
lead.setId(oldLead.getId());

// and here's where I got stuck since I was expecting something like

lead.setCustomField("Customer_ID__c",newValue);

// or something like:

lead.setCustomer_ID__c(newValue);

 


 

I spent the last couple of hours searching the documentation and the web and couldn't figure this out.

 

I'm sure it's so simple that I'll feel a little stupid once I get it... :)

 

Thanks for the help! 

Message Edited by pidrus on 06-26-2009 10:25 AM

Hi!

 

I have a Java application that logd in fine to the production account, but I'd like to have it connect to the sandbox account for testing purposes.

 

I have:

 

1. changed the username by appending the sandbox name at the end

2. made sure the password is correct

3. re-generated the security token and appended it at the end of the password

4. re-generated the WSDL file and replaced the production WSDL with the sandbox one

 

However, I'm still getting this error.

 

Searching this forum, I found:

 

http://community.salesforce.com/sforce/board/message?board.id=JAVA_development&message.id=4885&query.id=64302#M4885

 

But that didn't help either.

 

My gut feeling tells me the production WSDL was somehow cached.

 

So:

 

1. Does anyone know how to force re-cache or alternatively disable caching all together? (I found some PHP code for that but not for Java)?

 

2. Does anyone have another idea on how to approach this problem.

 

I'm a senior developer but a newbie to both Java and SalesForce, so please explain slowly using simple words... :)

 

Thank!

 

Ilan.