更改php中的soap前缀
我正在将一个soap web 服务从.net 重写为php。默认情况下,php 给我的标签看起来像这样:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org/"><SOAP-ENV:Header><ns1:FindAllCategories/></SOAP-ENV:Header><SOAP-ENV:Body><ns1:FindAllCategoriesResponse><ns1:FindAllCategoriesResult><ns1:ArtistCategoryDto>
等等...
但我需要这个:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><FindAllCategoriesResponse xmlns="http://tempuri.org/"><FindAllCategoriesResult><ArtistCategoryDto>
这与这里的问题类似: PHP 和 SOAP。改变信封但是我不想像他那样破解它。另外,我正在创建一个肥皂服务,该服务将由现有的 iPhone 应用程序使用,而不是使用 PHP 使用 SoapClient 来使用肥皂服务。 iPhone 应用程序只是解析原始 xml,我现在无法更改 iPhone 应用程序。
i'm rewriting a soap web service from .net to php. by default, php is giving me tags that look like this:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org/"><SOAP-ENV:Header><ns1:FindAllCategories/></SOAP-ENV:Header><SOAP-ENV:Body><ns1:FindAllCategoriesResponse><ns1:FindAllCategoriesResult><ns1:ArtistCategoryDto>
etc...
but i need this:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><FindAllCategoriesResponse xmlns="http://tempuri.org/"><FindAllCategoriesResult><ArtistCategoryDto>
This is similar to the question here: PHP AND SOAP. Change envelope however i'd like to not hack it the way he did. Also, i am creating a soap service that will be consumed by an existing iphone app, not using PHP to consume a soap service using SoapClient. The iphone app just parses the raw xml and i can't change the iphone app right now.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
重新阅读您想要的内容并搜索 php 文档后,这里是我的解决方案和我所做的几个假设
假设
您想要什么?
解决方案
这应该可以解决问题,我还没有创建正则表达式部分或实际的 xlm 节点替换,但我认为你可以自己做
After re-reading what it is you want and searching through the php documentation here is my solution and a couple of assumptions that I made
Assumptions
What do you want?
Solution
This should do the trick, I haven't created the regex part or the actual xlm node replacement but I figure you can do that yourself
如果您不想使用正则表达式,我已经完成了这个快速类实现,它使用 DomXPath 和 DomDocument 来清理 XML 并在节点级别附加名称空间属性。
If you don't want to use Regular expressions, I've done this quick class implementation which uses DomXPath and DomDocument to cleanup the XML and append the namespace attribute at the node level.