Click here to Skip to main content
16,020,417 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Passing custom object to web service Pin
BobsAfro10-May-07 22:04
BobsAfro10-May-07 22:04 
GeneralRe: Passing custom object to web service Pin
BobsAfro10-May-07 23:11
BobsAfro10-May-07 23:11 
GeneralRe: Passing custom object to web service Pin
nlarson1111-May-07 4:09
nlarson1111-May-07 4:09 
GeneralRe: Passing custom object to web service Pin
BobsAfro11-May-07 5:02
BobsAfro11-May-07 5:02 
GeneralRe: Passing custom object to web service Pin
nlarson1111-May-07 5:27
nlarson1111-May-07 5:27 
GeneralRe: Passing custom object to web service Pin
BobsAfro11-May-07 5:33
BobsAfro11-May-07 5:33 
GeneralRe: Passing custom object to web service Pin
nlarson1111-May-07 6:12
nlarson1111-May-07 6:12 
GeneralRe: Passing custom object to web service Pin
nlarson1111-May-07 11:07
nlarson1111-May-07 11:07 
example:

include system.web.services in your exe project
make the webservice (if not already) a virtual directory

the line - Me.Url = "http://localhost/cpwebproj/PopulateMyObj.asmx"
allows you to change localhost to any ip/dns name

hope this helps...

********this goes in your dll***********

<Serializable()> _
Public Class MyObj
Public sName As String
Public sAddr As String
Public sCity As String
Public sState As String
Public sZip As String
End Class

********this goes in your exe***********
Public Class Form1
Inherits System.Windows.Forms.Form

Private Sub Form1_Load1(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim oEntity As New CPDllProj.MyObj
Dim oTrans As New Trans

oEntity = oTrans.Request(oEntity)

MsgBox(oEntity.sName)
MsgBox(oEntity.sAddr)
MsgBox(oEntity.sCity)
MsgBox(oEntity.sState)
MsgBox(oEntity.sZip)

End
End Sub
end class

Imports System.Web.Services
Imports System.Web.Services.Protocols

<System.Diagnostics.DebuggerStepThroughAttribute(), _
System.ComponentModel.DesignerCategoryAttribute("code"), _
System.Web.Services.WebServiceBindingAttribute(Name:="CPHandlerSoap", [Namespace]:="CPWebProj/PopulateMyObj")> _
Public Class Trans
Inherits System.Web.Services.Protocols.SoapHttpClientProtocol

<System.Web.Services.Protocols.SoapDocumentMethodAttribute("CPWebProj/PopulateMyObj/Request", _
RequestNamespace:="CPWebProj/PopulateMyObj", _
ResponseNamespace:="CPWebProj/PopulateMyObj", _
Use:=System.Web.Services.Description.SoapBindingUse.Literal, _
ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)> _
Public Function Request(ByVal oEntity As CPDllProj.MyObj) As CPDllProj.MyObj
Dim oa() As Object

Me.Url = "http://localhost/cpwebproj/PopulateMyObj.asmx"
Me.Timeout = 60000

oa = Me.Invoke("Request", New Object() {oEntity})
Return CType(oa(0), CPDllProj.MyObj)
End Function
End Class

********this goes in your webservice***********

Imports System.Web.Services

<System.Web.Services.WebService(Namespace:="CPWebProj/PopulateMyObj")> _
Public Class PopulateMyObj
Inherits System.Web.Services.WebService

#Region " Web Services Designer Generated Code "

Public Sub New()
MyBase.New()

'This call is required by the Web Services Designer.
InitializeComponent()

'Add your own initialization code after the InitializeComponent() call

End Sub

'Required by the Web Services Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Web Services Designer
'It can be modified using the Web Services Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
components = New System.ComponentModel.Container
End Sub

Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
'CODEGEN: This procedure is required by the Web Services Designer
'Do not modify it using the code editor.
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

#End Region

<WebMethod(), _
System.Xml.Serialization.XmlInclude(GetType(CPDllProj.MyObj))> _
Public Function Request(ByVal oEntity As CPDllProj.MyObj) As CPDllProj.MyObj
oEntity.sName = "me"
oEntity.sAddr = "123 test st"
oEntity.sCity = "testy town"
oEntity.sState = "IL"
oEntity.sZip = "60000"
Return oEntity
End Function
End Class


GeneralRe: Passing custom object to web service Pin
BobsAfro14-May-07 3:26
BobsAfro14-May-07 3:26 
GeneralRe: Passing custom object to web service Pin
nlarson1114-May-07 3:41
nlarson1114-May-07 3:41 
GeneralRe: Passing custom object to web service Pin
BobsAfro14-May-07 3:48
BobsAfro14-May-07 3:48 
GeneralRe: Passing custom object to web service Pin
BobsAfro14-May-07 3:53
BobsAfro14-May-07 3:53 
GeneralRe: Passing custom object to web service Pin
nlarson1114-May-07 3:54
nlarson1114-May-07 3:54 
GeneralRe: Passing custom object to web service Pin
BobsAfro14-May-07 3:59
BobsAfro14-May-07 3:59 
QuestionDatagrid dropdownlist, populated from Access database. [modified] Pin
robw188810-May-07 1:06
robw188810-May-07 1:06 
Questionexlude from column ordering a field Pin
sal219-May-07 23:53
sal219-May-07 23:53 
AnswerRe: exlude from column ordering a field Pin
nlarson1110-May-07 4:14
nlarson1110-May-07 4:14 
QuestionTray Icon Pin
nitin_ion9-May-07 22:32
nitin_ion9-May-07 22:32 
AnswerRe: Tray Icon Pin
Sonia Gupta9-May-07 23:35
Sonia Gupta9-May-07 23:35 
GeneralRe: Tray Icon Pin
nitin_ion9-May-07 23:57
nitin_ion9-May-07 23:57 
GeneralRe: Tray Icon Pin
Sonia Gupta10-May-07 0:10
Sonia Gupta10-May-07 0:10 
AnswerRe: Tray Icon Pin
P P Vilsad10-May-07 17:51
P P Vilsad10-May-07 17:51 
AnswerRe: Tray Icon Pin
kubben10-May-07 4:40
kubben10-May-07 4:40 
GeneralRe: Tray Icon Pin
Sonia Gupta10-May-07 18:05
Sonia Gupta10-May-07 18:05 
QuestionWorkflow Pin
s.a.Rahman9-May-07 21:33
s.a.Rahman9-May-07 21:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.