BBireddy192192 (Community Member) asked a question.

Why uploadFile.do service giving error, please help me how to call uplodFile.do service.

I have used ​uploadfile.do service. But when passing file as argument getting 500 error.

Please see below URL which is calling.

please help me.

 

Exception in thread "main" java.lang.RuntimeException: Exception while calling URL:https://analysiscenter.veracode.com/api/5.0/uploadfile.do?app_id=[app_id value]&&file=@[file path value]&&sandbox_id=[sanbox_id value]

at com.veracode.WebApiCall3.callURL(WebApiCall3.java:138)

at com.veracode.WebApiCall3.uploadFile(WebApiCall3.java:57)

at com.veracode.WebApiCall3.main(WebApiCall3.java:24)

Caused by: java.io.IOException: Server returned HTTP response code: 500 for URL: https://analysiscenter.veracode.com/api/5.0/uploadfile.do?app_id=188973&&file=@C:/Bharath/Test.jar&&sandbox_id=562188

at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)

at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)

at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)

at com.veracode.WebApiCall3.callURL(WebApiCall3.java:123)

... 2 more

 


  • Hello

     

    The '@filename' part in our documentation is specific to cURL - this causes data to be sent with application/x-www-form-urlencoded content type.

     

    As you are using Java, I would recommend you look into our wrapper, which can be used as a library or a standalone application from the command line. The wrapper takes care of correctly uploading files, amongst other things. You can find more detail here: https://help.veracode.com/r/c_about_wrappers

     

    If you prefer your own implementation, you would need to encode the data in a similar manner to cURL. I would suggest invoking the API from cURL with verbose mode (-v) and seeing how it's handled there. You can then implement it in a similar manner.

     

    Alaur

    Expand Post

Topics (1)

No articles found
Loading

Ask the Community

Get answers, share a use case, discuss your favorite features, or get input from the community.