pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

  • <i id='uqIXs'><tr id='uqIXs'><dt id='uqIXs'><q id='uqIXs'><span id='uqIXs'><b id='uqIXs'><form id='uqIXs'><ins id='uqIXs'></ins><ul id='uqIXs'></ul><sub id='uqIXs'></sub></form><legend id='uqIXs'></legend><bdo id='uqIXs'><pre id='uqIXs'><center id='uqIXs'></center></pre></bdo></b><th id='uqIXs'></th></span></q></dt></tr></i><div class="zxp5zdv" id='uqIXs'><tfoot id='uqIXs'></tfoot><dl id='uqIXs'><fieldset id='uqIXs'></fieldset></dl></div>

  • <legend id='uqIXs'><style id='uqIXs'><dir id='uqIXs'><q id='uqIXs'></q></dir></style></legend>

        <tfoot id='uqIXs'></tfoot>

        <small id='uqIXs'></small><noframes id='uqIXs'>

        • <bdo id='uqIXs'></bdo><ul id='uqIXs'></ul>

        如何在沒有 SoapClient 的情況下解析 SOAP 響應(yīng)

        How to parse SOAP response without SoapClient(如何在沒有 SoapClient 的情況下解析 SOAP 響應(yīng))
        <legend id='OieWD'><style id='OieWD'><dir id='OieWD'><q id='OieWD'></q></dir></style></legend>
          <tbody id='OieWD'></tbody>

        <small id='OieWD'></small><noframes id='OieWD'>

          • <bdo id='OieWD'></bdo><ul id='OieWD'></ul>

              1. <tfoot id='OieWD'></tfoot>
                <i id='OieWD'><tr id='OieWD'><dt id='OieWD'><q id='OieWD'><span id='OieWD'><b id='OieWD'><form id='OieWD'><ins id='OieWD'></ins><ul id='OieWD'></ul><sub id='OieWD'></sub></form><legend id='OieWD'></legend><bdo id='OieWD'><pre id='OieWD'><center id='OieWD'></center></pre></bdo></b><th id='OieWD'></th></span></q></dt></tr></i><div class="1p79bn7" id='OieWD'><tfoot id='OieWD'></tfoot><dl id='OieWD'><fieldset id='OieWD'></fieldset></dl></div>

                1. 本文介紹了如何在沒有 SoapClient 的情況下解析 SOAP 響應(yīng)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  限時送ChatGPT賬號..

                  過去幾天我一直在嘗試解析 SOAP 響應(yīng),但我無法讓它工作.我希望能夠獲得所有oproduct"對象.

                  I have spent the last few days trying to parse a SOAP response but I can't get it to work. I would like to be able to get all the "oproduct" objects.

                  我這樣做而不是使用內(nèi)置的 SOAP 客戶端,因為我需要使用 multi_curl 執(zhí)行并行請求.

                  I am doing it this way instead of using the built in SOAP client because I need to do parallel requests using multi_curl.

                  這是我的代碼:

                  $xml = simplexml_load_string($response);
                  $xml->registerXPathNamespace('soap-env', 'http://schemas.xmlsoap.org/soap/envelope/');
                  foreach ($xml->xpath('//oproduct') as $item)
                  {
                    // do something
                  }
                  

                  回復(fù)如下:

                  <soap-env:envelope xmlns:ns1="http://v3.core.com.productserve.com/" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
                    <soap-env:body>
                      <ns1:getproductlistresponse>
                        <oproduct>
                          <iid>113133802</iid>
                          <icategoryid>270</icategoryid>
                          <imerchantid>1547</imerchantid>
                          <iadult>0</iadult>
                          <sname>The Ashes / 5th Test - England v Australia - Day 1</sname>
                          <sawdeeplink>http://www.awin1.com/pclick.php?p=113133802&amp;a=111402&amp;m=1547&amp;platform=cs</sawdeeplink>
                          <sawthumburl>http://images.productserve.com/thumb/1547/113133802.jpg</sawthumburl>
                          <fprice>119.99</fprice>
                        </oproduct>
                        <oproduct>
                          <iid>113133791</iid>
                          <icategoryid>270</icategoryid>
                          <imerchantid>1547</imerchantid>
                          <iadult>0</iadult>
                          <sname>The Ashes / 1st Test - England v Australia - Day 1</sname>
                          <sawdeeplink>http://www.awin1.com/pclick.php?p=113133791&amp;a=111402&amp;m=1547&amp;platform=cs</sawdeeplink>
                          <sawthumburl>http://images.productserve.com/thumb/1547/113133791.jpg</sawthumburl>
                          <fprice>69.99</fprice>
                        </oproduct>
                        <oproduct>
                          <iid>51155349</iid>
                          <icategoryid>428</icategoryid>
                          <imerchantid>513</imerchantid>
                          <iadult>0</iadult>
                          <sname>Rapitest DTM 118 Damp Test Meter</sname>
                          <sawdeeplink>http://www.awin1.com/pclick.php?p=51155349&amp;a=111402&amp;m=513&amp;platform=cs</sawdeeplink>
                          <sawthumburl>http://images.productserve.com/thumb/513/51155349.jpg</sawthumburl>
                          <fprice>18.35</fprice>
                        </oproduct>
                        <oproduct>
                          <iid>187948</iid>
                          <icategoryid>474</icategoryid>
                          <imerchantid>496</imerchantid>
                          <iadult>0</iadult>
                          <sname>Rapitest Dm 10 Electrical Multimeter</sname>
                          <sawdeeplink>http://www.awin1.com/pclick.php?p=187948&amp;a=111402&amp;m=496&amp;platform=cs</sawdeeplink>
                          <sawthumburl>http://images.productserve.com/thumb/496/187948.jpg</sawthumburl>
                          <fprice>26.71</fprice>
                        </oproduct>
                        <oproduct>
                          <iid>51155353</iid>
                          <icategoryid>428</icategoryid>
                          <imerchantid>513</imerchantid>
                          <iadult>0</iadult>
                          <sname>Rapitest DM 10 Electrical Multimeter</sname>
                          <sawdeeplink>http://www.awin1.com/pclick.php?p=51155353&amp;a=111402&amp;m=513&amp;platform=cs</sawdeeplink>
                          <sawthumburl>http://images.productserve.com/thumb/513/51155353.jpg</sawthumburl>
                          <fprice>22.7</fprice>
                        </oproduct>
                        <oproduct>
                          <iid>49152850</iid>
                          <icategoryid>474</icategoryid>
                          <imerchantid>1366</imerchantid>
                          <iadult>0</iadult>
                          <sname>Testboy Profi LED Plus</sname>
                          <sawdeeplink>http://www.awin1.com/pclick.php?p=49152850&amp;a=111402&amp;m=1366&amp;platform=cs</sawdeeplink>
                          <sawthumburl>http://images.productserve.com/thumb/1366/49152850.jpg</sawthumburl>
                          <fprice>44.99</fprice>
                        </oproduct>
                        <oproduct>
                          <iid>51155350</iid>
                          <icategoryid>428</icategoryid>
                          <imerchantid>513</imerchantid>
                          <iadult>0</iadult>
                          <sname>Rapitest ETP 116 Electrical Test Probe</sname>
                          <sawdeeplink>http://www.awin1.com/pclick.php?p=51155350&amp;a=111402&amp;m=513&amp;platform=cs</sawdeeplink>
                          <sawthumburl>http://images.productserve.com/thumb/513/51155350.jpg</sawthumburl>
                          <fprice>17.55</fprice>
                        </oproduct>
                        <oproduct>
                          <iid>51155351</iid>
                          <icategoryid>428</icategoryid>
                          <imerchantid>513</imerchantid>
                          <iadult>0</iadult>
                          <sname>Rapitest ET 111 Electrical Test Meter</sname>
                          <sawdeeplink>http://www.awin1.com/pclick.php?p=51155351&amp;a=111402&amp;m=513&amp;platform=cs</sawdeeplink>
                          <sawthumburl>http://images.productserve.com/thumb/513/51155351.jpg</sawthumburl>
                          <fprice>13.55</fprice>
                        </oproduct>
                        <oproduct>
                          <iid>72326941</iid>
                          <icategoryid>474</icategoryid>
                          <imerchantid>496</imerchantid>
                          <iadult>0</iadult>
                          <sname>Rapitest Etp 116 Electrical Test Probe</sname>
                          <sawdeeplink>http://www.awin1.com/pclick.php?p=72326941&amp;a=111402&amp;m=496&amp;platform=cs</sawdeeplink>
                          <sawthumburl>http://images.productserve.com/thumb/496/72326941.jpg</sawthumburl>
                          <fprice>20.66</fprice>
                        </oproduct>
                        <oproduct>
                          <iid>49338340</iid>
                          <icategoryid>206</icategoryid>
                          <imerchantid>80</imerchantid>
                          <iadult>0</iadult>
                          <sname>Ladies Protest Zekke Jacket True Black</sname>
                          <sawdeeplink>http://www.awin1.com/pclick.php?p=49338340&amp;a=111402&amp;m=80&amp;platform=cs</sawdeeplink>
                          <sawthumburl>http://images.productserve.com/thumb/80/49338340.jpg</sawthumburl>
                          <fprice>54.99</fprice>
                        </oproduct>
                        <itotalcount>6350</itotalcount>
                      </ns1:getproductlistresponse>
                    </soap-env:body>
                  </soap-env:envelope>
                  

                  推薦答案

                  您能否說明您使用的是哪個版本的 PHP(4 或 5)?還有一個特殊的原因為什么您不想/不能使用 PHP 5 的 SOAP 擴展?了解這些信息應(yīng)該有助于我們?yōu)槟峁└玫拇鸢?

                  Could you clarify which version of PHP you're using (4 or 5)? Also is there a particular reason why you don't want to/can't use PHP 5's SOAP extension? Knowing this information should help us to give you a better answer.

                  上面的代碼示例不起作用的原因是您正在查找 oproduct 節(jié)點的錯誤命名空間.雖然根節(jié)點包含在 SOAP 命名空間中,但 oproduct 位于http://v3.core.com.productserve.com/"命名空間下.您還需要在 XPath 查詢中使用名稱空間別名.試試這個,雖然我還沒有測試過:

                  The reason the code sample above isn't working is that you're looking in the wrong namespace for the oproduct nodes. While the root node is contained in the SOAP namespace the oproduct ones are under the "http://v3.core.com.productserve.com/" namespace. You also need to use the namespace alias in the XPath query. Try this, although I haven't tested it:

                  $xml = simplexml_load_string($response);
                  $xml->registerXPathNamespace('ns', 'http://v3.core.com.productserve.com/');
                  foreach ($xml->xpath('//ns:oproduct') as $item)
                  {
                    // do something
                  }
                  

                  希望這能解決您眼前的問題.

                  Hopefully that will solve your immediate problem.

                  編輯感謝您的澄清.同樣,未經(jīng)測試,但也許這會奏效:

                  EDIT Thanks for the clarification. Again, untested but maybe this would work:

                  $xml = simplexml_load_string($response);
                  $xml->registerXPathNamespace('soapenv', 'http://schemas.xmlsoap.org/soap/envelope/');
                  $xml->registerXPathNamespace('ns', 'http://v3.core.com.productserve.com/');
                  foreach ($xml->xpath('/soapenv:envelope/soapenv:body/ns:getproductlistresponse/ns:oproduct') as $item)
                      {
                        // do something
                      }
                  

                  也許您需要在查詢中從根節(jié)點到soap-Env:body 再到oproduct 節(jié)點.希望這會奏效.

                  Perhaps you need to go from the root node to the soap-Env:body to the oproduct nodes in the query. Hopefully that will work.

                  進一步我想我剛剛破解了這個.試試下面的代碼:

                  Further edit: I think I've just cracked this. Try the following code:

                  $xml = simplexml_load_string($response);
                  $ns = $xml->getNamespaces(true);
                  $soap = $xml->children($ns['soap-env']);
                  $getproductlistresponse = $soap->body->children($ns['ns1']);
                  foreach ($getproductlistresponse->children() as $item)
                  {
                    //This example just accesses the iid node but the others are all available.
                    echo (string) $item->iid . '<br />';
                  }
                  

                  不是最漂亮的代碼,但它有效.我希望讓它與 XPath 查詢一起工作,但這超出了我對 XPath 的基本了解.也許其他人可以使用 XPath 發(fā)布答案?

                  Not the prettiest code but it works. I was hoping to get this to work with an XPath query but it was beyond my rudimentary knowledge of XPath. Perhaps someone else can post an answer using XPath?

                  這篇關(guān)于如何在沒有 SoapClient 的情況下解析 SOAP 響應(yīng)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  enable SOAP on PHP(在 PHP 上啟用 SOAP)
                  Get received XML from PHP SOAP Server(從 PHP SOAP 服務(wù)器獲取接收到的 XML)
                  not a valid AllXsd value(不是有效的 AllXsd 值)
                  PHP SoapClient: SoapFault exception Could not connect to host(PHP SoapClient:SoapFault 異常無法連接到主機)
                  Implementation of P_SHA1 algorithm in PHP(PHP中P_SHA1算法的實現(xiàn))
                  Sending a byte array from PHP to WCF(將字節(jié)數(shù)組從 PHP 發(fā)送到 WCF)
                    <tfoot id='UT7WE'></tfoot>

                        <tbody id='UT7WE'></tbody>
                        1. <i id='UT7WE'><tr id='UT7WE'><dt id='UT7WE'><q id='UT7WE'><span id='UT7WE'><b id='UT7WE'><form id='UT7WE'><ins id='UT7WE'></ins><ul id='UT7WE'></ul><sub id='UT7WE'></sub></form><legend id='UT7WE'></legend><bdo id='UT7WE'><pre id='UT7WE'><center id='UT7WE'></center></pre></bdo></b><th id='UT7WE'></th></span></q></dt></tr></i><div class="3zxp1ht" id='UT7WE'><tfoot id='UT7WE'></tfoot><dl id='UT7WE'><fieldset id='UT7WE'></fieldset></dl></div>

                          <small id='UT7WE'></small><noframes id='UT7WE'>

                        2. <legend id='UT7WE'><style id='UT7WE'><dir id='UT7WE'><q id='UT7WE'></q></dir></style></legend>
                            <bdo id='UT7WE'></bdo><ul id='UT7WE'></ul>
                          • 主站蜘蛛池模板: 鹤壁创新仪器公司-全自动量热仪,定硫仪,煤炭测硫仪,灰熔点测定仪,快速自动测氢仪,工业分析仪,煤质化验仪器 | 太空舱_民宿太空舱厂家_移动房屋太空舱价格-豪品建筑 | 岩石钻裂机-液压凿岩机-劈裂机-挖改钻_湖南烈岩科技有限公司 | 工控机-工业平板电脑-研华工控机-研越无风扇嵌入式box工控机 | 提升海外网站流量,增加国外网站访客UV,定制海外IP-访客王 | 超声骨密度仪-动脉硬化检测仪器-人体成分分析仪厂家/品牌/价格_南京科力悦 | 上海物流公司,上海货运公司,上海物流专线-优骐物流公司 | 钢制拖链生产厂家-全封闭钢制拖链-能源钢铝拖链-工程塑料拖链-河北汉洋机械制造有限公司 | 棕刚玉-白刚玉厂家价格_巩义市东翔净水材料厂 | 机床导轨_导轨板_滚轮导轨-上海旻佑精密机械有限公司 | 聚丙烯酰胺PAM-聚合氯化铝PAC-絮凝剂-河南博旭环保科技有限公司 巨野电机维修-水泵维修-巨野县飞宇机电维修有限公司 | 阻垢剂,反渗透阻垢剂,缓蚀阻垢剂-山东普尼奥水处理科技有限公司 真空粉体取样阀,电动楔式闸阀,电动针型阀-耐苛尔(上海)自动化仪表有限公司 | 欧必特空气能-商用空气能热水工程,空气能热水器,超低温空气源热泵生产厂家-湖南欧必特空气能公司 | 苏商学院官网 - 江苏地区唯一一家企业家自办的前瞻型、实操型商学院 | 单级/双级旋片式真空泵厂家,2xz旋片真空泵-浙江台州求精真空泵有限公司 | 杭州厂房降温,车间降温设备,车间通风降温,厂房降温方案,杭州嘉友实业爽风品牌 | 上海小程序开发-上海小程序制作公司-上海网站建设-公众号开发运营-软件外包公司-咏熠科技 | 智能电表|预付费ic卡水电表|nb智能无线远传载波电表-福建百悦信息科技有限公司 | 伺服电机维修、驱动器维修「安川|三菱|松下」伺服维修公司-深圳华创益 | 深圳标识制作公司-标识标牌厂家-深圳广告标识制作-玟璟广告-深圳市玟璟广告有限公司 | 防水套管_柔性防水套管_刚性防水套管-巩义市润达管道设备制造有限公司 | 二维运动混料机,加热型混料机,干粉混料机-南京腾阳干燥设备厂 | 烘箱-工业烘箱-工业电炉-实验室干燥箱 - 苏州华洁烘箱制造有限公司 | 在线钠离子分析仪-硅酸根离子浓度测定仪-油液水分测定仪价格-北京时代新维测控设备有限公司 | 全自动包衣机-无菌分装隔离器-浙江迦南科技股份有限公司 | CE认证_产品欧盟ROHS-REACH检测机构-商通检测 | 昆山新莱洁净应用材料股份有限公司-卫生级蝶阀,无菌取样阀,不锈钢隔膜阀,换向阀,离心泵 | EDLC超级法拉电容器_LIC锂离子超级电容_超级电容模组_软包单体电容电池_轴向薄膜电力电容器_深圳佳名兴电容有限公司_JMX专注中高端品牌电容生产厂家 | 视觉检测设备_自动化检测设备_CCD视觉检测机_外观缺陷检测-瑞智光电 | 手术示教系统-数字化手术室系统-林之硕医疗云智能视频平台 | 礼仪庆典公司,礼仪策划公司,庆典公司,演出公司,演艺公司,年会酒会,生日寿宴,动工仪式,开工仪式,奠基典礼,商务会议,竣工落成,乔迁揭牌,签约启动-东莞市开门红文化传媒有限公司 | 钛板_钛管_钛棒_钛盘管-无锡市盛钛科技有限公司 | 魔方网-培训咨询服务平台| 宜兴紫砂壶知识分享 - 宜兴壶人 医用空气消毒机-医用管路消毒机-工作服消毒柜-成都三康王 | 乙炔气体报警装置|固定式氯化氢检测仪|河南驰诚电气百科 | 淋巴细胞分离液_口腔医疗器材-精欣华医疗器械(无锡)有限公司 | 无锡网站建设-做网站-建网站-网页设计制作-阿凡达建站公司 | 茶楼装修设计_茶馆室内设计效果图_云臻轩茶楼装饰公司 | 品牌设计_VI设计_电影海报设计_包装设计_LOGO设计-Bacross新越品牌顾问 | 仓储货架_南京货架_钢制托盘_仓储笼_隔离网_环球零件盒_诺力液压车_货架-南京一品仓储设备制造公司 | 东莞画册设计_logo/vi设计_品牌包装设计 - 华略品牌设计公司 |