Sharepoint Webservice Returns nothing in the Xnlnode
Windows Server Forum Index Windows Server
Server discussion on Windows platform.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web winserverhelp.com
Sharepoint Webservice Returns nothing in the Xnlnode

 
Post new topic   Reply to topic    Windows Server Forum Index -> Windows Services
Author Message
Thomaszv
Guest





Posted: Tue Jan 11, 2005 7:29 am    Post subject: Sharepoint Webservice Returns nothing in the Xnlnode Reply with quote

While trying to use Sharepoint webservices to access sharepoint lists, I get
an exception error: "Exception of type
Microsoft.SharePoint.SoapServer.SoapServerException was thrown." and the
Xmlnode is returned empty. The GetListCollection and the UpdateListItems
calls throw an exception. The GetList call works correctly. However, even
though the UpdateListItems throws an exception, the item is properly added to
the sharepoint list. I checked the credentials. Is there some way to debug
the webservice call?

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Me.Cursor = System.Windows.Forms.Cursors.WaitCursor
Me.TextBox5.Clear()

Dim sURL As String = Me.TextBox1.Text
Dim sList As String = Me.TextBox2.Text
Dim sTitle As String = Me.TextBox3.Text
Dim sDate As String = Me.TextBox4.Text
Dim sDisplay As String = Me.TextBox5.Text
Dim sBatch As String = ""
Dim nodeList As System.Xml.XmlNode

Dim oListWS As New WebServiceTest.Lists

Me.TextBox5.Text = ""
Me.TextBox6.Text = ""
oListWS.Credentials = System.Net.CredentialCache.DefaultCredentials
oListWS.Url = Me.TextBox1.Text & "/_vti_bin/lists.asmx"

Try
nodeList = oListWS.GetList(sList)

Me.TextBox5.Text += nodeList.OuterXml

Catch ex As Exception
Me.TextBox5.Text += vbCrLf + "Exception: " + vbCrLf + ex.Message
End Try


sBatch = "<Method ID=""1"" Cmd=""New"">"
sBatch += "<Field Name=""ID"">New</Field>"
sBatch += "<Field Name=""Title"">" + sTitle + "</Field>"
sBatch += "</Method>"

Dim xDoc As New System.Xml.XmlDocument
Dim xBatch As System.Xml.XmlElement = xDoc.CreateElement("Batch")

xBatch.SetAttribute("OnError", "Return")
xBatch.InnerXml = sBatch

Me.TextBox6.Text += "Submitting batch: " + vbCrLf + xBatch.OuterXml

Dim xReturn As System.Xml.XmlNode
Try
xReturn = oListWS.UpdateListItems(sList, xBatch)
Me.TextBox6.Text += vbCrLf + "Return: " + vbCrLf +
xReturn.OuterXml
Catch ex As Exception
Me.TextBox6.Text += vbCrLf + "Exception: " + vbCrLf + ex.Message
End Try

Dim RetList As System.Xml.XmlNode
Try
RetList = oListWS.GetListCollection
Me.TextBox6.Text += vbCrLf + "Return: " + vbCrLf +
RetList.OuterXml
Catch ex As Exception
Me.TextBox6.Text += vbCrLf + "Exception: " + vbCrLf + ex.Message
End Try

Me.Cursor = System.Windows.Forms.Cursors.Default

End Sub
Back to top
Mike Walsh
Guest





Posted: Tue Jan 11, 2005 11:29 am    Post subject: Re: Sharepoint Webservice Returns nothing in the Xnlnode Reply with quote

Please post this kind of programming question to the new subnewsgroup for
such questions

microsoft.public.sharepoint.windowsservices.development

where you'll find concentrated programming questions and assembled expertise
in this area.

If you are using the web, reply to this message and I'll hunt out the web
address for you. (The page is hard to find) In OE do Refresh List.


Mike Walsh, Helsinki, Finland
WSS FAQ at http://wss.collutions.com
Please post questions to the newsgroup only.

"Thomaszv" <Thomaszv@discussions.microsoft.com> wrote in message
news:DFC131FC-12A1-41A7-94EB-30ADE9221191@microsoft.com...
Quote:
While trying to use Sharepoint webservices to access sharepoint lists, I
get
an exception error: "Exception of type
Microsoft.SharePoint.SoapServer.SoapServerException was thrown." and the
Xmlnode is returned empty. The GetListCollection and the UpdateListItems
calls throw an exception. The GetList call works correctly. However,
even
though the UpdateListItems throws an exception, the item is properly added
to
the sharepoint list. I checked the credentials. Is there some way to
debug
the webservice call?

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Me.Cursor = System.Windows.Forms.Cursors.WaitCursor
Me.TextBox5.Clear()

Dim sURL As String = Me.TextBox1.Text
Dim sList As String = Me.TextBox2.Text
Dim sTitle As String = Me.TextBox3.Text
Dim sDate As String = Me.TextBox4.Text
Dim sDisplay As String = Me.TextBox5.Text
Dim sBatch As String = ""
Dim nodeList As System.Xml.XmlNode

Dim oListWS As New WebServiceTest.Lists

Me.TextBox5.Text = ""
Me.TextBox6.Text = ""
oListWS.Credentials =
System.Net.CredentialCache.DefaultCredentials
oListWS.Url = Me.TextBox1.Text & "/_vti_bin/lists.asmx"

Try
nodeList = oListWS.GetList(sList)

Me.TextBox5.Text += nodeList.OuterXml

Catch ex As Exception
Me.TextBox5.Text += vbCrLf + "Exception: " + vbCrLf +
ex.Message
End Try


sBatch = "<Method ID=""1"" Cmd=""New"">"
sBatch += "<Field Name=""ID"">New</Field>"
sBatch += "<Field Name=""Title"">" + sTitle + "</Field>"
sBatch += "</Method>"

Dim xDoc As New System.Xml.XmlDocument
Dim xBatch As System.Xml.XmlElement = xDoc.CreateElement("Batch")

xBatch.SetAttribute("OnError", "Return")
xBatch.InnerXml = sBatch

Me.TextBox6.Text += "Submitting batch: " + vbCrLf +
xBatch.OuterXml

Dim xReturn As System.Xml.XmlNode
Try
xReturn = oListWS.UpdateListItems(sList, xBatch)
Me.TextBox6.Text += vbCrLf + "Return: " + vbCrLf +
xReturn.OuterXml
Catch ex As Exception
Me.TextBox6.Text += vbCrLf + "Exception: " + vbCrLf +
ex.Message
End Try

Dim RetList As System.Xml.XmlNode
Try
RetList = oListWS.GetListCollection
Me.TextBox6.Text += vbCrLf + "Return: " + vbCrLf +
RetList.OuterXml
Catch ex As Exception
Me.TextBox6.Text += vbCrLf + "Exception: " + vbCrLf +
ex.Message
End Try

Me.Cursor = System.Windows.Forms.Cursors.Default

End Sub
Back to top
 
Post new topic   Reply to topic    Windows Server Forum Index -> Windows Services All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




New Topics Powered by phpBB