【问题标题】:iOS app that can retrieve database query output from web service?可以从 Web 服务检索数据库查询输出的 iOS 应用程序?
【发布时间】:2015-12-17 16:56:33
【问题描述】:

我不是开发人员,所以请像我五岁一样解释它。不必详细说明,只需指出一个方向,我将在接下来的 2-4 周空闲时间(希望)尝试完成它。

我们的零售系统在 UniData 数据库上运行,命令包括“listuser”“kill __”等。

我们有一个可以在外部看到的网络服务。

我想制作一个基本的 iOS 应用程序,它可以“列出用户”并查看已连接用户的输出、通读列表并输入用户名,然后通过 Web 服务将“kill ___”命令发送回我们的服务器.

我使用 listuser 命令创建了一个批处理文件,然后编写了一些将输出传递到 XML 文档的 C# 代码,我只想能够触发它并从我的 iOS 应用程序加载 XML。

public XmlDocument ListUnidataUser(string VisibleStores)
    {
         Process p = new Process();
        // Redirect the output stream of the child process.
        p.StartInfo.UseShellExecute = false;
        p.StartInfo.RedirectStandardOutput = true;
        p.StartInfo.FileName = @"\\server\c$\ud\listuser.bat";
        p.Start();
            // Do not wait for the child process to exit before
            // reading to the end of its redirected stream.
            // p.WaitForExit();
            // Read the output stream first and then wait.
        string output = p.StandardOutput.ReadToEnd();
        XmlDocument xml = new XmlDocument();
        xml.LoadXml(output);
        p.WaitForExit();
        return xml;            
    }

在这之后,我不知道自己在做什么。这进入我们的 Web 服务,它可以看到这些本地服务器,然后 Web 服务保存该 XML。如何从外部应用建立连接?

如果它更容易学习,我不介意首先尝试制作可以在外部运行的 C# 代码来获取它,并使用 Xamarin 之类的服务为 iOS 编译它,但我很好奇自己的方式Xcode 周围也是如此。

请不要激怒我,我可以听到吉米在我的编码方法中沙沙作响。

【问题讨论】:

    标签: c# ios xml web-services


    【解决方案1】:

    学习新东西总是好的,我个人认为 iOS 框架确实有一个很好的结构 - 祝你好运。

    至于你的问题:

    如果可能,请不要将 XML 用作数据协议 - 移动框架在解释 JSON 方面要好得多,它甚至可以集成到语言本身中(例如 NSJSONSerializer),或者您可以获得很好的库。

    要联系您的 Web 服务,请查看 NSURLSession,或者,如果您更喜欢功能更多的库,请查看 AFNetworking(如果您使用的是 Swift,请查看 AlamoFire

    一般来说,请查看 Ray Wenderlich 网站上的一些教程 - 它们非常适合学习 iOS 开发,例如 AlamoFire 上的教程。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多