I have now spent the time looking into this and have got it working!
For anyone else that may be following being, here is how to use the rest api from within vb.net.
I am going to assume that you have the restsharp library, make sure to get the right version - see the openkm dev docs for details on this. If you are using the sdk4csharp library successfully then you will already have the right restsharp library.
Anyway, you will need an client interface for the restsharp library in vb.net. A really simple one looks like this:
Code: Select allImports System.IO
Imports System.Net
Imports System.Text
Public Enum HttpVerb
[GET]
POST
PUT
DELETE
End Enum
Public Class RestClient
Public Property EndPoint() As String
Get
Return m_EndPoint
End Get
Set
m_EndPoint = Value
End Set
End Property
Private m_EndPoint As String
Public Property Method() As HttpVerb
Get
Return m_Method
End Get
Set
m_Method = Value
End Set
End Property
Private m_Method As HttpVerb
Public Property ContentType() As String
Get
Return m_ContentType
End Get
Set
m_ContentType = Value
End Set
End Property
Private m_ContentType As String
Public Property PostData() As String
Get
Return m_PostData
End Get
Set
m_PostData = Value
End Set
End Property
Private m_PostData As String
Public Property Accept() As String
Get
Return m_Accept
End Get
Set
m_Accept = Value
End Set
End Property
Private m_Accept As String
Public Sub New()
EndPoint = ""
Method = HttpVerb.[GET]
ContentType = "text/xml"
PostData = ""
Accept = ""
End Sub
Public Sub New(endpoint__1 As String)
EndPoint = endpoint__1
Method = HttpVerb.[GET]
ContentType = "text/xml"
PostData = ""
Accept = ""
End Sub
Public Sub New(endpoint__1 As String, method__2 As HttpVerb)
EndPoint = endpoint__1
Method = method__2
ContentType = "text/xml"
PostData = ""
Accept = ""
End Sub
Public Sub New(endpoint__1 As String, method__2 As HttpVerb, contenttype__3 As String)
EndPoint = endpoint__1
Method = method__2
ContentType = contenttype__3
PostData = ""
Accept = ""
End Sub
Public Sub New(endpoint__1 As String, method__2 As HttpVerb, contenttype__3 As String, postData__4 As String)
EndPoint = endpoint__1
Method = method__2
ContentType = contenttype__3
PostData = postData__4
Accept = ""
End Sub
Public Function MakeRequest() As String
Return MakeRequest("")
End Function
Public Function MakeRequest(parameters As String) As String
Dim request = DirectCast(WebRequest.Create(EndPoint & parameters), HttpWebRequest)
request.Method = Method.ToString()
request.ContentLength = 0
request.ContentType = ContentType
request.Accept = Accept
If Not String.IsNullOrEmpty(PostData) AndAlso Method = HttpVerb.POST Then
Dim encoding__1 = New UTF8Encoding()
Dim bytes = Encoding.GetEncoding("iso-8859-1").GetBytes(PostData)
request.ContentLength = bytes.Length
Using writeStream = request.GetRequestStream()
writeStream.Write(bytes, 0, bytes.Length)
End Using
End If
Using response = DirectCast(request.GetResponse(), HttpWebResponse)
Dim responseValue = String.Empty
If response.StatusCode <> HttpStatusCode.OK Then
Dim message = [String].Format("Request failed. Received HTTP {0}", response.StatusCode)
Throw New ApplicationException(message)
End If
' grab the response
Using responseStream = response.GetResponseStream()
If responseStream IsNot Nothing Then
Using reader = New StreamReader(responseStream)
responseValue = reader.ReadToEnd()
End Using
End If
End Using
Return responseValue
End Using
End Function
Public Function MakeRequest(parameters As String, credentials As ICredentials) As String
Dim request = DirectCast(WebRequest.Create(EndPoint & parameters), HttpWebRequest)
request.Method = Method.ToString()
request.Credentials = credentials
request.ContentLength = 0
request.ContentType = ContentType
request.Accept = Accept
If Not String.IsNullOrEmpty(PostData) AndAlso Method = HttpVerb.POST Then
Dim encoding__1 = New UTF8Encoding()
Dim bytes = Encoding.GetEncoding("iso-8859-1").GetBytes(PostData)
request.ContentLength = bytes.Length
Using writeStream = request.GetRequestStream()
writeStream.Write(bytes, 0, bytes.Length)
End Using
End If
Using response = DirectCast(request.GetResponse(), HttpWebResponse)
Dim responseValue = String.Empty
If response.StatusCode <> HttpStatusCode.OK Then
Dim message = [String].Format("Request failed. Received HTTP {0}", response.StatusCode)
Throw New ApplicationException(message)
End If
' grab the response
Using responseStream = response.GetResponseStream()
If responseStream IsNot Nothing Then
Using reader = New StreamReader(responseStream)
responseValue = reader.ReadToEnd()
End Using
End If
End Using
Return responseValue
End Using
End Function
End Class
Now - onto the exciting OpenKM stuff. First create your client:
Code: Select all Dim client = New RestClient()
client.EndPoint = "http://[ip address of your server]:8080/OpenKM/services/rest/"
client.Method = [This is the HttpVerb Enum from above, so either HttpVerb.POST or HttpVerb.GET etc]
client.Accept = "application/xml"
client.ContentType = "text/xml"
The .Accept can also be application/json, but I am still working with 6.3.1, and it is broken there.
Right - now to build the command. To pull an email FROM OpenKM you would set client.Method to HttpVerb.GET, and the command would be:
Code: Select alldim query_result as string = client.MakeRequest("mail/getProperties" & "?mailId=" & [uuid of the email to be pulled], New System.Net.NetworkCredential([username], [password]))
The query_result string should now be an xml file. You need to deserialize that from xml to a vb.net object. The Object has to match an OpenKM mail object. This was one of my mistakes in the thread above. I deserialized to a com.openkm.sdk4csharp.bean.Mail obejct when the xml file was a serialized com.openkm.bean.Mail object. This did not work. So you need some code for the latter in vb.net. it is as follows:
Code: Select all'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038"),
System.SerializableAttribute(),
System.Diagnostics.DebuggerStepThroughAttribute(),
System.ComponentModel.DesignerCategoryAttribute("code"),
System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://ws.openkm.com")>
Partial Public Class mail
Inherits node
Private attachmentsField() As document
Private bccField() As String
Private ccField() As String
Private contentField As String
Private fromField As String
Private mimeTypeField As String
Private receivedDateField As Date
Private receivedDateFieldSpecified As Boolean
Private replyField() As String
Private sentDateField As Date
Private sentDateFieldSpecified As Boolean
Private sizeField As Long
Private subjectField As String
Private toField() As String
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute("attachments", Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True)>
Public Property attachments() As document()
Get
Return Me.attachmentsField
End Get
Set
Me.attachmentsField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute("bcc", Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True)>
Public Property bcc() As String()
Get
Return Me.bccField
End Get
Set
Me.bccField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute("cc", Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True)>
Public Property cc() As String()
Get
Return Me.ccField
End Get
Set
Me.ccField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property content() As String
Get
Return Me.contentField
End Get
Set
Me.contentField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property from() As String
Get
Return Me.fromField
End Get
Set
Me.fromField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property mimeType() As String
Get
Return Me.mimeTypeField
End Get
Set
Me.mimeTypeField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property receivedDate() As Date
Get
Return Me.receivedDateField
End Get
Set
Me.receivedDateField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlIgnoreAttribute()>
Public Property receivedDateSpecified() As Boolean
Get
Return Me.receivedDateFieldSpecified
End Get
Set
Me.receivedDateFieldSpecified = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute("reply", Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True)>
Public Property reply() As String()
Get
Return Me.replyField
End Get
Set
Me.replyField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property sentDate() As Date
Get
Return Me.sentDateField
End Get
Set
Me.sentDateField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlIgnoreAttribute()>
Public Property sentDateSpecified() As Boolean
Get
Return Me.sentDateFieldSpecified
End Get
Set
Me.sentDateFieldSpecified = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property size() As Long
Get
Return Me.sizeField
End Get
Set
Me.sizeField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property subject() As String
Get
Return Me.subjectField
End Get
Set
Me.subjectField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute("to", Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True)>
Public Property [to]() As String()
Get
Return Me.toField
End Get
Set
Me.toField = Value
End Set
End Property
End Class
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038"),
System.SerializableAttribute(),
System.Diagnostics.DebuggerStepThroughAttribute(),
System.ComponentModel.DesignerCategoryAttribute("code"),
System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://ws.openkm.com")>
Partial Public Class document
Inherits node
Private actualVersionField As Version
Private checkedOutField As Boolean
Private convertibleToPdfField As Boolean
Private convertibleToSwfField As Boolean
Private descriptionField As String
Private languageField As String
Private lastModifiedField As Date
Private lastModifiedFieldSpecified As Boolean
Private lockInfoField As lockInfo
Private lockedField As Boolean
Private mimeTypeField As String
Private titleField As String
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property actualVersion() As Version
Get
Return Me.actualVersionField
End Get
Set
Me.actualVersionField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property checkedOut() As Boolean
Get
Return Me.checkedOutField
End Get
Set
Me.checkedOutField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property convertibleToPdf() As Boolean
Get
Return Me.convertibleToPdfField
End Get
Set
Me.convertibleToPdfField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property convertibleToSwf() As Boolean
Get
Return Me.convertibleToSwfField
End Get
Set
Me.convertibleToSwfField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property description() As String
Get
Return Me.descriptionField
End Get
Set
Me.descriptionField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property language() As String
Get
Return Me.languageField
End Get
Set
Me.languageField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property lastModified() As Date
Get
Return Me.lastModifiedField
End Get
Set
Me.lastModifiedField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlIgnoreAttribute()>
Public Property lastModifiedSpecified() As Boolean
Get
Return Me.lastModifiedFieldSpecified
End Get
Set
Me.lastModifiedFieldSpecified = Value
End Set
End Property
'''<remarks/>
Public Property lockInfo() As lockInfo
Get
Return Me.lockInfoField
End Get
Set
Me.lockInfoField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property locked() As Boolean
Get
Return Me.lockedField
End Get
Set
Me.lockedField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property mimeType() As String
Get
Return Me.mimeTypeField
End Get
Set
Me.mimeTypeField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property title() As String
Get
Return Me.titleField
End Get
Set
Me.titleField = Value
End Set
End Property
End Class
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038"),
System.SerializableAttribute(),
System.Diagnostics.DebuggerStepThroughAttribute(),
System.ComponentModel.DesignerCategoryAttribute("code"),
System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://ws.openkm.com")>
Partial Public Class lockInfo
Private nodePathField As String
Private ownerField As String
Private tokenField As String
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property nodePath() As String
Get
Return Me.nodePathField
End Get
Set
Me.nodePathField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property owner() As String
Get
Return Me.ownerField
End Get
Set
Me.ownerField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property token() As String
Get
Return Me.tokenField
End Get
Set
Me.tokenField = Value
End Set
End Property
End Class
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038"),
System.SerializableAttribute(),
System.Diagnostics.DebuggerStepThroughAttribute(),
System.ComponentModel.DesignerCategoryAttribute("code"),
System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://ws.openkm.com")>
Partial Public Class note
Private authorField As String
Private dateField As Date
Private dateFieldSpecified As Boolean
Private pathField As String
Private textField As String
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property author() As String
Get
Return Me.authorField
End Get
Set
Me.authorField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property [date]() As Date
Get
Return Me.dateField
End Get
Set
Me.dateField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlIgnoreAttribute()>
Public Property dateSpecified() As Boolean
Get
Return Me.dateFieldSpecified
End Get
Set
Me.dateFieldSpecified = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property path() As String
Get
Return Me.pathField
End Get
Set
Me.pathField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property text() As String
Get
Return Me.textField
End Get
Set
Me.textField = Value
End Set
End Property
End Class
'''<remarks/>
<System.Xml.Serialization.XmlIncludeAttribute(GetType(document)),
System.Xml.Serialization.XmlIncludeAttribute(GetType(mail)),
System.Xml.Serialization.XmlIncludeAttribute(GetType(folder)),
System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038"),
System.SerializableAttribute(),
System.Diagnostics.DebuggerStepThroughAttribute(),
System.ComponentModel.DesignerCategoryAttribute("code"),
System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://ws.openkm.com")>
Partial Public Class node
Private authorField As String
Private categoriesField() As folder
Private createdField As Date
Private createdFieldSpecified As Boolean
Private keywordsField() As String
Private notesField() As note
Private pathField As String
Private permissionsField As Integer
Private subscribedField As Boolean
Private subscriptorsField() As String
Private uuidField As String
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property author() As String
Get
Return Me.authorField
End Get
Set
Me.authorField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute("categories", Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True)>
Public Property categories() As folder()
Get
Return Me.categoriesField
End Get
Set
Me.categoriesField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property created() As Date
Get
Return Me.createdField
End Get
Set
Me.createdField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlIgnoreAttribute()>
Public Property createdSpecified() As Boolean
Get
Return Me.createdFieldSpecified
End Get
Set
Me.createdFieldSpecified = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute("keywords", Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True)>
Public Property keywords() As String()
Get
Return Me.keywordsField
End Get
Set
Me.keywordsField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute("notes", Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True)>
Public Property notes() As note()
Get
Return Me.notesField
End Get
Set
Me.notesField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property path() As String
Get
Return Me.pathField
End Get
Set
Me.pathField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property permissions() As Integer
Get
Return Me.permissionsField
End Get
Set
Me.permissionsField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property subscribed() As Boolean
Get
Return Me.subscribedField
End Get
Set
Me.subscribedField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute("subscriptors", Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True)>
Public Property subscriptors() As String()
Get
Return Me.subscriptorsField
End Get
Set
Me.subscriptorsField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property uuid() As String
Get
Return Me.uuidField
End Get
Set
Me.uuidField = Value
End Set
End Property
End Class
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038"),
System.SerializableAttribute(),
System.Diagnostics.DebuggerStepThroughAttribute(),
System.ComponentModel.DesignerCategoryAttribute("code"),
System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://ws.openkm.com")>
Partial Public Class folder
Inherits node
Private hasChildrenField As Boolean
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property hasChildren() As Boolean
Get
Return Me.hasChildrenField
End Get
Set
Me.hasChildrenField = Value
End Set
End Property
End Class
That's very lengthy because it is a bundle of objects which the email object relies on, like nodes, folders, documents and so on.
Anyway, now you can deserialize your result string to this object as follows:
Code: Select all Dim temp_object As New mail
Dim instance_of_XML_Serializer As New XmlSerializer(GetType(mail))
Try
Using reader As TextReader = New StringReader(query_result)
temp_object = DirectCast(instance_of_XML_Serializer.Deserialize(reader), mail)
End Using
Catch exception As SerializationException
'Report on failure.
End Try
If you are starting with a mail object called temp_object and want to get it INTO OpenKM, you do this:
Code: Select all Dim restsharp_client As New RestSharp.RestClient("http://[ip address of server]:8080/")
restsharp_client.Authenticator = New RestSharp.HttpBasicAuthenticator([username], [password])
Dim restsharp_request = New RestSharp.RestRequest("OpenKM/services/rest/mail/create", HttpVerb.POST)
restsharp_request.RequestFormat = RestSharp.DataFormat.Xml
restsharp_request.XmlSerializer = New RestSharp.Serializers.DotNetXmlSerializer()
restsharp_request.AddBody(temp_object)
Dim response_report As IRestResponse = restsharp_client.Execute(restsharp_request)
I had a several problems with this - see above. I solved them by using the XML Serializer that was built into RestSharp. I also had a couple of NullPointerException problems, which I traced in the code to the email I was using not have any cc of bcc email recipients. Those properties had been left null, which OpenKM did not like. I solved that by doing this:
Code: Select all temp_object.cc = {""}
temp_object.bcc = {""}
Obviously that is crude and you would want an if temp_object.cc = nothing , then .... test instead.
This is now working, although attachments are still to be properly handled. One thing, though. The system does not report it as a success. I get a 500 error code, and this line in the log:
Code: Select all2017-01-13 16:34:29,366 [http-nio-0.0.0.0-8080-exec-10] WARN org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor- No message body writer has been found for response class Mail.
The email IS there, so it has worked, and I presume this error just means that for some XML related reason it cannot properly report that to the IRestResponse object I created for the task.
Hope someone finds this useful.