【问题标题】:SPML (service provisioning markup language) / C#.Net help please!SPML(服务供应标记语言)/ C#.Net 请帮助!
【发布时间】:2010-11-03 16:06:20
【问题描述】:

很抱歉在这里实际上是在乞求帮助,但我的任务是处理上述问题,但找不到任何足够的资源来帮助我。详情如下:

  1. 公司拥有身份管理软件,可提供对用户实体的更改的 SPML (SOAP)“提要”

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

  3. 该 URL 下的任何内容都必须处理发布的信息 (XML)

第 3 点是我的观点。我不知道该写什么。 asmx? ASP?阿什? Commodore 64 盒式磁带?显然 SPML 驱动程序需要一个 200 响应 - 无论如何,当处理发生时它会得到它,不是吗?还有什么我没有得到的吗?

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

谢谢。

编辑........

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

SOAP 驱动程序(适用于页面加载)

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 类型的东西)——如果我有任何问题,我会在这里回复!!

谢谢大家.. :)

【问题讨论】:

    标签: c# .net soap spml


    【解决方案1】:

    也许我理解错了,但这听起来与我在 Web 服务中处理 URL 的方式相似。我们正在处理基于 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 本地主机

    【讨论】:

    • 看起来我的 xml 粘贴被解析了......对此很抱歉,但一般的想法是使用 URL 指向正确的方法,执行逻辑(无论是对数据的请求还是请求动作)并以 xml 包装的响应进行响应。在这种情况下,xml 响应仅在标头中包含几个 ResponseCode 对象,并且 responseBody 包含自动包装和返回的 APIHostname 对象。
    • (忽略 ApplicationGUID 参数)
    • 谢谢 J - 这让我进展顺利。到目前为止,我已经设法设置了一个“测试 SOAP 驱动程序”,该驱动程序在另一端由一个简单的 aspx 页面读取。我现在将代码作为编辑发布... :)
    • 见鬼,如果我早点看到你是托雷斯的粉丝,我可能不会回应哈哈……开玩笑,很高兴听到我能提供帮助(去切尔西)
    • 他的臂章证明他是红人...... 2,他的银行账户证明他是俄罗斯石油亿万富翁...... 0:P
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-09-16
    • 1970-01-01
    • 2020-07-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多