Link to home
Start Free TrialLog in
Avatar of udir
udir

asked on

Web Services (C#)...Need Help!!

Hi experts,
I'm new at ASP.NET so pleeeeease answare step by step if it is possible.

I created a new project (ASP.NET Web Service called "Calc" (the library located
at    c:\inetpub\wwwroot\Calc\Calc1.asmx

the code is simple (becuase i just want to understand how to deal with Web Service)
----------------------------------------------------------------------------
<%@ WebService Language="C#" Class="Calc1" %>

using System.Web.Services;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

public class Calc1 : System.Web.Services.WebService
{

    [WebMethod]
    public int Add(int x, int y)
    {
        return x + y;
    }
}
------------------------------------------------------------------------------

lets say that there is another project  - ASP.NET Web Site called - "Result" which is located
at : c:\inetpub\wwwroot\Result\Result1.aspx

i know that i need to make a proxy call and a disco file and etcw....which i don't know how.
i'm so comfused (:

Please help me (with the example i just wrote - but again - step by step)

Thanks
Udir






Avatar of joechina
joechina

Add a web reference which pointing to the webservice to your second project.
Then you can call it in your asp.net code.
Avatar of udir

ASKER

Hi joechina,
Do you meen that in the "Result" project in the "Result.asmx.cs" in
the load event (for example) i should write a reference?
can you give an example?
(also don't i have to add a proxy file, and a disco file?)
ASKER CERTIFIED SOLUTION
Avatar of joechina
joechina

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of udir

ASKER

Hi,
I get a massage :

The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.


--------------------------------------------------------------------------------

A name was started with an invalid character. Error processing resource 'http://localhost/WebSite1/calc.asmx'. Line 1, Pos...

<%@ WebService Language="C#" CodeBehind="~/App_Code/calc.cs" Class="calc" %>
-^

Do you have any idea what is the problem? (becuase i have already seen xml files on my IE6.) Thanks
Udir

If it's on your local PC, can you browse to the webservice (for example: http://localhost/WebSite1/calc.asmx) and test the webmethod?
Avatar of udir

ASKER

Oh i see what you meen:
i can't get in that address!!!!!
when i run the WebService "WebSite1/calc" i get an address:

http://localhost:1130/WebSite1/calc

Why??? what is the 1130?
Thanks
Udir
It's a debug IIS server for your web project running on port 1130.
You need to deploy your web service first.
Just publish your web service project. (I mean click 'Build -> Publish web site')
It will compile the project to a precompiled folder.
Then you can copy all files to a desired folder(or use the precompiled folder).
Then create a new virtual directory under your IIS.
Avatar of udir

ASKER

OK
Thanks a lot.