array response in webservice
i'm new in .net & i've been searching in the internet for the solution for this problems since a month ago.
i have a wsdl file (which is created in java), which i need to do the coding in .net according to the wsdl file.
i need to do the web service that responses with arrays which contain 2 different types:
pls help how am i going to solve it. i try to use the wsdl.exe but seems cannot help me..
thank you in advance.
myPosted Mar 27, 2008, 4:28 AM
hi,
i got the solution already. just replace this:
CIL.content(0) = c1
CIL.content(1) = c2
CIL.content(2) = c3
with this:
CIL.content = New content() {c1, c2, c3, c4}
that's all. :D
myPosted Mar 23, 2008, 9:11 AM
hi, tq for the response..
i've create a class for this, & from that i can get a nice wsdl, but the problem now is i cannot invoke the method... pls find below my coding in .net, since i'm soooo new, i donno what is wrong... please help..
Imports System
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Xml.Serialization
Public Class Service
Inherits System.Web.Services.WebService
Dim CIL As ContentItems = New ContentItems
Dim r1 As sistem = New sistem
Dim c1 As content = New content
Dim c2 As content = New content
Dim c3 As content = New content
r1.svc_id = "svcid1"
r1.svc_trx_id = "101"
r1.error_code = "0000"
r1.error_desc = "no error"
r1.time_stamp = "45678"
c1.type = "image11"
c1.title = "title1"
c1.description = "description1"
c1.url = "url1"
c2.type = "image"
c2.title = "title2"
c2.description = "description2"
c2.url = "url2"
c3.type = "image"
c3.title = "title3"
c3.description = "description3"
c3.url = "url3"
CIL.system1 = r1
CIL.content(0) = c1
CIL.content(1) = c2
CIL.content(2) = c3
Return CType(CIL, ContentItems)
End Function
End Class
Private systemField As sistem
Private contentField() As content
Public Property system1() As sistem
Get
Return Me.systemField
End Get
Set(ByVal value As sistem)
Me.systemField = value
End Set
End Property
Public Property content() As content()
Get
Return Me.contentField
End Get
Set(ByVal value As content())
Me.contentField = value
End Set
End Property
End Class
Private _type As String
Private _title As String
Private _description As String
Private _url As String
Public Property type() As String
Get
Return _type
End Get
Set(ByVal value As String)
_type = value
End Set
End Property
Public Property title() As String
Get
Return _title
End Get
Set(ByVal value As String)
_title = value
End Set
End Property
Public Property description() As String
Get
Return _description
End Get
Set(ByVal value As String)
_description = value
End Set
End Property
Public Property url() As String
Get
Return _url
End Get
Set(ByVal value As String)
_url = value
End Set
End Property
End Class
Private _svc_id As String
Private _svc_trx_id As String
Private _error_code As String
Private _error_desc As String
Private _time_stamp As String
Public Property svc_id() As String
Get
Return _svc_id
End Get
Set(ByVal value As String)
_svc_id = value
End Set
End Property
Public Property svc_trx_id() As String
Get
Return _svc_trx_id
End Get
Set(ByVal value As String)
_svc_trx_id = value
End Set
End Property
Public Property error_code() As String
Get
Return _error_code
End Get
Set(ByVal value As String)
_error_code = value
End Set
End Property
Public Property error_desc() As String
Get
Return _error_desc
End Get
Set(ByVal value As String)
_error_desc = value
End Set
End Property
Public Property time_stamp() As String
Get
Return _time_stamp
End Get
Set(ByVal value As String)
_time_stamp = value
End Set
End Property
End Class
Private _lbound As Integer
Private _int() As Integer
Public Sub New(ByVal LBound As Integer, ByVal UBound As Integer)
Me.ReDim(LBound, UBound)
End Sub
Public Sub [ReDim](ByVal LBound As Integer, ByVal UBound As Integer)
_lbound = LBound
ReDim _int(UBound - LBound + 1)
End Sub
Default Public Property Item(ByVal Index As Integer) As Integer
Get
Return _int(Index - _lbound)
End Get
Set(ByVal Value As Integer)
_int(Index - _lbound) = Value
End Set
End Property
Public Function ToArray() As Integer()
Return _int
End Function
Private _content As content
Public Property content() As content
Get
Return _content
End Get
Set(ByVal value As content)
_content = value
End Set
End Property
End Class
Bechir BejaouiPosted Mar 23, 2008, 8:37 AM