2012-06-04 2 views
0

다음 작업을 수행하려고합니다.Salesforce 웹 서비스 호출

salesforce.com에서 httpRequest 시스템 클래스를 사용하여 http를 get 또는 post하고 json 객체를 게시합니다. 하지만 다음 예외 (https)가 표시됩니다.

java.security.cert.CertificateException: No name matching issue mywebsite.com found 

원격 호스트에이 웹 사이트를 이미 구성했습니다. 누구가 여기에서 틀릴 수 있던지 약간 아이디어가 있는가?

답변

1

req.setClientCertificateName에 대한 전화가 누락 되었습니까?

Salesforce에서 내 사이트의 웹 서비스를 호출하는 APEX 코드가 있습니다. 나는 클라이언트 측 SSL으로 그것을 보호했다. 내 웹 사이트 인 호스트는 Salesforce.com의 클라이언트 인증서 (브라우저 클라이언트가 서버 인증서를 승인하는 기존 웹 SSL과 비교)를 인증합니다. Salesforce의 인증서 및 키 관리에서 자체 서명 된 인증서를 만든 다음 req.setClientCertificateName을 호출하여 자체 서명 된 인증서를 참조 할 수 있습니다. 여기 내 생산 조직에서 일부 코드입니다 : 내가 생각 내 다른 대답에

<configuration> 
<system.webServer> 
<security> 
<access sslFlags="Ssl, SslNegotiateCert, SslRequireCert" /> 
<authentication> 
    <iisClientCertificateMappingAuthentication enabled="true" oneToOneCertificateMappingsEnabled="true"> 
     <oneToOneMappings> 
      <!-- production salesforce --> 
      <add enabled="true" 
       userName="salesforce" 
       password="[enc:AesProvider:aaa...aaa:enc]" 
       certificate="MIIEaaa...aaa=" /> 
     </oneToOneMappings> 
    </iisClientCertificateMappingAuthentication> 
</authentication> 
</security> 
</system.webServer> 
</configuration> 
0

:

HttpRequest req = new HttpRequest(); 
req.setMethod('POST'); 
req.setHeader('Host', 'www.mywebsite.com'); 
req.setEndpoint('https://www.mywebsite.com/post.asp'); 
try { 
    req.setClientCertificateName('Cert_For_MyWebSite'); 
} catch (System.CalloutException e) { 
    // The cert doesn't make it to the sandbox 
} 
req.setHeader('Connection', 'keep-alive'); 
req.setHeader('content-type', 'text/plain'); 
req.setHeader('Content-Length', body.length().format()); 
req.setBody(body); 
Http http = new Http(); 

HttpResponse res = http.send(req); 
System.debug(res.toString()); 
System.debug('STATUS:' + res.getStatus()); 
System.debug('STATUS_CODE:' + res.getStatusCode()); 

서버에 나는이 Web.config를 가진 자체 서명 인증서를 활성화 (7.5 IIS) 원래 두통을 짚어 본 기억이 있기 때문에 세일즈 포스 클라이언트 인증서에 대해,하지만 어쩌면 오류는 웹 서버의 인증서와 관련이 있습니다. 이것은 간단한 이름 일치 문제 일 수 있습니다. 예를 들어 Salesforce에 제공 한 인증서가 a.company.com으로 발행되었지만 b.company.com에서 사용하려고합니다. 그 결과는 herehere과 비슷한 자바 오류 메시지를 생성합니다. SSL을 통해 서비스를 시도 할 때 브라우저에서 오류를 발생합니까?

Salesforce에서 웹 서버의 인증서를 확인하지 못했다고 생각하면 over here for a similar javax.net.ssl.SSLPeerUnverifiedException error의 몇 가지 트릭을 시도해 볼 수 있습니다. Salesforce에서 신뢰할 수있는 CA 목록을 가리 킵니다.