How to call a .net web service from another .net web service?

Hi all,

I have developed two asp .net web services using visual studio .net 2003.
I wish to call one web service from another web service.
I tried adding a web reference of the web service in another web service and was able to do so.
but i m not able to access the web methods provided by the web service
could you please suggest a way to go about it
Expecting quick reply
Thanx
Charmy
1
Charmy
8/4/2005 4:31:49 AM
📁 asp.net.xml-web-services
📃 7071 articles.
⭐ 0 followers.

💬 7 Replies
👁️‍🗨️ 4700 Views


try to make sure that you reference it in the web reference and call it properly 

this is sample 
[WebMethod()]
public double CalcDistance(int x1, int y1, int x2, int y2)
{
Calculator.Service1 calc = new Calculator.Service1();
// Calculate the difference of the y and x coordinates
int yDiff = calc.Subtract(y2,y1);
int xDiff = calc.Subtract(x2,x1);
return Math.Sqrt(Math.Pow(xDiff, 2.0) + Math.Pow(yDiff, 2.0));
}

            
Fadil Alnassar
www.fadilalnassar.com | FREE Nodil Tab Control
http://www.mefranchising.com
0
fadil1977
8/4/2005 9:14:23 AM

I had tried calling the web service, the same way as u have mentioned
but then too could'nt access the web methods
But I was able to add the web reference
Can u plz suggest the possible reasons for the same
Thanx a lot
Charmy
0
Charmy
8/22/2005 4:29:22 AM
ok..... i think we need to test one thing ..... you are trying to consume the WS from a WS and that give problems 

what i want you to do is test the WS itself to consume from a Web app or win app and try to see if the WS can be consumed successfully.... then we can tell where the problem occur

Fadil Alnassar
www.fadilalnassar.com | FREE Nodil Tab Control
http://www.mefranchising.com
0
fadil1977
8/22/2005 8:45:33 AM

Yes I m able to consume the web service from a win application
but unable to call a web service from another web service
Plz suggest the possible reasons for the same
Thanx a lot for your help
Charmy
0
Charmy
8/23/2005 3:13:18 AM
Hi,

    Can u please post the exact error ur getting while calling the methods of the web service. else pls post the error information. Otherwise its hard to help you.
0
stravishankar
8/23/2005 11:17:40 AM
Hi, the easiest way to do that is to make a web reference to the
service that you want to call. Then you have to make an new instance of
that web service and then call it's web methods. Nothing more.

0
ivan_savev
8/25/2005 12:38:07 PM
i think he is doing the steps all right but we need to get a better describtion of what is the error he is getting so we might be able to tell what is the problem!!

Fadil Alnassar
www.fadilalnassar.com | FREE Nodil Tab Control
http://www.mefranchising.com
0
fadil1977
8/25/2005 1:27:49 PM
Reply: