I'm trying to upload a document to a document library using the SP 2010 SOAP copy web service from Java.
Any idea how to do this in Java?
Here's the code I have so far:
String[] destinationUrls = {mySiteUrl + "/" + listName + "/" + fileName};
// Set up the metadata
FieldInformation titleInfo = new FieldInformation();
titleInfo.setDisplayName("Title");
titleInfo.setInternalName("Title");
titleInfo.setType(FieldType.TEXT);
titleInfo.setValue("DocumentTitle");
// Content type meta
FieldInformation contentTypeInfo = new FieldInformation();
contentTypeInfo.setDisplayName("Content Type");
contentTypeInfo.setInternalName("Content Type");
contentTypeInfo.setType(FieldType.CHOICE);
contentTypeInfo.setValue("Document");
FieldInformation[] metadata = { titleInfo, contentTypeInfo };
// Copy the new file to the portal document list
Long copyIntoResult;
CopyResult[] result;
client.copyIntoItems("http://null", destinationUrls, metadata, fileBytes, copyIntoResult, result);
But Eclipse reports that my use of copyIntoItems "in the type CopySoap is not applicable for the arguments". Obviously, my supplied arguments are incorrect.
The WSDL-generated signature for the copyIntoItems() method looks like:
copyIntoItems(String, DestinationUrlCollection, FieldInformationCollection, byte[], Holder<Long>, Holder<CopyResultCollection>);
But those Collection types and Holder only supply protected accessors, i.e. no way to set input state.
Can anyone help me solve this problem?