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

  • <legend id='2NmUI'><style id='2NmUI'><dir id='2NmUI'><q id='2NmUI'></q></dir></style></legend>

    <small id='2NmUI'></small><noframes id='2NmUI'>

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

        如何從此xml在php中生成soap請求?

        how to generate a soap request in php from this xml?(如何從此xml在php中生成soap請求?)

          1. <legend id='V6Bhd'><style id='V6Bhd'><dir id='V6Bhd'><q id='V6Bhd'></q></dir></style></legend>
              <bdo id='V6Bhd'></bdo><ul id='V6Bhd'></ul>
                <tbody id='V6Bhd'></tbody>

            • <small id='V6Bhd'></small><noframes id='V6Bhd'>

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

                  本文介紹了如何從此xml在php中生成soap請求?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我厭倦了嘗試使用 SOAP 發送請求.這是我的 xml

                  I'm tired of trying to send a request with SOAP. this is my xml

                  <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:bpf="http://schemas.datacontract.org/2004/07/Bpf.Security.Common" xmlns:bpf1="http://schemas.datacontract.org/2004/07/Bpf.Security.Authentication.Common">
                           <soapenv:Header>
                   <InfoTag xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.w3.org/BaufestProductivityFramework">
                    <ClientIp xmlns="http://schemas.datacontract.org/2004/07/Bpf.Common.Service">200.125.145.10</ClientIp> 
                    <CompanyId xmlns="http://schemas.datacontract.org/2004/07/Bpf.Common.Service">1</CompanyId>
                    <UserName xmlns="http://schemas.datacontract.org/2004/07/Bpf.Common.Service">someUser</UserName> 
                    </InfoTag>
                          </soapenv:Header>
                             <soapenv:Body>
                                <tem:LogIn>         
                                  <tem:token>
                                      <bpf:type>
                                         <bpf1:Description>someDesc</bpf1:Description>
                                         <bpf1:Id>1</bpf1:Id>
                                         <bpf1:Name>someDesc</bpf1:Name>
                                      </bpf:type>
                                      <bpf:password>somePass</bpf:password>
                                      <bpf:userName>someUser</bpf:userName>
                                  </tem:token>
                                </tem:LogIn>
                             </soapenv:Body>
                          </soapenv:Envelope>
                  

                  這個函數發送帶有命名空間的頭部,但不止一個...我必須把它們全部發送?

                  this function send the header with a namespace, but there are more than one... I have to send them all?

                   private function __getHeaders() {
                              $ns = 'http://schemas.xmlsoap.org/soap/envelope/'; //Namespace of the WS. 
                              $ip = $_SERVER['REMOTE_ADDR'];
                      //Body of the Soap Header. 
                              $headerbody = array('ClientIp' => $ip,
                                                  'CompanyId' => 1, 
                                                  'UserName' => 'someUser'
                                                  );
                  
                      //Create Soap Header.        
                              $header = new SOAPHeader($ns, 'InfoTag', $headerbody);
                              return $header;
                          }
                  
                      public function prepareWs(){
                      $wsdl="the web service";
                             $client = new SoapClient($wsdl, array('trace' => true));
                      //Set the Headers of Soap Client. 
                             $header = $this->__getHeaders();
                             $client->__setSoapHeaders($header);
                  

                  我嘗試發送此正文,我檢查了帶有soap錯誤的異常,但該消息僅返回錯誤請求NULL NULL NULL".

                  I try to send this body, I inspected exception with soap fault but the message only returns "bad request NULL NULL NULL".

                  $params = new stdClass();  
                        $params = new SoapVar("<tem:token>
                          <bpf:type xmlns:bpf="http://schemas.datacontract.org/2004/07/Bpf.Security.Common">
                             <bpf1:Description xmlns:bpf1="http://schemas.datacontract.org/2004/07/Bpf.Security.Authentication.Common">someDesc</bpf1:Description>
                             <bpf1:Id xmlns:bpf1="http://schemas.datacontract.org/2004/07/Bpf.Security.Authentication.Common">1</bpf1:Id>
                             <bpf1:Name xmlns:bpf1="http://schemas.datacontract.org/2004/07/Bpf.Security.Authentication.Common">someName</bpf1:Name>
                          </bpf:type>
                          <bpf:password xmlns:bpf="http://schemas.datacontract.org/2004/07/Bpf.Security.Common">somePass</bpf:password>
                          <bpf:userName xmlns:bpf="http://schemas.datacontract.org/2004/07/Bpf.Security.Common">someUser</bpf:userName>
                      </tem:token>", XSD_ANYXML);
                  
                         $response = $client->Login($params);
                  
                  }
                  

                  使用 CURL 我可以發送這個 XML 并收到 XML 響應,但是使用 SOAPClient 我不能發送這個請求.

                  With CURL I can send this XML and recieved the XML response too, but with SOAPClient I can't send this request.

                  希望有人能幫助我,謝謝.

                  I hope someone can help me, thanks.

                  這是我可以用 firebug 看到的代碼,我唯一得到的是錯誤的請求".當我使用 __getLastRequest() 我看到同樣的......我猜不應該正確發送標頭,但是 __setSoapHeaders 函數返回 true.這是輸出:

                  This is the code I can see with firebug, the only thing I get is "bad request". When I use __getLastRequest() I see the same... I guess the headers should not be sent correctly, however the __setSoapHeaders function returns true. This is the output:

                  <soap-env:envelope?xmlns:ns1="http://tempuri.org/"?xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
                  <soap-env:header>
                  <soap-env:contextinformation>
                  <item>
                  <key>ClientIp</key>
                  <value>127.0.0.1</value>
                  </item>
                  <item>
                  <key>CompanyId</key>
                  <value>1</value>
                  </item>
                  <item>
                  <key>UserName</key>
                  <value>someUser</value>
                  </item>
                  </soap-env:contextinformation>
                  </soap-env:header>
                  <soap-env:body>
                  <tem:login>
                  <tem:token>
                  <bpf:type>
                  <bpf1:description>someDesc</bpf1:description>
                  <bpf1:id>1</bpf1:id>
                  <bpf1:name>someName</bpf1:name>
                  </bpf:type>
                  <bpf:password>somePass</bpf:password>
                  <bpf:username>someUser</bpf:username>
                  </tem:token>
                  </tem:login>
                  </soap-env:body>
                  </soap-env:envelope>
                  

                  推薦答案

                  SoapHeader 處理數組相當隨意.如果您想使用數組,請考慮使用 ArrayObject 而不是原生結構.

                  SoapHeader treats arrays rather arbitrarily. If you ever want to use an array, consider using ArrayObject instead of the native construct.

                  但是,您根本不需要數組,因為您只是想在標題中構造單個元素.并且因為您的每個內部元素(例如 ClientIP)都有一個唯一的命名空間,所以您不能只傳入一個基本對象.相反,您必須使用 SoapVar 類為每個元素指定一個特定的命名空間,這允許您將普通 PHP 數據包裝在 SoapClient 可以的SOAP-ready"容器中理解和翻譯.

                  However, you don't need an array at all since you're only trying to construct a single element in your header. And because each of your internal elements (eg. ClientIP) has a unique namespace, you can't just pass in a basic object. Instead, you have to specify a particular namespace for each element using the SoapVar class, which allows you to wrap normal PHP data in a "SOAP-ready" container that SoapClient can understand and translate.

                  $innerNS = "http://www.w3.org/BaufestProductivityFramework";
                  $outerNS = "http://schemas.datacontract.org/2004/07/Bpf.Common.Service";
                  
                  $tag = new stdClass();
                  $tag->ClientIP = new SoapVar("200.125.145.10", XSD_STRING, null, null, null, $innerNS);
                  $tag->CompanyId = new SoapVar(1, XSD_INT, null, null, null, $innerNS);
                  $tag->UserName = new SoapVar("someUser", XSD_STRING, null, null, null, $innerNS);
                  
                  $client->__setSoapHeaders(new SoapHeader($outerNS, 'InfoTag', $tag));
                  

                  最后,作為一項規則,不要手動編寫 XML! 考慮像此處顯示的標頭代碼那樣重新編寫 SOAP 主體代碼.您應該能夠專門處理 XML 的內容,而不是它的結構.

                  Finally, as a rule, don't manually write XML! Consider re-writing your SOAP body code like the header code shown here. You ought to be able to deal specifically with the content of the XML, not its structure.

                  這篇關于如何從此xml在php中生成soap請求?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  enable SOAP on PHP(在 PHP 上啟用 SOAP)
                  Get received XML from PHP SOAP Server(從 PHP SOAP 服務器獲取接收到的 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算法的實現)
                  Sending a byte array from PHP to WCF(將字節數組從 PHP 發送到 WCF)

                    <tbody id='pGrgt'></tbody>
                  • <bdo id='pGrgt'></bdo><ul id='pGrgt'></ul>

                      • <tfoot id='pGrgt'></tfoot>

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

                          <legend id='pGrgt'><style id='pGrgt'><dir id='pGrgt'><q id='pGrgt'></q></dir></style></legend>

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

                            主站蜘蛛池模板: 飞飞影视_热门电影在线观看_影视大全 | 湖南自考_湖南自学考试| 河南橡胶接头厂家,河南波纹补偿器厂家,河南可曲挠橡胶软连接,河南套筒补偿器厂家-河南正大阀门 | 深圳办公室装修-写字楼装修设计-深圳标榜装饰公司 | 济南网站策划设计_自适应网站制作_H5企业网站搭建_济南外贸网站制作公司_锐尚 | 玻璃钢格栅盖板|玻璃钢盖板|玻璃钢格栅板|树篦子-长沙川皖玻璃钢制品有限公司 | 知企服务-企业综合服务(ZiKeys.com)-品优低价、种类齐全、过程管理透明、速度快捷高效、放心服务,知企专家! | 安徽华耐泵阀有限公司-官方网站 安德建奇火花机-阿奇夏米尔慢走丝|高维|发那科-北京杰森柏汇 | 运动木地板厂家,篮球场木地板品牌,体育场馆木地板安装 - 欧氏运动地板 | 学习安徽网| 沈阳真空机_沈阳真空包装机_沈阳大米真空包装机-沈阳海鹞真空包装机械有限公司 | 盐水蒸发器,水洗盐设备,冷凝结晶切片机,转鼓切片机,絮凝剂加药系统-无锡瑞司恩机械有限公司 | 聚合甘油__盐城市飞龙油脂有限公司| 有声小说,听书,听小说资源库-听世界网| 今日扫码_溯源二维码_产品防伪一物一码_红包墙营销方案 | 纸塑分离机-纸塑分离清洗机设备-压力筛-碎浆机厂家金双联环保 | 无菌水质袋-NASCO食品无菌袋-Whirl-Pak无菌采样袋-深圳市慧普德贸易有限公司 | 油冷式_微型_TDY电动滚筒_外装_外置式电动滚筒厂家-淄博秉泓机械有限公司 | 液压压力机,液压折弯机,液压剪板机,模锻液压机-鲁南新力机床有限公司 | 华禹护栏|锌钢护栏_阳台护栏_护栏厂家-华禹专注阳台护栏、楼梯栏杆、百叶窗、空调架、基坑护栏、道路护栏等锌钢护栏产品的生产销售。 | 定量包装机,颗粒定量包装机,粉剂定量包装机,背封颗粒包装机,定量灌装机-上海铸衡电子科技有限公司 | 膜结构_ETFE膜结构_膜结构厂家_膜结构设计-深圳市烨兴智能空间技术有限公司 | 印刷人才网 印刷、包装、造纸,中国80%的印刷企业人才招聘选印刷人才网! | 热处理炉-退火炉-回火炉设备厂家-丹阳市电炉厂有限公司 | 517瓜水果特产网|一个专注特产好物的网站 | 阻燃剂-氢氧化镁-氢氧化铝-沥青阻燃剂-合肥皖燃新材料 | 湖南成人高考报名-湖南成考网 | 青岛球场围网,青岛车间隔离网,青岛机器人围栏,青岛水源地围网,青岛围网,青岛隔离栅-青岛晟腾金属制品有限公司 | 高尔夫球杆_高尔夫果岭_高尔夫用品-深圳市新高品体育用品有限公司 | 洗砂机械-球磨制砂机-洗沙制砂机械设备_青州冠诚重工机械有限公司 | 儿童语言障碍训练-武汉优佳加感统文化发展有限公司 | 合肥防火门窗/隔断_合肥防火卷帘门厂家_安徽耐火窗_良万消防设备有限公司 | 聚合氯化铝厂家-聚合氯化铝铁价格-河南洁康环保科技 | 气动隔膜泵-电动隔膜泵-循环热水泵-液下排污/螺杆/管道/化工泵「厂家」浙江绿邦 | 氨水-液氨-工业氨水-氨水生产厂家-辽宁顺程化工 | 空压机网_《压缩机》杂志| 12cr1mov无缝钢管切割-15crmog无缝钢管切割-40cr无缝钢管切割-42crmo无缝钢管切割-Q345B无缝钢管切割-45#无缝钢管切割 - 聊城宽达钢管有限公司 | 电伴热系统施工_仪表电伴热保温箱厂家_沃安电伴热管缆工业技术(济南)有限公司 | 窖井盖锯圆机_锯圆机金刚石锯片-无锡茂达金刚石有限公司 | 无线联网门锁|校园联网门锁|学校智能门锁|公租房智能门锁|保障房管理系统-KEENZY中科易安 | 欧必特空气能-商用空气能热水工程,空气能热水器,超低温空气源热泵生产厂家-湖南欧必特空气能公司 |