Ragazzi, scusate con le terminologie usante ma vorrei chiedervi info riguardo al seguente codice che mi ritorna un mio webservice.
Nella mia applicazione, la funzione <getDocContents> della seguente SEMPLICE classe:
codice:
Class BookInfo
Public author As String
Public description As String
Public fileName As String
Public noteID As String
Public title As String
Public typeOfBook As String
'** nothing to lnitialize here
Public Sub New ()
End Sub
Public Function getDocContents (doc As NotesDocument) As Integer
title = doc.GetItemValue(TITLE_FIELD)(0)
description = doc.GetItemValue(DESCRIPTION_FIELD)(0)
author = doc.GetItemValue(AUTHOR_FIELD)(0)
typeOfBook = doc.GetItemValue(BOOK_TYPE_FIELD)(0)
noteID = doc.NoteID
fileName = firstAttachmentFileName(doc, ATTACHMENT_FIELD)
getDocContents = True
End Function
End Class
mi ritorna un codice XSI / XML in questo modo
codice:
xsi:type="ns1:BOOKINFO"
<AUTHOR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">Jerome K. Jerome</AUTHOR>
<DESCRIPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">A VERY funny story about 3 men and their mishaps on a short boat trip. This is a Public Domain eText from Project Gutenberg, available at http://www.gutenberg.org</DESCRIPTION>
<FILENAME xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">3boat10.zip</FILENAME>
<NOTEID xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">8FA</NOTEID>
<TITLE xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">Three Men in a Boat</TITLE>
<TYPEOFBOOK xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">Fiction</TYPEOFBOOK>
è tutto praticamente "nativo", nel senso che mi limito a fare una chiamata al webservice usando il protocollo SOAP:
Set client = CreateObject("MSSOAP.SoapClient30")
Call client.MSSoapInit("indirizzo http del webservice)
Set result = getDocContents (doc As NotesDocument)
Forall node In result
resultString = resultString & node.xml & Chr(10)
End Forall
Nell'oggeto node.xml ho all'interno il codice XSI che viene composto ed inserito nella variabile stringa <resultString>
Principalmente vorrei sapere 2 cose:
a) conviene che lascio l'output nel formato che vedete XSI/XML ? ripeto, l'output che vedete XSI+XML è nativo della classe, nel senso che non sono io che lo formatto. Inoltre, come faccio ad utilizzare con il web un file formattato in questo modo ? se lo salvo in formato prova.xml e lo apro con Explorer mi da errore
b) ovviamente ho anche modificato la classe in modo tale da poter ritornare al posto di un "oggetto" XSI anche una stringa di testo che formatto personalmente in XML...una cosa del tipo:
<?xml version="1.0" encoding="iso-8859-1" ?><Result><Messaggio><AUTHOR>Jerome K. Jerome</AUTHOR></Messaggio></Result>
pensate che questa sia una buona soluzione ? è possibile fare il parsing di una stringa di testo che corrisponde ad un XML ?
grazie a tutti