dotnet web services:
[quoted text, click to view] John Dow wrote: > I am trying to receive/send xml files with predefined schema from/to > another server using http post, and a success message back to the sender > Would someone give me a start point where I can start to design the piece? > Is webservice the best practise to use? Could someone give a code sample > or point me a resource on the web? > Thanks you very much!
I have been struggling with this issue myself for some time now. Originally I was under the impression that I needed to use remoting for this. However, remoting only supports SOAP and the binary format. So, I ended up implementing most of a custom formatter, in order to go the remoting way. However, Arne Vajhøj posted this in another forum: HTTP & HTTPS ============ client: (Http)WebRequest Method = POST GetRequestStream + GetResponseStream Serialize request + Deserialize response server: ..aspx empty page only Page_Load Request.GetInputStream Response.GetOutputStream Deserialize request + Serialize response And, this sketch of implementing it outside an .aspx page: HttpListener srv = new HttpListener(); srv.Prefixes.Add("http://localhost/whatever"); srv.Start(); while(true) { HttpListenerContext ctx = srv.GetContext(); HttpListenerRequest req = ctx.Request; HttpListenerResponse resp = ctx.Response; // serialize fra req.InputStream // serialize til resp.OutputStream); } srv.Stop(); srv.Close(); That seems pretty straightforward. I am still not sure what is the best road to me, but if you figure it out, please let me know! :-) Regards, Mads -- Med venlig hilsen/Regards Systemudvikler/Systemsdeveloper cand.scient.dat, Ph.d., Mads Bondo Dydensborg Dansk BiblioteksCenter A/S, Tempovej 7-11, 2750 Ballerup, Tlf. +45 44 86 77
I am trying to receive/send xml files with predefined schema from/to another server using http post, and a success message back to the sender Would someone give me a start point where I can start to design the piece? Is webservice the best practise to use? Could someone give a code sample or point me a resource on the web? Thanks you very much!
Mads Bondo Dydensborg <mbd@dbc.dk> wrote in news:eS09JAmCIHA.5208@TK2MSFTNGP04.phx.gbl: [quoted text, click to view] > I have been struggling with this issue myself for some time now. > Originally I was under the impression that I needed to use remoting > for this.
Remoting is for interprocess communication - not for sending HTTP posts. You could device an HTTP interprocess communications protocol, but you might as well use standard remoting, WCF, or Web services. No need to reinvent the wheel :-) [quoted text, click to view] > However, remoting only supports SOAP and the binary format. > So, I ended up implementing most of a custom formatter, in order to go > the remoting way. > > However, Arne Vajhøj posted this in another forum: > That seems pretty straightforward. I am still not sure what is the > best road to me, but if you figure it out, please let me know! :-)
If you're doing HTTP posts - I would just go with the WebClient/WebRequest method. Much simplier.
[quoted text, click to view] Spam Catcher wrote: >> I have been struggling with this issue myself for some time now. >> Originally I was under the impression that I needed to use remoting >> for this. > > Remoting is for interprocess communication - not for sending HTTP posts.
I am getting closer and closer to that understanding :-) [quoted text, click to view] > You could device an HTTP interprocess communications protocol, but you > might as well use standard remoting, WCF, or Web services. No need to > reinvent the wheel :-)
I totally agree. I ended up here, due to a lack of knowledge about the framework. I _did_ ask in several newsgroups, but probably did not frame my question in a sensible way. [quoted text, click to view] > If you're doing HTTP posts - I would just go with the WebClient/WebRequest > method. Much simplier.
So, you are suggesting another road than Arne? Just to clarify: I am implementing the server, not the client. I do not care about the client actually, but do have to support a fixed format on the wire. WebRequest looks very much client like? Regards, Mads -- Med venlig hilsen/Regards Systemudvikler/Systemsdeveloper cand.scient.dat, Ph.d., Mads Bondo Dydensborg Dansk BiblioteksCenter A/S, Tempovej 7-11, 2750 Ballerup, Tlf. +45 44 86 77
Mads Bondo Dydensborg <mbd@dbc.dk> wrote in news:uidduawCIHA.4836@TK2MSFTNGP06.phx.gbl: [quoted text, click to view] >> If you're doing HTTP posts - I would just go with the >> WebClient/WebRequest method. Much simplier. > > So, you are suggesting another road than Arne? > > Just to clarify: I am implementing the server, not the client. I do > not care about the client actually, but do have to support a fixed > format on the wire. WebRequest looks very much client like?
OH - if you're the server just use ASP.NET!
[quoted text, click to view] Spam Catcher wrote: > Mads Bondo Dydensborg <mbd@dbc.dk> wrote in > news:uidduawCIHA.4836@TK2MSFTNGP06.phx.gbl: > >>> If you're doing HTTP posts - I would just go with the >>> WebClient/WebRequest method. Much simplier. >> >> So, you are suggesting another road than Arne? >> >> Just to clarify: I am implementing the server, not the client. I do >> not care about the client actually, but do have to support a fixed >> format on the wire. WebRequest looks very much client like? > > OH - if you're the server just use ASP.NET! > > ASP.NET (or even classic ASP...) can receive form posts **very** easily.
It is a requirement that this service may have to be run standalone, that is, outside a web server. (It also needs to run under Linux/Mono). But, if I ignore that issue, then that is the best solution, I imagine. It wont be forms that are posted, btw, but that should not matter for this discussion. Thanks, Mads -- Med venlig hilsen/Regards Systemudvikler/Systemsdeveloper cand.scient.dat, Ph.d., Mads Bondo Dydensborg Dansk BiblioteksCenter A/S, Tempovej 7-11, 2750 Ballerup, Tlf. +45 44 86 77
Mads Bondo Dydensborg <mbd@dbc.dk> wrote in news:#BY87XADIHA.5160@TK2MSFTNGP05.phx.gbl: [quoted text, click to view] > It is a requirement that this service may have to be run standalone, > that is, outside a web server. (It also needs to run under > Linux/Mono). But, if I ignore that issue, then that is the best > solution, I imagine.
How about PHP? PHP is cross-platform? [quoted text, click to view] > It wont be forms that are posted, btw, but that should not matter for > this discussion.
[quoted text, click to view] Spam Catcher wrote: > Mads Bondo Dydensborg <mbd@dbc.dk> wrote in > news:#BY87XADIHA.5160@TK2MSFTNGP05.phx.gbl: > >> It is a requirement that this service may have to be run standalone, >> that is, outside a web server. (It also needs to run under >> Linux/Mono). But, if I ignore that issue, then that is the best >> solution, I imagine. > > How about PHP? PHP is cross-platform?
Interessting thing. How should I then communicate from PHP with the C# service? Regards, Mads -- Med venlig hilsen/Regards Systemudvikler/Systemsdeveloper cand.scient.dat, Ph.d., Mads Bondo Dydensborg Dansk BiblioteksCenter A/S, Tempovej 7-11, 2750 Ballerup, Tlf. +45 44 86 77
Mads Bondo Dydensborg <mbd@dbc.dk> wrote in news:uIHQ3sLDIHA.2004 @TK2MSFTNGP06.phx.gbl: [quoted text, click to view] > Interessting thing. How should I then communicate from PHP with the C# > service?
Easiest method would be to dump a record into a database, which your service will pickup and process. Not exactly fancy, but it should work. However, if you were entirely on .NET (i.e. ASP.NET) you could have connected directly with the service via remoting or WCF and talked to the
I just passed whole XML content as a parameter to the Web Service. It looked like this: FileStream fs = new FileStream(fileToSend, FileMode.Open, FileAccess.Read, FileShare.Read); BinaryReader reader = new BinaryReader(fs); char[] data = new char[fs.Length]; reader.Read(data, 0, data.Length); WebService.SendData(settings["PDAID"], new string(data)); Originally the Web Service was hosted on the ASP.NET, but later was migrated to PHP. Client part was not changed. [quoted text, click to view] On Oct 9, 7:13 am, "John Dow" <zho...@gmail.com> wrote: > I am trying to receive/send xml files with predefined schema from/to another > server using http post, and a success message back to the sender > Would someone give me a start point where I can start to design the piece? > Is webservice the best practise to use? Could someone give a code sample or > point me a resource on the web? > Thanks you very much!
Don't see what you're looking for? Try a search.
|