EJBCA Web Service - Not connecting web service via PHP

Manmay
2013-10-01
2014-05-20
  • Manmay

    Manmay - 2013-10-01

    Hello,

    I am trying to connect to EJBCA via Web Service in PHP. But I am getting the below error.

    SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://scep.myejbca.com:8443/ejbca/ejbcaws/ejbcaws?wsdl' : failed to load external entity "https://scep.myejbca.com:8443/ejbca/ejbcaws/ejbcaws?wsdl"
    

    I am using the below PHP Code:

    $wsdl_url = "https://scep.myejbca.com:8443/ejbca/ejbcaws/ejbcaws?wsdl";
    $pass = 'mypassword';
    $certPath = "/myapp/certs/truststore.jks";
    $certBuffer = file_get_contents($certPath);
    
    $soap_args = array(
        'exceptions' => true,
        'cache_wsdl' => WSDL_CACHE_NONE,
        'trace' => 1,
        'local_cert' => $certPath,
        'passphrase' => $pass
        'location' => 'http://ws.protocol.core.ejbca.org'
    );
    
    try {
        $client = @new SoapClient($wsdl_url, $soap_args);
    } catch (SoapFault $e) {
        var_dump(libxml_get_last_error());
    }
    

    Please help me to connect to my EJBCA via Web Service in PHP.

    PS:
    1. The truststore and its password provided is valid.
    2. Used EJBCA is functional.
    3. Currently using ClientToolbox, which is functional using the above truststore.

    Thanks,

     
  • Tomas Gustavsson

    It looks like your code does not connect using client certificate authentication. So it can not make an SSL connection to https://scep.myejbca.com:8443/. It is not only the truststore, you also need the client keystore (superadmin.p12?)

    Cheers,
    Tomas

     
    • liwf

      liwf - 2014-05-20

      hi! Can you tell me how to use EJBCA at this stage the ws interface in Java code, I connected the problem now is not the past, should be the problem of keyStore and trustStore, I don't know what to do?There is my code:

      System.setProperty("javax.net.ssl.trustStore","D:\Documents\Downloads\tomcat.jks");
      System.setProperty("javax.net.ssl.trustStorePassword","111111");

            System.setProperty("javax.net.ssl.keyStore","D:\\Documents\\Downloads\\tomcat.jks");
            System.setProperty("javax.net.ssl.keyStorePassword","111111");
      
            QName qname = new QName("http://ws.protocol.core.ejbca.org/", "EjbcaWSService");
            EjbcaWSService service = null;
            try {
               service = new EjbcaWSService(new URL(urlstr),qname);
            } catch (MalformedURLException e1) {
               e1.printStackTrace();
            }
            EjbcaWS ws = service.getEjbcaWSPort();
      
       
  • Manmay

    Manmay - 2013-10-28

    Hi Tomas,
    First of all, my apologize for the delayed response.

    I am not sure how can I connect to the webservice using both the truststore and client certificates. Please help me to understand how can I achieve this using php.
    I would be grateful to you if you can please provide me some code snippet for the same.

    Thanks,
    Manmay

     
  • Tomas Gustavsson

    Hi,I know nothing about php,so someone else have to chip in. All I know is that other people have done it with php.

    cheers,
    Tomas

     
  • Manmay

    Manmay - 2013-10-29

    Thanks a lot Tomas for your quick response..
    I will work towards it.. when found, will update here too..

    Thanks,
    Manmay

     
  • Luis

    Luis - 2013-12-06

    You connect with cURL. I.E.


    $url = "https://localhost:8444/ejbca/ejbcaws/ejbcaws";
    $cert_file = 'C:/Users/user/Desktop/admin.pem';
    $ch = curl_init();
    $options = array(
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_SSL_VERIFYHOST => false,
    CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_USERAGENT => 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)',
    CURLOPT_URL => $url ,
    CURLOPT_SSLCERT => $cert_file
    );

    This is an example and not complete.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks