aXAPI certificate upload not working

Hellom
I am trying to upload certificate using aXAPI REST Interface.I am using CXF util for Rest interaction.I have written following code.
final String  URL = "https://XXXXXXXXXXXX/services/rest/V2/?session_id=XXXXXXX&method=slb.ssl.upload&type=cert";
WebClient client = WebClient.create(URL);
client.type("multipart/form-data");
ContentDisposition cd = new ContentDisposition("attachment;filename=certfile");
List<Attachment> atts = new LinkedList<Attachment>();
InputStream stream = new FileInputStream("D:\\certfile");
Attachment att = new Attachment("root", stream, cd);
atts.add(att);
Response response = client.post(new MultipartBody(att));
It gives me 400 error.Anyone else here faced this problem?


If not then can you please paste your code(In whatever language) so that i can check what i am missing

NOTE : If i don't include attachment i am getting response from Server.But when i add some attachment it will give 400 error.

Comments

  • dshindshin Member
    edited November 2014
    Sorry for the delayed response. Based on the URL string that you have posted, I see a potential problem on the "type" string = "cert". Based on our aXAPI 2.0 guide, the required type for slb.ssl.upload should be "crl". Here's a sample string from the guide.

    session_id=xxxxxxxxxxxxxxxxxxxx&method=slb.ssl.upload&type=crl

    If this is still a problem after my recommended fix above, can you provide a complete xml/jason dump so we can debug the problem.

    Otherwise, if you fix the problem please post the fix for future vADC reference.

    Regards,

    Genard
  • dshindshin Member
    edited November 2014
    I am adding additional information to assist you with the ssl upload.

    as an example: upload certificate “ca2_1.crt.pem” to Thunder use CURL

    curl -F upload=@ca2_1.crt.pem -k https://$ip/services/rest/V2.0/?session_id=$session\&format=json\&method=slb.ssl.upload\&type=certificate

    I have attached additional shell script in this thread to fix your ssl upload problem. Change the certificate name match your environment.
    Run the script like this: ./ssl-upload.sh
    For example: ./ssl-upload.sh 10.100.2.70
Sign In or Register to comment.