Skype4J
Skype4J copied to clipboard
Problem of transferring file via Skype
Hi guys, I have a problem while running the code:
public static void sendSkypeFile(String username, String password, String identity, File file){ Skype skype = new SkypeBuilder(username, password).withAllResources().build(); try { skype.login(); Chat chat = skype.loadChat(identity); chat.sendFile(file); System.out.println("File sent!"); skype.logout(); } catch (ConnectionException e) { e.printStackTrace(); } }
The error throws:
com.samczsun.skype4j.exceptions.ConnectionException: While uploading data (400 Bad Request) at com.samczsun.skype4j.internal.ExceptionHandler.generateException(ExceptionHandler.java:50) at com.samczsun.skype4j.internal.Endpoints$EndpointConnection.connect(Endpoints.java:372) at com.samczsun.skype4j.internal.Endpoints$EndpointConnection.connect(Endpoints.java:302) at com.samczsun.skype4j.internal.Endpoints$EndpointConnection.post(Endpoints.java:286) at com.samczsun.skype4j.internal.Utils.upload(Utils.java:69) at com.samczsun.skype4j.internal.chat.ChatImpl.sendFile(ChatImpl.java:145)
Please show me why and how to resolve it. I will appreciate all your helps! Thanks
Try having a look over this https://github.com/OllieTerrance/SkPy/issues/82 Looks like you need to add an additional header to the request
Hi, I am facing the same issue. Sending messages works, but not files. I am getting the same error as @tanhopham1990