- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我必须在 Windows Phone 8 应用程序上使用网络服务 (WSDL),但它在 VS2012 中不起作用。
例如:
http://chennaiemergency.co.in/sree/s2.php?wsdl
添加了服务,但是在reference.cs中没有关于我操作的任何内容...
还有其他方法可以使用我的 wsdl 吗?
最佳答案
我找到的解决此问题的最佳方法是手动发送 SOAP 请求。 SOAP 和 wsdl 与 WP 的兼容性不是很好。如果可以选择,可以为您的 Web 服务选择 WCF。我在 Windows 窗体应用程序中的 soap 请求代码(在 WP 项目中,您必须使用异步方法 -> beginGetRequestStream() & beginGetResponse() 。msdn 上有很多关于此的文档):
// Building of my XML
XNamespace env = "http://schemas.xmlsoap.org/soap/envelope/";
XNamespace xsd = "http://www.w3.org/2001/XMLSchema";
XNamespace xsi = "http://www.w3.org/2001/XMLSchema-instance";
XNamespace enc = "http://schemas.xmlsoap.org/soap/encoding/";
XNamespace typens = "urn:...";
XNamespace xsiType = "xsd:string";
XElement soapEnv = new XElement(env + "Envelope",
new XAttribute(XNamespace.Xmlns + "SOAP-ENV",env.NamespaceName),
new XAttribute(XNamespace.Xmlns + "xsd", xsd.NamespaceName),
new XAttribute(XNamespace.Xmlns + "xsi", xsi.NamespaceName),
new XElement(env + "Body",
new XAttribute(env + "encodingStyle",enc.NamespaceName),
new XElement(typens + "MethodName",
new XAttribute(XNamespace.Xmlns + "typens",typens.NamespaceName),
new XElement("elementName",
new XAttribute(xsi + "type",xsiType.NamespaceName), "...value"),
new XElement("elementName",
new XAttribute(xsi + "type",xsiType.NamespaceName),"...value"),
new XElement("elementName",
new XAttribute(xsi + "type",xsiType.NamespaceName),"...value")
)));
// HTTPWEBREQUEST
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create("...url...");
webRequest.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
webRequest.Method = "POST";
webRequest.KeepAlive = false;
webRequest.ContentType = "text/xml; charset=utf-8";
webRequest.CookieContainer = new CookieContainer();
webRequest.Headers.Add("SOAPAction", "...webservice link...");
webRequest.ProtocolVersion = new Version(1,1);
webRequest.Timeout = 1000;
using (StreamWriter stream = new StreamWriter(webRequest.GetRequestStream()))
{
stream.Write(soapEnv);
stream.Flush();
stream.Close();
}
using (HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse())
{
using (StreamReader responseReader = new StreamReader(webResponse.GetResponseStream()))
{
if (responseReader != null)
{
.....code....
webResponse.Close();
}
}
}
关于c# - WSDL 与 Windows Phone 8 兼容吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14634902/
我开发了一个使用 mspn 服务的 windows phone 应用程序。它在 Windows 手机模拟器上运行良好。现在我想在 Windows Phone 设备中测试它。我有一个 Windows P
我正在考虑针对 Windows Phone 7 进行开发。为了测试我的应用程序,我需要能够模拟电话调用。在模拟器中可以吗? 最佳答案 不,不可能模拟您的应用程序被接收到的电话中断。还宣布为 the R
我看到 Windows Phone 8 支持 Windows Phone 7 应用程序。我在 Windows Phone 7 上开发了一些应用程序,我想在 Windows Phone 8 模拟器上运行
我正在Windows 8上使用Visual Studio2013。我有三个Windows Phone设备,lumia 620、920、1320,这些都是开发人员解锁的设备。 620设备已安装Windo
非常直接的问题。我的公司开发了一个 windows phone 7 应用程序,并一直在 windows phone 7 设备上对其进行测试。我们能否安全地假设同一个应用程序将向后兼容并在 Window
标题几乎概括了它。我已经编写了一个 Windows Phone 7 应用程序,现在我想将它部署到 Windows Phone 8 设备 (HTC Windows Phone 8X)。我已经注册并解锁了
我一直在开发 Windows Phone 8 应用程序,现在我想将其更改为 Windows Phone 8.1。我该怎么做? 是否应该创建一个新的 Windows Phone 8.1 应用并将所有现有
我有一个针对 Windows Phone 8 的应用程序。现在我想使用 this compression library其中指出: Supported Platforms: .NET Framewor
有什么区别Windows Phone 7.1 (NoDo) 和 Windows Phone 7.5 (芒果) ? 我已经为 Mango 安装了 SDK,但是当我尝试创建一个项目时,它显示为 7.1 版
我最近更新了我的 Visual Studio 2013,现在它允许开发 Windows Phone 8.1 应用程序。 但是现在,当我创建一个 Windows Phone 项目时,它是针对 WP 8.
我最近购买了 Lumia 630 双 SIM 卡,并一直在尝试注册我的手机以进行开发,但一直收到此错误“无法连接到手机。请确保通过 USB 传输服务的 Windows Phone IP 正在运行”。
我正在尝试使用 documentation from MSDN 在我现有的 Windows Phone OS 7.1 应用程序中支持新的 Windows Phone 磁贴功能。 .但是,我似乎无法通过
我在搜索如何启动Windows Phone 10模拟器时迷路了。 我已经做了: 我下载并安装了仿真器镜像(我知道flash.vhd文件的位置) 我正在运行Windows 8.1 x64专业版。 Hyp
我想制作像图片一样的动态磁贴。我该怎么做? 最佳答案 上面创建的图 block 很可能是在服务器端创建的。据说 Windows Phone 7.1 和 Windows Phone 8 之间发生了很多变
我刚刚将它安装在我的 Windows 8 上。它不是在 VM 上运行,而是在带有 bootcamp 的 macbook 上运行。 当我尝试模拟我的应用程序时,出现第一个错误: 但是后来我单击“重试”并
Microsoft 刚刚发布了结合了 Windows 8.1 和 Windows Phone 8.1 的 Windows App 8.1,因此您可以创建一个通用的应用程序。但是,将 Microsoft
是否有可用于WP7的日历控件(不是日期选择器和时间选择器)? 最佳答案 我还在CodePlex上启动了新项目。我刚刚研究了日历控件的Alpha版本。 http://wpcontrols.codeple
我在XAML中有一个文本框: .cs文件声明了以下事件: private void blah_OnKeyDown(object sender, KeyEventArgs e) {
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 8 年前。 Improve this qu
我正在为Windows Phone 7创建一个多人游戏。如何调试模拟器的多个实例以便对其进行调试? 最佳答案 实际上,您可以同时运行Windows Phone 7模拟器的多个实例,甚至可以同时调试它们
我是一名优秀的程序员,十分优秀!