[lnkForumImage]
TotalShareware - Download Free Software

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


 

Arno

8/28/2003 1:59:00 PM

How do I call a webservice from a webapplication in
ASP.NET??

I do not have any experience

Can you recommenc me good books??

thank you
3 Answers

Dino Chiesa [MSFT]

8/28/2003 8:56:00 PM

0

check out a tutorial for a basic ASMX webservice.
It should show you how to build a client.

what you want to do, I suppose, is use an ASPX module as a client of the
ASMX.
In this case, the ASPX is the client, and must reference the webservice
proxy.

You need to compile the generated proxy classes into a DLL and drop them
into the bin dir of the ASP.NET app.

example:
http://www.aspalliance.com/cookbook/ViewChapter.aspx?...


-Dino



"Arno" <arge@home.nl> wrote in message
news:0e8001c36d6c$7dfcf050$a301280a@phx.gbl...
> How do I call a webservice from a webapplication in
> ASP.NET??
>
> I do not have any experience
>
> Can you recommenc me good books??
>
> thank you


Arno

8/29/2003 6:15:00 AM

0

How do I compile the proxy classes into a dll??

and where do I put mu business classes?
>-----Original Message-----
>check out a tutorial for a basic ASMX webservice.
>It should show you how to build a client.
>
>what you want to do, I suppose, is use an ASPX module as
a client of the
>ASMX.
>In this case, the ASPX is the client, and must reference
the webservice
>proxy.
>
>You need to compile the generated proxy classes into a
DLL and drop them
>into the bin dir of the ASP.NET app.
>
>example:
>http://www.aspalliance.com/cookbook/ViewCha...
Chapter=19
>
>
>-Dino
>
>
>
>"Arno" <arge@home.nl> wrote in message
>news:0e8001c36d6c$7dfcf050$a301280a@phx.gbl...
>> How do I call a webservice from a webapplication in
>> ASP.NET??
>>
>> I do not have any experience
>>
>> Can you recommenc me good books??
>>
>> thank you
>
>
>.
>

Dino Chiesa [MSFT]

8/29/2003 3:23:00 PM

0

Arno,
To compile you would use the langiuage compiler. For C#, that is csc.exe
located in
c:\windows\Microsoft.NET\Framework\v1.1.4322\csc

and you would invoke it thusly:
csc /target:library /out:MyLibrary.dll Module1.cs Module2.cs Module3.cs

On the cmd line include all of the C# modules you want to combine into the
DLL. This might be just one C# file: the proxy generated from wsdl.exe.
But you might have other helper classes, or you might decide you want to
inherit from the proxy, etc. Probably if you are just starting, you would
have just the one source module.

The resulting DLL goes into the bin dir, as I said.

For business classes, you have a couple of options.
1. You can build them into a DLL in the same way - the only difference here
is that rather than starting with"generated" code - generated from
wsdl.exe - you will be starting with code you have written. You compile and
drop the DLL into the bin, just like with the proxy. In fact there is no
technical difference whatsoever. Then you call the "business methods" from
your aspx server-side script.

2. you can also use code-behind, and utilize the ASP.NET infrastructure to
compile your "business methods" at runtime, on demand. To do this, you
would code your aspx page (Maybe it is called "MyPage.aspx") like this:
<%@ Page Language="C#" ContentType="application/pdf" Inherits="MyClass"
src="MyClass.aspx.cs" %>

Then, you write a second source module, called "MyClass.aspx.cs" and drop
that into the same web directory with your MyPage.aspx. This module ought
to look like so:

public class MyClass : System.Web.UI.Page {
private void Page_Load(object sender, System.EventArgs e) {
....
}
...

}

In that class you can provide methods for any of the page-level events, such
as the skeletal Page_Load() shown above. For more on the page-level
events see
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemWebUIPageClas...

or google for "code behind"
http://www.google.com/search?hl=en&num=30&q="code+be...

-------

Of course, you can use a combination of code-behind (#2) and DLLs (#1) in
your ASP.NET apps.

------------
This post is probably not enough to get you really rolling. Look at some
working samples, especially the ASP.NET quickstarts that are included in the
..NET SDK.
C:\netsdk\QuickStart\aspplus\samples\webforms\intro is a nice place to
start.

Even better, Get yourself a book!

"ASP.NET Unleashed" is a fine one, but there are a million other ASP.NET
books out there.

-Dino



"Arno" <arge@home.nl> wrote in message
news:091e01c36df4$da23c150$a101280a@phx.gbl...
> How do I compile the proxy classes into a dll??
>
> and where do I put mu business classes?
> >-----Original Message-----
> >check out a tutorial for a basic ASMX webservice.
> >It should show you how to build a client.
> >
> >what you want to do, I suppose, is use an ASPX module as
> a client of the
> >ASMX.
> >In this case, the ASPX is the client, and must reference
> the webservice
> >proxy.
> >
> >You need to compile the generated proxy classes into a
> DLL and drop them
> >into the bin dir of the ASP.NET app.
> >
> >example:
> >http://www.aspalliance.com/cookbook/ViewCha...
> Chapter=19
> >
> >
> >-Dino
> >
> >
> >
> >"Arno" <arge@home.nl> wrote in message
> >news:0e8001c36d6c$7dfcf050$a301280a@phx.gbl...
> >> How do I call a webservice from a webapplication in
> >> ASP.NET??
> >>
> >> I do not have any experience
> >>
> >> Can you recommenc me good books??
> >>
> >> thank you
> >
> >
> >.
> >