.NET 服务(使用 php)解析(soap)结果时出现问题
我在使用 PHP 连接 .NET Soap 服务器时遇到了一些问题。 我也在 StackOverflow 以及 google 上进行了一些搜索,但找不到解决方案/相同的问题。
事情是这样的。 我正在尝试从服务器获取一些数据。请求进展顺利,但响应似乎无效。
响应仅包含该对象中的一个对象元素“any”。显示原始 xml/xsd 数据。
我也尝试使用不同的方法(如 simple_xml 和 domdocument)自己解析它,但结果是“无效的数据/xml”
有人遇到这个问题或有正确的解决方案吗?
您将在下面找到请求的“结果”转储),如果需要更多数据,请询问。
干杯 塞巴斯蒂安
GetArticleListResult Object
(
[any] => <xs:schema xmlns:mstns="www.rentplus.be/webservices/ArticleList.xsd" xmlns="www.rentplus.be/webservices/ArticleList.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="dsArticleList" targetNamespace="www.rentplus.be/webservices/ArticleList.xsd" attributeFormDefault="qualified" elementFormDefault="qualified"><xs:element name="dsArticleList" msdata:IsDataSet="true" msdata:UseCurrentLocale="true"><xs:complexType><xs:choice minOccurs="0" maxOccurs="unbounded"><xs:element name="ArticleList"><xs:complexType><xs:sequence><xs:element name="Article_Key" type="xs:string" minOccurs="0"/><xs:element name="Warehouse_Number" type="xs:string" minOccurs="0"/><xs:element name="Date_Creation" type="xs:dateTime" minOccurs="0"/><xs:element name="Date_Last_Modification" type="xs:dateTime" minOccurs="0"/></xs:sequence></xs:complexType></xs:element></xs:choice></xs:complexType></xs:element></xs:schema><diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1"><dsArticleList xmlns="www.rentplus.be/webservices/ArticleList.xsd"><ArticleList diffgr:id="ArticleList1" msdata:rowOrder="0" diffgr:hasChanges="inserted"><Article_Key>GELUM-LE400</Article_Key><Warehouse_Number>01</Warehouse_Number><Date_Creation>0001-01-01T00:00:00+01:00</Date_Creation><Date_Last_Modification>2011-08-10T00:00:00+02:00</Date_Last_Modification></ArticleList></dsArticleList></diffgr:diffgram>
)
I'm running into some problems while connecting with a .NET soap server with PHP.
I've run some searches on StackOverflow as well on google, but couldn't find a solution/ same problem.
Here's the thing.
I'm trying to obtain some data from a server. The requests goes well, however the response seems to be invalid.
The response contains only one object element "any" in this object. Raw xml / xsd data is shown.
I've also tried to parse it myself using different methods (as simple_xml & domdocument) however the result is "invalid data/xml"
Has anyone run into this problem or have a proper solution.?
Below you'll find the "result" dump) of the request, if more data is needed please ask.
Cheers
Sebastiaan
GetArticleListResult Object
(
[any] => <xs:schema xmlns:mstns="www.rentplus.be/webservices/ArticleList.xsd" xmlns="www.rentplus.be/webservices/ArticleList.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="dsArticleList" targetNamespace="www.rentplus.be/webservices/ArticleList.xsd" attributeFormDefault="qualified" elementFormDefault="qualified"><xs:element name="dsArticleList" msdata:IsDataSet="true" msdata:UseCurrentLocale="true"><xs:complexType><xs:choice minOccurs="0" maxOccurs="unbounded"><xs:element name="ArticleList"><xs:complexType><xs:sequence><xs:element name="Article_Key" type="xs:string" minOccurs="0"/><xs:element name="Warehouse_Number" type="xs:string" minOccurs="0"/><xs:element name="Date_Creation" type="xs:dateTime" minOccurs="0"/><xs:element name="Date_Last_Modification" type="xs:dateTime" minOccurs="0"/></xs:sequence></xs:complexType></xs:element></xs:choice></xs:complexType></xs:element></xs:schema><diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1"><dsArticleList xmlns="www.rentplus.be/webservices/ArticleList.xsd"><ArticleList diffgr:id="ArticleList1" msdata:rowOrder="0" diffgr:hasChanges="inserted"><Article_Key>GELUM-LE400</Article_Key><Warehouse_Number>01</Warehouse_Number><Date_Creation>0001-01-01T00:00:00+01:00</Date_Creation><Date_Last_Modification>2011-08-10T00:00:00+02:00</Date_Last_Modification></ArticleList></dsArticleList></diffgr:diffgram>
)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我刚刚自己解决了这个问题。我对 XML 和 SOAP 知之甚少,但根据我所做的研究,默认的 .net Web 服务使命名空间和其他包装器变得混乱。此外,php肥皂客户端使情况变得更糟并且无法创建正确的对象。您得到的响应是 1/2 对象和 1/2 XML。没有道理吧!
好吧,我加载了对象的“任何”元素并将其加载到 a
现在您已经从 Visual Studio .net Web 服务中检索到了您想要的信息。简单,对吧!
I just solved this issue myself. I know very little about XML and SOAP, but from the research I did, the default .net web-services makes a mess with namespaces and other wrappers. Further, the php soap client makes it worse and fails to make a proper object. The response you get is 1/2 object and 1/2 XML. Make no sense, right!
Well, I load the "any" element of the object and loaded it into a
And now your have retrieved the information that you wanted from the visual studio .net webserivce. easy, right!!
下面我介绍如何处理 SOAP 请求和响应。您将获得包含数据的
Object
,因此Object->any
如下所示:Below I present how I handle SOAP request and response. You are getting
Object
containingany
containing your data, so doObject->any
like so: