title: Gettting 400 Bad Request while uploading file to SharePoint 2010 using Copy.CopyIntoItems web service
body: <p>New to SharePoint.</p>
  
  <p>I'm trying to upload a document to SharePoint using it's CopyIntoItems web service method with Java but keep on getting 400 Bad Request.  I've use the Java's wsimport to generate the class files from the .wsdl file.  Here is my Java code with the generated classes.</p>
  
  <pre><code>public static void createDocument(CopySoap port) {
      String url = SoapPortProvider.spSiteUrl + "/Shared Documents/Temp Folder/test.txt";
      String sourceUrl = "http://null";
  
      byte[] content = IoUtil.getBytes(new File("C:/CopyFile/READ-ME.txt"));
  
      FieldInformation descInfo = new FieldInformation ();
      descInfo.setDisplayName("Test Doc");
      descInfo.setType(FieldType.TEXT);
      descInfo.setValue("Test uploaded file");        
  
  
      DestinationUrlCollection urls = new DestinationUrlCollection();
      urls.getString().add(url);
  
      FieldInformationCollection infos = new FieldInformationCollection ();
      infos.getFieldInformation().add(descInfo);  
  
      CopyResultCollection results = new CopyResultCollection ();
      Holder&lt;CopyResultCollection&gt; resultHolder = new Holder&lt;CopyResultCollection&gt;(results);
  
      Holder&lt;Long&gt; longHolder = new Holder&lt;Long&gt;(new Long(-1));
  
      port.copyIntoItems(sourceUrl, urls, infos, content, longHolder, resultHolder);
  
  }
  </code></pre>
  
  <p>My SOAP Request looks like </p>
  
  <pre><code>&lt;?xml version="1.0" ?&gt;
  &lt;S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"&gt;
     &lt;S:Body&gt;
        &lt;CopyIntoItems xmlns="http://schemas.microsoft.com/sharepoint/soap/"&gt;    
           &lt;SourceUrl&gt;http://null&lt;/SourceUrl&gt;
           &lt;DestinationUrls&gt;
              &lt;string&gt;https://www.mysite.com/sites/TestSite/Shared Documents/Temp Folder/test.txt&lt;/string&gt;
           &lt;/DestinationUrls&gt;
           &lt;Fields&gt;
              &lt;FieldInformation Value="Test uploaded file" DisplayName="Test Doc" Type="Text"/&gt;
           &lt;/Fields&gt;
           &lt;Stream&gt;KioqTWFrZSBzdXJlIHRoZSBjb250ZW50IGlzIHVuZGVyIEM6L0NvcHlGaWxlLy4gICoqKg0KDQpUbyBydW46DQoNCjEuICBFZGl0IHRoZSBkZXBsb3kucHJvcHMgZmlsZS4gIFNwZWNpZnkgdGhlIHNvdXJjZSAoZm9sZGVyIHRoYXQgY29udGFpbiBpdGVtcyB0byBkZXBsb3kpLCBkZXN0aW5hdGlvbiAoZm9sZGVyIHRvIGRlcGxveSB0byksIGFuZCBmaWxlcyAodGhlIGl0ZW1zIHRvIGRlcGxveSkuDQoyLiAgRG91YmxlIGNsaWNrIG9uIGRlcGxveUN1c3RvbWl6YXRpb24uYmF0DQoNCk5vdGUgdGhhdCBhIGxvZyBvZiB0aGUgcHJvZ3Jlc3Mgd2lsbCBiZSBjcmVhdGVkIGluIEM6L0NvcHlGaWxlL2NvcHlGaWxlLmxvZyANCg0KTm90ZSB0aGF0LCBmb3IgcHJlY2F1dGlvbiwgZXhpc3RpbmcgZmlsZSB3aWxsIG5vdCBiZSBvdmVyd3JpdHRlbiwgaW5zdGVhZCB3aWxsIGJlIHNhdmVkIGFzIHlvdXJfY29kZV9maWxlLm9sZA==&lt;/Stream&gt;
        &lt;/CopyIntoItems&gt;
      &lt;/S:Body&gt;
  &lt;/S:Envelope&gt;
  </code></pre>
  
  <p>And the response I get is </p>
  
  <pre><code>null: HTTP/1.1 400 Bad Request
  Content-length: 0
  X-powered-by: ASP.NET
  Server: Microsoft-IIS/7.5
  Date: Tue, 14 Feb 2012 16:29:51 GMT
  Microsoftsharepointteamservices: 14.0.0.5138
  </code></pre>
  
  <p>which doesn't tell me much.  What could be missing?</p>