Hi guys, I'm testing the YouTube API with a simple video upload but I
keep on getting this exception:

Exception in thread "main"
com.google.gdata.util.InvalidEntryException: Bad Request
The request's content type is not multipart. Content type: application/
atom+xml;charset=UTF-8
at
com.google.gdata.client.http.HttpGDataRequest.hand leErrorResponse(HttpGDataRequest.java:
558)
at
com.google.gdata.client.http.GoogleGDataRequest.ha ndleErrorResponse(GoogleGDataRequest.java:
563)
at
com.google.gdata.client.http.HttpGDataRequest.chec kResponse(HttpGDataRequest.java:
536)
at
com.google.gdata.client.http.HttpGDataRequest.exec ute(HttpGDataRequest.java:
515)
at
com.google.gdata.client.http.GoogleGDataRequest.ex ecute(GoogleGDataRequest.java:
535)
at com.google.gdata.client.Service.insert(Service.jav a:1347)
at com.google.gdata.client.GoogleService.insert(Googl eService.java:
599)
at sample.blogger.VideoTest.main(VideoTest.java:29)

I have a feeling it's with the type of video I'm uploading but I don't
know how to work around it. Here's my code, it's very simple:


package sample.blogger;

import com.google.gdata.client.*;
import com.google.gdata.data.media.MediaFileSource;
import com.google.gdata.data.media.mediarss.*;
import com.google.gdata.data.youtube.*;
import java.io.*;
import java.net.*;

public class VideoTest {

public static void main( String[] args ) throws Exception {
GoogleService gs = new GoogleService( "youtube", "BloggingApp" );
gs.setUserCredentials( "[email protected]", "qwertyui" );


VideoEntry newEntry = new VideoEntry();
YouTubeMediaGroup info = newEntry.getOrCreateMediaGroup();
info.setTitle( new MediaTitle() );
info.getTitle().setPlainTextContent( "Test Video for CS197c" );
info.setDescription( new MediaDescription() );
info.getDescription().setPlainTextContent( "Sample description here" );
info.setPrivate( false );

MediaFileSource src = new MediaFileSource( new File("testvid.wmv"), "video/x-ms-wmv" );
String uploadUrl =
"http://uploads.gdata.youtube.com/feeds/api/users/default/uploads";

VideoEntry createdEntry = gs.insert(new URL(uploadUrl), newEntry);
System.out.println( "done" );
}

}