SPML(服务提供标记语言)/ C#.Net请帮助!

时间:2010-11-03 16:06:20

标签: c# .net soap spml

很抱歉在这里几乎乞求帮助,但我的任务是上面的工作,找不到足够的资源来帮助我。这是详细信息:

  1. 该公司拥有身份管理软件,可提供用户权利变更的SPML(SOAP)“Feed”

  2. (如果我说得对,那么)SPML驱动程序向我服务器上的URL发出POST请求,该URL发送这些更改

  3. 该网址下的内容必须处理发布的信息(XML)

  4. 第3点是我的位。我不知道该写些什么。 ASMX? ASPX? ASHX? Commodore 64盒式磁带?显然SPML驱动程序需要200响应 - 无论如何,当处理没有时,它会得到它吗?还有什么我还没有得到的吗?

    任何帮助,指示,指导或建议我放弃并获得新的爱好,将不胜感激。

    感谢。

    修改..............

    有一个简单的肥皂驱动程序(用于测试)将xml发布到一个aspx页面,然后反过来消耗POST并保存xml。感谢J Benjamin(下)和http://www.eggheadcafe.com/articles/20011103.asp的启动。

    SOAP DRIVER(适用于页面加载)

    protected void Page_Load(object sender, EventArgs e)
    {    
        XmlDocument doc = new XmlDocument();
        doc.Load(MySite.FileRoot + "testing\\testxml.xml");
        HttpWebRequest req = 
        (HttpWebRequest)WebRequest.Create("http://localhost/mysite/testing/reader.aspx");
        req.ContentType = "text/xml; charset=\"utf-8\"";
        req.Method = "POST";
        req.Headers.Add("SOAPAction", "\"\"");
        Stream stm = req.GetRequestStream();
        doc.Save(stm);
        stm.Close();
        WebResponse resp = req.GetResponse();
        stm = resp.GetResponseStream();
        StreamReader r = new StreamReader(stm);
        Response.Write(r.ReadToEnd());
    }
    

    SOAP READER(读取时调用的xml)

    protected void Page_Load(object sender, EventArgs e)
    {
        String Folderpath = "c:\\TestSOAP\\";
        if (!Directory.Exists(Folderpath))
        {
            Directory.CreateDirectory(Folderpath);
        }
        Response.ContentType = "text/xml";
        StreamReader reader = new StreamReader(Request.InputStream);
        String xmlData = reader.ReadToEnd();
        String FilePath = Folderpath + DateTime.Now.ToFileTimeUtc() + ".xml";
        File.WriteAllText(FilePath, xmlData);
    

    }

    下一步是尝试使用SPML服务(这是一个Java驱动的Novell类型的东西) - 如果我有任何问题,我会回发到这里!!

    谢谢大家......:)

1 个答案:

答案 0 :(得分:1)

也许我误解了,但这听起来与我在网络服务中处理网址的方式类似。我们正在处理基于URL的逻辑,执行逻辑,将其包装在XML中并使用XML对象进行响应。这是一个简单的例子(简单来说,我的意思是少数几个不需要身份验证的人)

下面的代码只返回一个包含AppSetting的XML对象。 XML响应也在下面(删除了一些识别值)。

        [OperationContract]
    [WebInvoke(Method = "POST", UriTemplate = "External/Application/{ApplicationGUID}/APIHost/")]
    public Response GetAPIHostName(Request request, string ApplicationGUID)
    {
        Response response = new Response();
        try
        {
            APIHost apiHost = new APIHost
                                          {
                                              APIHostname = System.Configuration.ConfigurationManager.AppSettings["PlayerAPIHostname"]
                                          };
            response.ResponseBody.APIHost = apiHost;
            response.ResponseHeader.UMResponseCode = (int) UMResponseCodes.OK;
        }
        catch (GUIDNotFoundException guidEx)
        {
            response.ResponseHeader.UMResponseCode = (int)UMResponseCodes.NotFound;
            response.ResponseHeader.UMResponseCodeDetail = guidEx.Message;
        }
        catch (Exception ex)
        {
            UMMessageManager.SetExceptionDetails(request, response, ex);
            if (request != null)
                Logger.Log(HttpContext.Current, request.ToString(), ex);
            else
                Logger.Log(HttpContext.Current, "No Request!", ex);
        }
        response.ResponseHeader.HTTPResponseCode = HttpContext.Current.Response.StatusCode;
        return response;
    }

/“xmlns:xsd =”http://www.w3.org/2001/XMLSchema“xmlns:xsi =”http://www.w3.org/2001/XMLSchema-instance“>        200     200                  本地主机