[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.webservices

Passing a form and all the control via soap to a web service.

(Bill Gianoukos)

1/23/2003 1:04:00 AM

Hi Group,

I was hoping someone can help me figure out how to create a webmethod
that takes as an input parameter a form and all it's controls.

What I want to do is create an vb.net aspx page that has 2 - 5
questions on it. I want to pass the entire form to a web service when
you hit the submit button on the page. I want to web service to
return a string when it has finished processing.

I have tried declaring the webmethod like:

<WebMethod()> Public Function FormPass(ByVal theform As
System.Web.UI.ControlCollection) As String

but this doesn't compile.

Any help would be greatly appreciated.
3 Answers

Dan

1/22/2003 11:46:00 PM

0

Is it necessary to pass the form? It seems it'd be easier to pass only the
values. You can minimize the number of arguments the function takes by
creating a structure:
Public Structure MyStruct
Public var1 As String
Public var2 As String
Public var3 As String
Public var4 As String
Public var5 As String
End Structure

<WebMethod()> Public Function MyFunction(ByRef ms As MyStruct) As String
With ms
MyFunction = var1 & var2 & var3 & var4 & var5 ' or whatever
End with

On the client side, you'd have:
Dim ws As localhost/Service1
Dim MyStruct As ws.MyStruct
MyStruct.var1 = TextBox1.Text
' etc.
TextBox6.Text = ws.MyFunction(MyStruct)

But, as noted in my previous post, this may not be the ideal solution.


"Bill Gianoukos" <vgianouk@yahoo.com> wrote in message
news:9c9ce9b3.0301221429.7092ac41@posting.google.com...
> Hi Group,
>
> I was hoping someone can help me figure out how to create a webmethod
> that takes as an input parameter a form and all it's controls.
>
> What I want to do is create an vb.net aspx page that has 2 - 5
> questions on it. I want to pass the entire form to a web service when
> you hit the submit button on the page. I want to web service to
> return a string when it has finished processing.
>
> I have tried declaring the webmethod like:
>
> <WebMethod()> Public Function FormPass(ByVal theform As
> System.Web.UI.ControlCollection) As String
>
> but this doesn't compile.
>
> Any help would be greatly appreciated.
>


Dan

1/23/2003 4:01:00 PM

0

This might help: http://aspalliance.com/das/passin...


"Bill Gianoukos" <vgianouk@yahoo.com> wrote in message
news:9c9ce9b3.0301230649.48052d6c@posting.google.com...
> Hi Dan,
>
> I have to pass the controls on the form. The reason I need to do this
> is because their might be from 2 to 50 controls. Sorry for the typo
> earlier. I want to be able to write code in the web service that
> loops through all of the controls in the web form.
>
> Do you know if microsoft allows for a form to be passed via the soap
> protocol.
>
> Regards,
> Bill Gianoukos
>
> "Dan" <dan@rpsd.com> wrote in message
news:<JaFX9.6775$bL4.676929@newsread2.prod.itd.earthlink.net>...
> > Is it necessary to pass the form? It seems it'd be easier to pass only
the
> > values. You can minimize the number of arguments the function takes by
> > creating a structure:
> > Public Structure MyStruct
> > Public var1 As String
> > Public var2 As String
> > Public var3 As String
> > Public var4 As String
> > Public var5 As String
> > End Structure
> >
> > <WebMethod()> Public Function MyFunction(ByRef ms As MyStruct) As String
> > With ms
> > MyFunction = var1 & var2 & var3 & var4 & var5 ' or whatever
> > End with
> >
> > On the client side, you'd have:
> > Dim ws As localhost/Service1
> > Dim MyStruct As ws.MyStruct
> > MyStruct.var1 = TextBox1.Text
> > ' etc.
> > TextBox6.Text = ws.MyFunction(MyStruct)
> >
> > But, as noted in my previous post, this may not be the ideal solution.
> >
> >
> > "Bill Gianoukos" <vgianouk@yahoo.com> wrote in message
> > news:9c9ce9b3.0301221429.7092ac41@posting.google.com...
> > > Hi Group,
> > >
> > > I was hoping someone can help me figure out how to create a webmethod
> > > that takes as an input parameter a form and all it's controls.
> > >
> > > What I want to do is create an vb.net aspx page that has 2 - 5
> > > questions on it. I want to pass the entire form to a web service when
> > > you hit the submit button on the page. I want to web service to
> > > return a string when it has finished processing.
> > >
> > > I have tried declaring the webmethod like:
> > >
> > > <WebMethod()> Public Function FormPass(ByVal theform As
> > > System.Web.UI.ControlCollection) As String
> > >
> > > but this doesn't compile.
> > >
> > > Any help would be greatly appreciated.
> > >
>


(Bill Gianoukos)

1/24/2003 10:20:00 AM

0

Hi Dan,

I have to pass the controls on the form. The reason I need to do this
is because their might be from 2 to 50 controls. Sorry for the typo
earlier. I want to be able to write code in the web service that
loops through all of the controls in the web form.

Do you know if microsoft allows for a form to be passed via the soap
protocol.

Regards,
Bill Gianoukos

"Dan" <dan@rpsd.com> wrote in message news:<JaFX9.6775$bL4.676929@newsread2.prod.itd.earthlink.net>...
> Is it necessary to pass the form? It seems it'd be easier to pass only the
> values. You can minimize the number of arguments the function takes by
> creating a structure:
> Public Structure MyStruct
> Public var1 As String
> Public var2 As String
> Public var3 As String
> Public var4 As String
> Public var5 As String
> End Structure
>
> <WebMethod()> Public Function MyFunction(ByRef ms As MyStruct) As String
> With ms
> MyFunction = var1 & var2 & var3 & var4 & var5 ' or whatever
> End with
>
> On the client side, you'd have:
> Dim ws As localhost/Service1
> Dim MyStruct As ws.MyStruct
> MyStruct.var1 = TextBox1.Text
> ' etc.
> TextBox6.Text = ws.MyFunction(MyStruct)
>
> But, as noted in my previous post, this may not be the ideal solution.
>
>
> "Bill Gianoukos" <vgianouk@yahoo.com> wrote in message
> news:9c9ce9b3.0301221429.7092ac41@posting.google.com...
> > Hi Group,
> >
> > I was hoping someone can help me figure out how to create a webmethod
> > that takes as an input parameter a form and all it's controls.
> >
> > What I want to do is create an vb.net aspx page that has 2 - 5
> > questions on it. I want to pass the entire form to a web service when
> > you hit the submit button on the page. I want to web service to
> > return a string when it has finished processing.
> >
> > I have tried declaring the webmethod like:
> >
> > <WebMethod()> Public Function FormPass(ByVal theform As
> > System.Web.UI.ControlCollection) As String
> >
> > but this doesn't compile.
> >
> > Any help would be greatly appreciated.
> >