sto studiando le webservices quindi il codice che sto utilizzando è questo:
http://webservices.dotnethell.it/WSContents.asmx
e l'xmlcodice:Namespace dotnethell <System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0"), _ System.ServiceModel.ServiceContractAttribute([Namespace]:="http://webservices.dotnethell.it/WSContents", ConfigurationName:="dotnethell.WSContentsSoap")> _ Public Interface WSContentsSoap <System.ServiceModel.OperationContractAttribute(Action:="http://webservices.dotnethell.it/WSContents/GetAllTips", ReplyAction:="*"), _ System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults:=true)> _ Function GetAllTips(ByVal userid As String, ByVal password As String) As System.Xml.XmlNode <System.ServiceModel.OperationContractAttribute(Action:="http://webservices.dotnethell.it/WSContents/GetArticles", ReplyAction:="*"), _ System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults:=true)> _ Function GetArticles(ByVal n As String) As System.Xml.XmlNode <System.ServiceModel.OperationContractAttribute(Action:="http://webservices.dotnethell.it/WSContents/GetNews", ReplyAction:="*"), _ System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults:=true)> _ Function GetNews(ByVal n As String) As System.Xml.XmlNode <System.ServiceModel.OperationContractAttribute(Action:="http://webservices.dotnethell.it/WSContents/GetTips", ReplyAction:="*"), _ System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults:=true)> _ Function GetTips(ByVal n As String) As System.Xml.XmlNode End Interface <System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")> _ Public Interface WSContentsSoapChannel Inherits dotnethell.WSContentsSoap, System.ServiceModel.IClientChannel End Interface <System.Diagnostics.DebuggerStepThroughAttribute(), _ System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")> _ Partial Public Class WSContentsSoapClient Inherits System.ServiceModel.ClientBase(Of dotnethell.WSContentsSoap) Implements dotnethell.WSContentsSoap Public Sub New() MyBase.New End Sub Public Sub New(ByVal endpointConfigurationName As String) MyBase.New(endpointConfigurationName) End Sub Public Sub New(ByVal endpointConfigurationName As String, ByVal remoteAddress As String) MyBase.New(endpointConfigurationName, remoteAddress) End Sub Public Sub New(ByVal endpointConfigurationName As String, ByVal remoteAddress As System.ServiceModel.EndpointAddress) MyBase.New(endpointConfigurationName, remoteAddress) End Sub Public Sub New(ByVal binding As System.ServiceModel.Channels.Binding, ByVal remoteAddress As System.ServiceModel.EndpointAddress) MyBase.New(binding, remoteAddress) End Sub Public Function GetAllTips(ByVal userid As String, ByVal password As String) As System.Xml.XmlNode Implements dotnethell.WSContentsSoap.GetAllTips Return MyBase.Channel.GetAllTips(userid, password) End Function Public Function GetArticles(ByVal n As String) As System.Xml.XmlNode Implements dotnethell.WSContentsSoap.GetArticles Return MyBase.Channel.GetArticles(n) End Function Public Function GetNews(ByVal n As String) As System.Xml.XmlNode Implements dotnethell.WSContentsSoap.GetNews Return MyBase.Channel.GetNews(n) End Function Public Function GetTips(ByVal n As String) As System.Xml.XmlNode Implements dotnethell.WSContentsSoap.GetTips Return MyBase.Channel.GetTips(n) End Function End Class End Namespace
nella formcodice:<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <GetNews xmlns="http://webservices.dotnethell.it/WSContents"> <n>string</n> </GetNews> </soap:Body> </soap:Envelope>
Come dovrei trattare i dati che ricevo??? Ho capito che vanno usate come normali function ma non capisco come devo leggere in particolare quel dato di ritorno.codice:Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim prova As New dotnethell.WSContentsSoapClient prova.GetNews(1) ' A questo punto non so come poter leggere il dato End Sub
Grazie.

Rispondi quotando