Showing posts with label output. Show all posts
Showing posts with label output. Show all posts

Wednesday, March 28, 2012

Web Service

I want to write webservice which would just get output from stored procedure (=XML) and send it as XML out. And true is that I realy don't know how to do that. I'm not sure if output from webservice will be string or sthing else.It is easy way to make a Web Service.
1. First , Create a Web Application. such like "http://localhost/webService"
2. Second, Add a new service from solution: Add New Item, select "Web Service", such like: WebService1.asmx.

3. In this page, default has a function, you need to uncomment it.

[WebMethod]
public string HelloWorld()
{
return "Hello World"; // You can return your XML format string. What you returned is just what the client will get.
}

4. You can make your function and return what you want.
5. Set this file as start page, then build it.
6. Run and test it.

7. In client side, such like WinForm, you need add a web reference. On project's references, right click mouse, in popup menu, select "Add Web Reference";

8. Type the web site and page file , such like : http://localhost/webService/WebService1.asmx, then click "go"

9. In "Web Reference Name", put the name you like to name it,such like: "myWebService", then OK.

10. In a WinForm Page, call web server and see what you get.
the code like this:
myWebService.Service1 service = new myWebService.Service1();
string result = service.HelloWorld();
If your response is a XML file, the result string will be the XML string.

Thursday, March 22, 2012

web service setup project missing "primary output"

I've seen this same question in a few places but no answers so I'm really hoping someone can help cause it's kinda urgent (i.e. my boss is really on my case about it!)

I have created an asp.net web service project with Visual Studio 2005. Tested and works when run within the Studio environment. I now need to deploy it and have added a web setup project to my solution. But when I try to add the "Primary Output" the only option I am presented with is the "Content Files". Where is the "Primary output"?

Everything I've read indicates there should be one and trying to install my web service onto my PC doesn't give me a working Web Service. The implication is that I'm missing something missing from my msi ? or have I failed to configure something in the IIS correctly?

Kind Regards


Hi..

Please check this site:http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=616784&SiteID=1 and

http://www.dotnet247.com/247reference/msgs/17/88848.aspx

Hope it helps. Thanks