I got rid of the "weight" parameter:
<System.Web.Services.WebMethod()> _
Public Function Area(ByVal Length As Integer, ByVal Width As Integer)
As Integer
        Return (Area = (Length * Width))
    End Function

Then used this in the client:

    Protected Sub AreaButton_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles AreaButton.Click
        Dim wsConvert As New com.juggernautical.aWebService2
        Dim length, width As Integer
        Dim paperArea As Integer

        If ((Int32.TryParse(TextBoxPaperSizeA.Text, length) = True)
And _
(Int32.TryParse(TextBoxPaperSizeB.Text, width) = True)) Then

            paperArea = wsConvert.Area(length, width)
            lblArea.Text = paperArea.ToString()
        End If
    End Sub

I ran the client and got "0" for the result... ??? It of course should
be "520"



On Sep 29, 1:47 pm, Cerebrus <[EMAIL PROTECTED]> wrote:
> Well... d-uh ! You'd just store the values from your textboxes into
> variables and then pass them to the webservice method just like you
> would for any other function :
>
> Dim weight, length, width as integer
> Dim paperArea as integer
>
> If ((Int32.TryParse(paperWeight.Text, weight) = True) And
> (Int32.TryParse(paperLength.Text, length) = True) And
> (Int32.TryParse(paperWidth.Text, width) = True)) Then
>   ' I dunno why an area calculation would require "weight", but
> still...
>   paperArea = wsConvert.Area(weight, length, width)
>
>   lblArea.Text = paperArea.ToString()
> End If
>
> On Sep 29, 10:18 pm, Brock <[EMAIL PROTECTED]> wrote:
>
>
>
> > This is really just a personal learning exersize for me. The actual
> > web service (and it may not finalize to a web service, I'm just trying
> > to learn the mechanics) will have a much more sophisticated set of
> > calculations at the BL. So I'm sorting through some textbooks and
> > online trying to learn the mechanics of this basic syntax for passing
> > two varables back to a web service from a .aspx that references that
> > web service.
>
> > I have a start from the client's code-behind:
> >     Protected Sub AreaButton_Click(ByVal sender As Object, ByVal e As
> > System.EventArgs) Handles AreaButton.Click
> >         Dim wsConvert As New com.Widgets.aWebService2
>
> >         Dim paperArea As Integer
>
> >       ????   = TextBoxPaperSizeA.Text
>
> >       ????   = TextBoxPaperSizeB.Text
>
> >         lblArea.Text = "Paper area = " & paperArea
>
> >     End Sub
>
> > Then the WSDL referenced:
>
> > <wsdl:message name="AreaSoapIn">
> > <wsdl:part name="parameters" element="tns:Area" />
> > </wsdl:message>
> > <wsdl:message name="AreaSoapOut">
> > <wsdl:part name="parameters" element="tns:AreaResponse" />
> > </wsdl:message>
>
> > And the method found in the .asmx:
>
> > <System.Web.Services.WebMethod()> _
> >     Public Function Area(ByVal Weight As Integer, _
> >         ByVal Length As Integer, ByVal Width As Integer) As Integer
> >             Return (Area = (Length * Width))
> >         End Function
>
> > On Sep 28, 3:22 am, Cerebrus <[EMAIL PROTECTED]> wrote:
>
> > > Me neither ! I also don't see the need to introduce a webservice into
> > > the equation. Understandably, the OP wants to remove the BL part of
> > > the calculation from the ASPX code behind. But the more logical way to
> > > do that would have been in a class library.
>
> > > On Sep 27, 10:55 pm, CK <[EMAIL PROTECTED]> wrote:
>
> > > > I'm not entirely sure what your problem is here, you just need to read
> > > > the values from the text boxes and use the variables when you call the
> > > > webservice.
>
> > > > On 26 Sep, 19:23, Brock <[EMAIL PROTECTED]> wrote:
>
> > > > > I had to repost this again as the subject thread was chabged to
> > > > > something totally different than my OP. Please provide any feedback on
> > > > > this problem I'm working on... Thanks:
>
> > > > > Thanks in advance... I have a client .asmx that I feel is constructed
> > > > > correctly (anyone know a way to test without wrinting a client?).
> > > > > What
> > > > > this service is designed to do is to take two values from the
> > > > > client's
> > > > > textboxes (paper size width and length), multiply those two (on the
> > > > > server side's .asmx) and have the result displayed as the paper's
> > > > > area
> > > > > on a client: e.g 20"x26" = 520"^2. I have a much more complicated
> > > > > progect in reality as far as the math goes so I rally need to keep
> > > > > the
> > > > > calculations on the .asmx side rather than the code behind of
> > > > > the .aspx client. Thus the server .asmx is:
>
> > > > >     <System.Web.Services.WebMethod()> _
> > > > > Public Function Area(ByVal Weight As Integer, _
> > > > >       ByVal Length As Integer, ByVal Width As Integer) As Integer
> > > > >         Return (Area = (Length * Width))
> > > > >     End Function
>
> > > > > Then on the client side's .aspx I have:
>
> > > > >     <asp:Button ID="AreaButton" runat="server"
> > > > >         <asp:TextBox ID="TextBoxPaperSizeA" runat="server"
> > > > > Width="50px"></asp:TextBox>
> > > > >         <asp:TextBox ID="TextBoxPaperSizeB" runat="server"
> > > > > Width="50px"></asp:TextBox>
> > > > >         <asp:Label ID="lblArea" runat="server" style="font-weight:
> > > > > 700">Area</asp:Label>
>
> > > > > With this incomplete code-behind that has me puzzled... any clues?:
>
> > > > >     Protected Sub AreaButton_Click(ByVal sender As Object, ByVal e As
> > > > > System.EventArgs) _
> > > > >       Handles AreaButton.Click
>
> > > > >         Dim wsConvert As New com.Widget.aWebService2
>
> > > > >         Dim paperArea As Integer
>
> > > > >         Dim                                       ‘??????
>
> > > > >         lblArea.Text = "Paper area = " & _
>
> > > > >             wsConvert.Area(paperArea).ToString    ‘??????
> > > > >     End Sub- Hide quoted text -
>
> > > > - Show quoted text -- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web 
Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://cm.megasolutions.net/forums/default.aspx
 <p><a href="http://feeds.feedburner.com/DotNetDevelopment";><img 
src="http://feeds.feedburner.com/~fc/DotNetDevelopment?bg=99CCFF&amp;fg=444444&amp;anim=1";
 height="26" width="88" style="border:0" alt="" /></a></p>
-~----------~----~----~----~------~----~------~--~---

Reply via email to