Wired error using Sharepoint web service for uploading files

even though the WSDL says most element are optional. however, it does throw out various WIRED exceptions, if any of the attribute not provided.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.microsoft.com/sharepoint/soap/">
   <soapenv:Header/>
   <soapenv:Body>
      <soap:CopyIntoItems>
         <!--Optional:-->
         <soap:SourceUrl>?</soap:SourceUrl>
         <!--Optional:-->
         <soap:DestinationUrls>
            <!--Zero or more repetitions:-->
            <soap:string>?</soap:string>
         </soap:DestinationUrls>
         <!--Optional:-->
         <soap:Fields>
            <!--Zero or more repetitions:-->
            <soap:FieldInformation Type="?" DisplayName="?" InternalName="?" Id="?" Value="?"/>
         </soap:Fields>
         <!--Optional:-->
         <soap:Stream>cid:266527284695</soap:Stream>
      </soap:CopyIntoItems>
   </soapenv:Body>
</soapenv:Envelope>

1. if Fields –> FieldInformation not provided, ErrorCode=”Unknown” ErrorMessage=”Object reference not set to an instance of an object.”
2. if stream not provided, ErrorCode=”Unknown” ErrorMessage=”Value does not fall within the expected range.”
3. if stream uing cid: xxx, HTTP 400 bad request
4. if sourceUrl not provided, ErrorCode=”Unknown” ErrorMessage=”Value does not fall within the expected range.”
5. if destinationUrls not provided, Exception of type ‘Microsoft.SharePoint.SoapServer.SoapServerException’ was thrown. Object reference not set to an instance of an object

all above exceptions could be due to Sharepoint server configuration, as WSDL does say the element could be optional.

the right request works:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.microsoft.com/sharepoint/soap/">
   <soapenv:Header/>
   <soapenv:Body>
      <soap:CopyIntoItems>
         <!--Optional:-->
                  <!--Optional:-->
                  <soap:SourceUrl>test90.txt</soap:SourceUrl>
         <soap:DestinationUrls>
            <!--Zero or more repetitions:-->
            <soap:string>https://xxx/2014/1/28/16/26979799/test90.txt</soap:string>
         </soap:DestinationUrls>

         <!--Optional:-->
         <soap:Fields>
            <!--Zero or more repetitions:-->
            <soap:FieldInformation Type="Text" DisplayName="test40.txt" InternalName="test40.txt" Id="12345678-1234-1234-1234-123456789012" Value="test40.txt"/>
         </soap:Fields>

         <!--Optional:-->
         <soap:Stream>1234546</soap:Stream>

      </soap:CopyIntoItems>
   </soapenv:Body>
</soapenv:Envelope>

And it works fine with Fiddler, Java Client; Fiddler, SoapUI. And it turns out nothing specific configuration needed for Fiddler.

Advertisements

Author: lwpro2

Java J2EE professional

2 thoughts on “Wired error using Sharepoint web service for uploading files”

  1. Hi
    I’m facing the above mentioned issues when I try to upload documents into SharePoint from soapui using the CopyIntoItems operation in Copy WSDL . Like you mentioned when I pass the FieldInfo and Stream in the request the document is getting uploaded to the SharePoint. Can you please tell me what configuration changes and how it needs to be done to handle this ? Considering these fields are optional as per the WSDL.

    Like

    1. Hi Calvin,

      I didn’t change the SP server configuration, instead from client side, changed the SOAP messaged passed in. In majority of the cases, developer doesn’t have the access to update those configuration either, and I suggest you need to check with the SP admin team if there is.

      Jackie

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s