需要编写HTTP服务器,我可以使用带有“NOSOAP”的Web服务吗?
你好,
我得到了这个呼吸写一个http服务器的任务,xml
data将被发布到并将回答xml数据。
xml处理背后的逻辑不是问题。
我的问题是:我可以配置用于HHTP POST的Web服务?
远程对等方只执行http Web请求。
没有RPC样式调用我的系统。
如何使用用户名和密码进行身份验证?
最好不要使用webservice。
哪里可以看到http服务器的好例子用认证写的
C#?
非常感谢任何帮助。
JJ
Hello,
I got this "breath taking" task to write a an http server to which "xml
data" will be posted to and will answer with xml data.
The logic behind the xml processing is not a matter here.
My question is : Can i configure a webservice for HHTP POST ?
The remote peer just performs an http web request.
NO RPC style call to my system.
How then can i authenticate with username and password?
Would it be better no to use webservice.
Where can i see good examples of http servers with authentication written in
C#?
Any help will be very much appreciated.
JJ
好吧,你可以发布到ashx;很容易设置 - 只需从请求中读取
并写入响应...
Marc
Well, you could just post to an ashx; pretty easy to setup - simply read
from the Request and write to the Response...
Marc
>
" Marc Gravell" <毫安********** @ gmail.com> skrev i en meddelelse
新闻:O3 ************** @ TK2MSFTNGP04.phx.gbl ...
"Marc Gravell" <ma**********@gmail.com> skrev i en meddelelse
news:O3**************@TK2MSFTNGP04.phx.gbl...
嗯,你可以刚刚发布到ashx;非常容易设置 - 只需从请求中读取
并写入响应......
Marc
Well, you could just post to an ashx; pretty easy to setup - simply read
from the Request and write to the Response...
Marc
这听起来很棒!
您能否提供更多关于此处的信息!
This sounds great!
Can you give more info on where to read about this!
最简单的事情就是创建一个新的(空的) )网站,添加一个ashx(通用
处理程序),然后玩它;例如(写,不读 - 但很容易
使用Load和Request.InputStream)见下文。请注意,对于大的
xml(在Mb范围内),您可能希望避免使用XmlDocument类,因为它具有性能(主要是内存)开销。使用XmlReader / XmlWriter远远超过
更高效,但也(更)更难以正确使用。对于小到中等大小的xml,XmlDocument很好
,另外它给你XPath / XQuery。
希望这有帮助,
>
Marc
<%@ WebHandler Language =" C#"类= QUOT;处理程序" %>
使用System;
使用System.Web;
公共类处理程序:IHttpHandler {
public void ProcessRequest(HttpContext context){
context.Response.ContentType =" text / xml" ;;
系统。 Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.LoadXml(@"< Test Of ="" Some"">< Xml /> < / Test>");
doc.Save(context.Response.OutputStream);
}
public bool IsReusable {
get {
返回false;
}
}
}
Easiest thing is just to create a new (empty) web-site, add an ashx (generic
handler), and play with it; for example (writes, doesn''t read - but easy to
do using Load and the Request.InputStream) see below. Note that for large
xml (in the Mb range) you may wish to avoid the XmlDocument class, as it has
a performance (mainly memory) overhead; using XmlReader / XmlWriter is far
more efficient, but also (much) trickier to get right. XmlDocument is fine
for small to mid-size xml, plus it gives you XPath / XQuery.
Hope this helps,
Marc
<%@ WebHandler Language="C#" Class="Handler" %>
using System;
using System.Web;
public class Handler : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/xml";
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.LoadXml(@"<Test Of=""Some""><Xml/></Test>");
doc.Save(context.Response.OutputStream);
}
public bool IsReusable {
get {
return false;
}
}
}