all groups > dotnet web services > october 2007 >
You're in the

dotnet web services

group:

How to receive/send XML file through HTTP Post?


Re: How to receive/send XML file through HTTP Post? Mads Bondo Dydensborg
10/9/2007 12:00:00 AM
dotnet web services:
[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. 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
How to receive/send XML file through HTTP Post? John Dow
10/9/2007 12:13:39 AM
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!

Re: How to receive/send XML file through HTTP Post? Spam Catcher
10/9/2007 5:42:41 PM
Mads Bondo Dydensborg <mbd@dbc.dk> wrote in
news:eS09JAmCIHA.5208@TK2MSFTNGP04.phx.gbl:

[quoted text, click to view]

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]

If you're doing HTTP posts - I would just go with the WebClient/WebRequest
method. Much simplier.
Re: How to receive/send XML file through HTTP Post? Mads Bondo Dydensborg
10/10/2007 12:00:00 AM
[quoted text, click to view]

I am getting closer and closer to that understanding :-)

[quoted text, click to view]

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]

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
Re: How to receive/send XML file through HTTP Post? Spam Catcher
10/10/2007 8:12:32 PM
Mads Bondo Dydensborg <mbd@dbc.dk> wrote in
news:uidduawCIHA.4836@TK2MSFTNGP06.phx.gbl:

[quoted text, click to view]

OH - if you're the server just use ASP.NET!

Re: How to receive/send XML file through HTTP Post? Mads Bondo Dydensborg
10/11/2007 2:55:21 PM
[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.

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
Re: How to receive/send XML file through HTTP Post? Spam Catcher
10/11/2007 6:57:43 PM
Mads Bondo Dydensborg <mbd@dbc.dk> wrote in
news:#BY87XADIHA.5160@TK2MSFTNGP05.phx.gbl:

[quoted text, click to view]

How about PHP? PHP is cross-platform?

[quoted text, click to view]
Re: How to receive/send XML file through HTTP Post? Mads Bondo Dydensborg
10/12/2007 12:00:00 AM
[quoted text, click to view]

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
Re: How to receive/send XML file through HTTP Post? Spam Catcher
10/15/2007 1:27:18 PM
Mads Bondo Dydensborg <mbd@dbc.dk> wrote in news:uIHQ3sLDIHA.2004
@TK2MSFTNGP06.phx.gbl:

[quoted text, click to view]

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
Re: How to receive/send XML file through HTTP Post? Ralfeus
10/16/2007 7:48:51 AM
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]

AddThis Social Bookmark Button