[Mono-list] Need help with Webservices

Jonas Lindau lindau@existing.nu
Thu, 19 Feb 2004 00:17:54 +0100


This is a multi-part message in MIME format.

------=_NextPart_000_0027_01C3F67D.D19C4450
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello all!

I really need help with webservices in mono. I don't have a clue what =
i'm doing wrong.
I have a very simple webservice, it's something like this:
<%@ WebService language=3D"C#" class=3D"myApp.myService" %>

using System;
using System.Web.Services;

namespace myApp {
        public class myService : WebService {
                [WebMethod]
                public string Hello() {
                        return "Hello, this is a string from Linux";
                }
        }
}

This works fine in the browser, using the test-form.
It also works great when i'm ading a web reference from Visual Studio =
.NET to the service.

But, how do i use my webservice from a webform in mono (Running XSP)? =
The basic question is, instead of adding a web reference (as in Visual =
Studio) what do i have to do to make it work with mono? I did download =
the client proxy, which is autogenerated. Then, i'm not sure what to =
do...

The "Codebehind" code looks like this:
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace myApp {
public class WebForm1 : System.Web.UI.Page {
        protected System.Web.UI.WebControls.Label Label1;

        private void Page_Load(object sender, System.EventArgs e) {
                myService obj =3D new myService();
                Label1.Text =3D obj.Hello();
        }
}
}

And the actual page is just a simple aspx page with one asp:label.

If someone out there could write a simple list of actions to take, i =
would be happy for days :)

Thanks
Jonas Lindau








------=_NextPart_000_0027_01C3F67D.D19C4450
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1276" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hello all!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I really need help with webservices in =
mono. I=20
don't have a clue what i'm doing wrong.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I have a very simple webservice, it's =
something=20
like this:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&lt;%@ WebService language=3D"C#"=20
class=3D"myApp.myService" %&gt;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>using System;<BR>using=20
System.Web.Services;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>namespace myApp=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public class myService : =

WebService=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;=20
[WebMethod]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
public string Hello()=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
return "Hello, this is a string from=20
Linux";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>This works fine in the browser, using =
the=20
test-form.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>It also works great when i'm ading a =
web reference=20
from Visual Studio .NET to the service.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>But, how do i use my webservice from a =
webform in=20
mono (Running XSP)? The basic question is, instead of adding a web =
reference (as=20
in Visual Studio) what do i have to do to make it work with mono? I did =
download=20
the client proxy, which is autogenerated. Then, i'm not sure what to=20
do...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The "Codebehind" code looks like =
this:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>using System;<BR>using =
System.Web;<BR>using=20
System.Web.UI;<BR>using System.Web.UI.WebControls;<BR>using=20
System.Web.UI.HtmlControls;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>namespace myApp {<BR>public class =
WebForm1 :=20
System.Web.UI.Page {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
protected=20
System.Web.UI.WebControls.Label Label1;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial =
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private=20
void Page_Load(object sender, System.EventArgs e)=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;=20
myService obj =3D new=20
myService();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
Label1.Text =3D =
obj.Hello();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
}<BR>}<BR>}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>And the actual page is just a simple =
aspx page with=20
one asp:label.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>If someone out there could write a =
simple list of=20
actions to take, i would be happy for days :)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Jonas Lindau</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT><FONT face=3DArial =
size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_0027_01C3F67D.D19C4450--