我在tomcat上使用JAX-WS运行Java Document Literal WebService,网络使用HTTPS。 Java& .Net WS客户端工作正常,而iOS上的MonoTouch客户端在WebService响应期间抛出异常。我已经检查过请求在服务器上被正确命中但是返回到MonoTouch客户端的响应会在随机WebService响应上抛出以下异常(某些响应成功):
[System.Xml.XmlException: Document element did not appear. Line 1, position 1.
at Mono.Xml2.XmlTextReader.Read () [0x00168] in /Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml/XmlTextReader.cs:629
at System.Xml.XmlTextReader.Read () [0x0006b] in /Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml/XmlTextReader2.cs:564
at System.Xml.XmlReader.MoveToContent () [0x00050] in /Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml/XmlReader.cs:563
at System.Web.Services.Protocols.WebServiceHelper.ReadSoapMessage (System.Xml.XmlTextReader xmlReader, System.Xml.Serialization.XmlSerializer bodySerializer, System.Xml.Serialization.XmlSerializer headerSerializer, Boolean soap12, System.Object& body, System.Web.Services.Protocols.SoapHeaderCollection& headers) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHelper.cs:187
at System.Web.Services.Protocols.WebServiceHelper.ReadSoapMessage (System.Xml.XmlTextReader xmlReader, System.Web.Services.Protocols.SoapMethodStubInfo method, SoapHeaderDirection dir, Boolean soap12, System.Object& body, System.Web.Services.Protocols.SoapHeaderCollection& headers) [0x00011] in /Developer/MonoTouch/Source/mono/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHelper.cs:182
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReceiveResponse (System.Net.WebResponse response, System.Web.Services.Protocols.SoapClientMessage message, System.Web.Services.Protocols.SoapExtension[] extensions) [0x00149] in /Developer/MonoTouch/Source/mono/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHttpClientProtocol.cs:322
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke (System.String method_name, System.Object[] parameters) [0x000b8] in /Developer/MonoTouch/Source/mono/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHttpClientProtocol.cs:379
在iOS客户端,我们正在监控网络流量并通过对等方获得所有响应的连接重置,即使某些响应正在恢复正常。
任何帮助?
答案 0 :(得分:1)
看起来您没有收到有效的XML响应。可能是服务不喜欢您的请求并返回(HTML)错误消息(例如500)。
查看正在发生的事情的简单方法是使用WireShark(或类似的工具来嗅探网络流量)并从iOS模拟器运行应用程序。捕获的数据应显示您的请求和服务器的响应。这将告诉您确定它是否是XML响应,或者如果不是,则会告诉您正在返回的错误消息。