RE: Problems with upload Web Service
From: david (david_at_discussions.microsoft.com)
Date: 02/17/05
- Next message: Robert: "Attach event handler to a custom list"
- Previous message: Wei-Dong XU [MSFT]: "Re: question on "get document" method in FrontPage RPC"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 17 Feb 2005 02:33:01 -0800
Fixed.
it's a great article but with an terrible bug on the code example (terrible
because i've spent three hours debugging my own code to discover this
problem); on the spfileswsdl.aspx, the xml for uploadDocument webmethod is:
<s:element name="UploadDocument">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="strFilename"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="fileContents"
type="s:base64Binary" />
<s:element minOccurs="0" maxOccurs="1" name="pathFolder"
type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
notice the property name of the first and the third elements; strFilename
and pathFolder.
and the webmethod method header is:
[WebMethod]
public string UploadDocument(string fileName, byte[] fileContents, string
targetFolder)
notice that here, the first parameter is fileName (instead of strFilename)
and targetFolder (instead of pathFolder)
so, as the name of the method params are not equal, the first and the third
params are received as null params, and the second is received Ok. If you
rename the webmethod params as the spfileswsdl.aspx params and refresh the
webmethod, the params are received ok
"Clive Godden" wrote:
> Hi
>
> Ime a real newbie to sharepoint.
> I have created a WorkSpace programatically and that worked fine, the address
> to the docs via the web client is http://cfit/ppl/shared documents where ppl
> is the workspace.
> I have downloaded and compiled the web service from the
> ODC_WritingCustomWebServicesSPPTSample.zip file.
> I use the code below to upload the document
>
> Dim upload As New SharepointFiles.SPFiles
> upload.Credentials = System.Net.CredentialCache.DefaultCredentials
> dim filename As String = "c:\200411911736.xls"
> Dim strDestination As String = http://cfit/ppl/shared documents (have tried
> all sorts of things here)
> Dim fStream As New FileStream(filename, System.IO.FileMode.Open)
> Dim binFile(CInt(fStream.Length)) As Byte
> fStream.Read(binFile, 0, CInt(fStream.Length))
> fStream.Close()
> Dim str As String
> str = upload.UploadDocument(filename, binFile, strDestination)
> MessageBox.Show(str)
>
> All I get is an error box that says "value cannot be
> null.microsoft.sharepoint"
> Can anyone help and point out what i am doing wrong
> I am trying to do this from Windows.Forms with vb.net
>
> Ta
>
> Clive
>
>
>
- Next message: Robert: "Attach event handler to a custom list"
- Previous message: Wei-Dong XU [MSFT]: "Re: question on "get document" method in FrontPage RPC"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|