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

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

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

      <tfoot id='HhBer'></tfoot>
      • <bdo id='HhBer'></bdo><ul id='HhBer'></ul>
    1. <small id='HhBer'></small><noframes id='HhBer'>

      PHP SoapClient 和復雜的標頭

      PHP SoapClient and a complex header(PHP SoapClient 和復雜的標頭)
          <bdo id='cubHv'></bdo><ul id='cubHv'></ul>

            1. <tfoot id='cubHv'></tfoot>

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

              1. <small id='cubHv'></small><noframes id='cubHv'>

                  <tbody id='cubHv'></tbody>
                <legend id='cubHv'><style id='cubHv'><dir id='cubHv'><q id='cubHv'></q></dir></style></legend>

                本文介紹了PHP SoapClient 和復雜的標頭的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                限時送ChatGPT賬號..

                我已經嘗試了一段時間,但我不知道如何將 PHP SoapCLient 與 WSDL 結合使用以形成復雜的標頭(也就是說,比我能找到的任何教程都復雜).我需要發送的信封是這樣的:

                I have been trying for a while now, but I can't figure out how to use PHP SoapCLient in combination with a WSDL to form a complex header (that is, more complex than any tutorial I could find). The envelope that I need to send looks like this:

                (001) <?xml version='1.0' encoding='UTF-8'?>
                
                (002) <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xlink="http://www.w3.org/1999/xlink">
                
                (003) <SOAP-ENV:Header>
                
                (004) <eb:MessageHeader xmlns:eb="http://www.ebxml.org/namespaces/messageHeader" eb:version="2.0" SOAP-ENV:mustUnderstand="1">
                
                (005) <eb:From>
                
                (006) <eb:PartyId>webservices.example.com</eb:PartyId> 
                
                (007) </eb:From>
                
                (008) <eb:To>
                
                (009) <eb:PartyId>clientURL</eb:PartyId> 
                
                (010) </eb:To>
                
                (011) <eb:CPAId>IPCC</eb:CPAId> 
                
                (012) <eb:ConversationId>ABC123@clientURL.com</eb:ConversationId> 
                
                (013) <eb:Service eb:type="XML">Session</eb:Service> 
                
                (014) <eb:Action>SessionCreateRS</eb:Action> 
                
                (015) <eb:MessageData>
                
                (016) <eb:MessageId>mid:20030707-12545-1369@webservices.sabre.com</eb:MessageId> 
                
                (017) <eb:Timestamp>2001-02-15T11:25:12Z</eb:Timestamp> 
                
                (018) </eb:MessageData>
                
                (019) <RefToMessageId>mid:20001209-133003-2333@clientURL</RefToMessageId> 
                
                (020) </eb:MessageHeader>
                
                (021) <wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext">
                
                (022) <wsse:BinarySecurityToken xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/12/utility" wsu:Id="SabreSecurityToken" valueType="String" EncodingType="wsse:Base64Binary">Shared/IDL:IceSess/SessMgr:1.0.IDL/Common/!ICESMS/RESC!ICESMSLB/RES.LB!-4954987477210575357!252506!0</wsse:BinarySecurityToken> 
                
                (023) </wsse:Security>
                
                (024) </SOAP-ENV:Header>
                
                (025) <SOAP-ENV:Body>
                
                (026) <eb:Manifest xmlns:eb="http://www.ebxml.org/namespaces/messageHeader" eb:version="2.0">
                
                (027) <eb:Reference eb:id="SessionCreateRS" xlink:type="simple" xlink:href="cid:SessionCreateRS"
                
                (028) <eb:Description xml:lang="en-US">Response Message</eb:Description>"/>
                
                (029) </eb:Reference>
                
                (030) </eb:Manifest>
                
                (031) </SOAP-ENV:Body>
                
                (032) </SOAP-ENV:Envelope>
                

                我嘗試使用 __setSoapHeaders() 和 SoapVar() 來實現它.雖然我無法獲得正確的輸出.從例子中我了解到使用類來填充 XML 中的參數會很好,所以我做了一個這樣的類:

                I tried to make it using __setSoapHeaders() and using SoapVar(). I can't get the right output though. From examples I learned it would be good to use a class to fill the parameters in the XML, so I made an class like this:

                class EbXmlMessage{
                 public $From = array('PartyId' => 'www.example.com@example.com');
                 public $To = array('PartyId' => 'example.com');
                 public $CPAId = 'XXXX';
                 public $ConversationId = '12345@example.com';
                 public $Service = 'Session';
                 public $Action = 'SessionCreateRQ';
                 public $MessageData = array( 'MessageId' => "mid:12345@example.com",'Timestamp' => '2010-11-26T08:19:00Z');
                }
                

                比我使用的:

                $eb_params = new SoapVar($eb,SOAP_ENC_OBJECT);
                $header =  new SoapHeader($ns,"header", $eb_params,true);
                

                但是該請求甚至沒有看起來像必須的那樣:

                But the request does not even slightly begin to look like it has to:

                <?xml version="1.0" encoding="UTF-8"?>
                <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.opentravel.org/OTA/2002/11" xmlns:ns2="https://cert.webservices.sabre.com/cert">
                 <SOAP-ENV:Header>
                  <ns2:header SOAP-ENV:mustUnderstand="1">
                   <From>
                    <item>
                     <key>PartyId</key>
                     <value>www.example.com@example.com</value>
                    </item>
                   </From>
                   <To>
                    <item>
                     <key>PartyId</key>
                     <value>webservices.sabre.com</value>
                    </item>
                   </To>
                   <CPAId>XXX</CPAId>
                   <ConversationId>12345@example.com</ConversationId>
                   <Service>Session</Service>
                   <Action>SessionCreateRQ</Action>
                   <MessageData>
                    <item>
                     <key>MessageId</key>
                     <value>mid:12345@www.example.com</value>
                    </item>
                    <item>
                     <key>Timestamp</key>
                     <value>2010-11-26T08:19:00Z</value>
                    </item>
                   </MessageData>
                  </ns2:header>
                 </SOAP-ENV:Header>
                 <SOAP-ENV:Body>
                  <ns1:SessionCreateRQ>
                   <ns1:POS>
                    <ns1:Source PseudoCityCode="XXXX"/>
                   </ns1:POS>
                  </ns1:SessionCreateRQ>
                  <param1/>
                 </SOAP-ENV:Body>
                </SOAP-ENV:Envelope
                

                目前的主要問題是在正確的位置獲取 XML 中正確的標簽,我不知道如何在標簽中獲取eb:"和wsse:"命名空間.我希望使用 SoapClientI() 類,但我不確定它是否可以處理像我需要的那樣更復雜的 XML,如果不能,也許我應該使用 Curl 或類似的東西并將 XML 視為字符串?

                The main problems so far are getting the right tags in the XML on the right place, and I don't know how I can get "eb:" and "wsse:" namespace in the tags. I am hoping to use the SoapClientI() class but I'm not sure if it can handle a more complex XML like the one I need, if not maybe I should use Curl or something similar and just treat the XML as a string?

                推薦答案

                我在實施 wsse 時也遇到了這個問題.這是我的方法.是的,這是特定于 wsse 的;但是,它也應該適用于您的上下文.請特別注意在對 new SoapHeader() 的調用中如何使用 'wsse' 命名空間參數.只需將其替換為 'eb' 即可.

                I had issues with this as well when implementing wsse. Here was my approach. Yes, this is quite wsse-specific; however, it should work in your context as well. Note especially how there's the 'wsse' namespace parameter in the call to new SoapHeader(). Just replace that with 'eb' for your case.

                $header_part = '
                    <wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2003/06/secext" SOAP-ENV:mustUnderstand="1">
                        <wsse:UsernameToken>
                            <wsse:Username>'."USERNAME".'</wsse:Username>
                            <wsse:Password>'."PASSWORD".'</wsse:Password>
                        </wsse:UsernameToken>
                    </wsse:Security>
                ';
                $soap_var_header = new SoapVar( $header_part, XSD_ANYXML, null, null, null );
                $soap_header = new SoapHeader( 'http://your-target-service.com', 'wsse', $soap_var_header );
                $soap_client->__setSoapHeaders($soap_header);
                

                另一種解決方案是在對 SoapClient 進行子類化后處理 XML,但我只會將其作為最后的手段.

                Another solution is to mangle the XML after subclassing the SoapClient, but I'd only do this as a last resort.

                class My_SoapClient extends SoapClient {
                   protected $_response = null;
                   public function __doRequest( $request, $location, $action, $version, $one_way=null ) {
                      // insert big bad mangling code here
                      $this->_response = parent::__doRequest( $this->_request, $location, $action, $version, $one_way );
                      return $this->_response;
                   }
                }
                

                這篇關于PHP SoapClient 和復雜的標頭的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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)

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

                        <tbody id='7Bsa3'></tbody>

                      <small id='7Bsa3'></small><noframes id='7Bsa3'>

                        • <bdo id='7Bsa3'></bdo><ul id='7Bsa3'></ul>
                          <tfoot id='7Bsa3'></tfoot>
                        • <legend id='7Bsa3'><style id='7Bsa3'><dir id='7Bsa3'><q id='7Bsa3'></q></dir></style></legend>
                          主站蜘蛛池模板: 滚筒烘干机_转筒烘干机_滚筒干燥机_转筒干燥机_回转烘干机_回转干燥机-设备生产厂家 | 涡轮流量计_LWGY智能气体液体电池供电计量表-金湖凯铭仪表有限公司 | 隧道窑炉,隧道窑炉厂家-山东艾瑶国际贸易 | 杭州翻译公司_驾照翻译_专业人工翻译-杭州以琳翻译有限公司官网 组织研磨机-高通量组织研磨仪-实验室多样品组织研磨机-东方天净 | 优秀的临床医学知识库,临床知识库,医疗知识库,满足电子病历四级要求,免费试用 | 叉车电池-叉车电瓶-叉车蓄电池-铅酸蓄电池-电动叉车蓄电池生产厂家 | 跨境物流_美国卡派_中大件运输_尾程派送_海外仓一件代发 - 广州环至美供应链平台 | 翅片管散热器价格_钢制暖气片报价_钢制板式散热器厂家「河北冀春暖气片有限公司」 | 柴油机_柴油发电机_厂家_品牌-江苏卡得城仕发动机有限公司 | 剪刃_纵剪机刀片_分条机刀片-南京雷德机械有限公司 | 贵州科比特-防雷公司厂家提供贵州防雷工程,防雷检测,防雷接地,防雷设备价格,防雷产品报价服务-贵州防雷检测公司 | 郑州巴特熔体泵有限公司专业的熔体泵,熔体齿轮泵与换网器生产厂家 | 混合气体腐蚀试验箱_盐雾/硫化氢/气体腐蚀试验箱厂家-北京中科博达 | 碳纤维复合材料制品生产定制工厂订制厂家-凯夫拉凯芙拉碳纤维手机壳套-碳纤维雪茄盒外壳套-深圳市润大世纪新材料科技有限公司 | 紫外线老化试验箱_uv紫外线老化试验箱价格|型号|厂家-正航仪器设备 | 聚氨酯催化剂K15,延迟催化剂SA-1,叔胺延迟催化剂,DBU,二甲基哌嗪,催化剂TMR-2,-聚氨酯催化剂生产厂家 | 东莞螺杆空压机_永磁变频空压机_节能空压机_空压机工厂批发_深圳螺杆空压机_广州螺杆空压机_东莞空压机_空压机批发_东莞空压机工厂批发_东莞市文颖设备科技有限公司 | 在线钠离子分析仪-硅酸根离子浓度测定仪-油液水分测定仪价格-北京时代新维测控设备有限公司 | 电缆接头_防水接头_电缆防水接头 - 乐清市新豪电气有限公司 | RO反渗透设备_厂家_价格_河南郑州江宇环保科技有限公司 | 黄石东方妇产医院_黄石妇科医院哪家好_黄石无痛人流医院 | 培训无忧网-教育培训咨询招生第三方平台 | 数控车床-立式加工中心-多功能机床-小型车床-山东临沂金星机床有限公司 | 小型高低温循环试验箱-可程式高低温湿热交变试验箱-东莞市拓德环境测试设备有限公司 | 臭氧老化试验箱,高低温试验箱,恒温恒湿试验箱,防水试验设备-苏州亚诺天下仪器有限公司 | 南京试剂|化学试剂|分析试剂|实验试剂|cas号查询-专业60年试剂销售企业 | 超声波清洗机_超声波清洗机设备_超声波清洗机厂家_鼎泰恒胜 | 炉门刀边腹板,焦化设备配件,焦化焦炉设备_沧州瑞创机械制造有限公司 | 管理会计网-PCMA初级管理会计,中级管理会计考试网站 | DDoS安全防护官网-领先的DDoS安全防护服务商 | 合肥白癜风医院_合肥治疗白癜风医院_合肥看白癜风医院哪家好_合肥华研白癜风医院 | 胶水,胶粘剂,AB胶,环氧胶,UV胶水,高温胶,快干胶,密封胶,结构胶,电子胶,厌氧胶,高温胶水,电子胶水-东莞聚力-聚厉胶粘 | 齿轮减速马达一体式_蜗轮蜗杆减速机配电机-德国BOSERL齿轮减速电动机生产厂家 | 北京网站建设|北京网站开发|北京网站设计|高端做网站公司 | 快速门厂家批发_PVC快速卷帘门_高速门_高速卷帘门-广州万盛门业 快干水泥|桥梁伸缩缝止水胶|伸缩缝装置生产厂家-广东广航交通科技有限公司 | 仓储笼_金属箱租赁_循环包装_铁网箱_蝴蝶笼租赁_酷龙仓储笼租赁 测试治具|过炉治具|过锡炉治具|工装夹具|测试夹具|允睿自动化设备 | 工业用品一站式采购平台|南创工品汇-官网|广州南创 | 成都珞石机械 - 模温机、油温机、油加热器生产厂家 | 北京网站建设首页,做网站选【优站网】,专注北京网站建设,北京网站推广,天津网站建设,天津网站推广,小程序,手机APP的开发。 | 皮带式输送机械|链板式输送机|不锈钢输送机|网带输送机械设备——青岛鸿儒机械有限公司 | 药品冷藏箱厂家_低温冰箱_洁净工作台-济南欧莱博电子商务有限公司官网 |