簡體   English   中英

使用PHP WSDL進行SOAP身份驗證

[英]SOAP authentication with PHP WSDL

我看了幾個相關主題,但沒有一個解決我的wsdl / soap / php問題。

我的標題看起來像這樣;

<?xml version="1.0" encoding="ISO-8859-1"?> 
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns="http://"> 
    <SOAP-ENV:Header> 
        <ns:authentication> 
            <username>username</username> 
            <password>password</password> 
        </ns:authentication> 
    </SOAP-ENV:Header> 
</SOAP-ENV:Envelope> 

我無法成功連接。 我已經嘗試過示例代碼,但是沒有一個起作用。

任何幫助表示贊賞。

其他身份驗證信息:

<xsd:complexType>
           <xsd:all>
              <xsd:element name="username" nillable="false" minOccurs="1" maxOccurs="1">
                 <xsd:annotation>
                    <xsd:documentation>Username for authenticatie</xsd:documentation>
                 </xsd:annotation>
                 <xsd:simpleType>
                    <xsd:restriction base="xsd:string">
                       <xsd:maxLength value="4000"/>
                    </xsd:restriction>
                 </xsd:simpleType>
              </xsd:element>
              <xsd:element name="password" nillable="false" minOccurs="1" maxOccurs="1">
                 <xsd:annotation>
                    <xsd:documentation>Password for authentication</xsd:documentation>
                 </xsd:annotation>
                 <xsd:simpleType>
                    <xsd:restriction base="xsd:string">
                       <xsd:maxLength value="4000"/>
                    </xsd:restriction>
                 </xsd:simpleType>
              </xsd:element>
           </xsd:all>
        </xsd:complexType>

完整的工作請求如下所示:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:zone="http://">
   <soapenv:Header>
       <zone:authentication>
          <!--You may enter the following 2 items in any order-->
          <username>myusername</username>
          <password>mypassword</password>
       </zone:authentication>
   </soapenv:Header>
   <soapenv:Body>
       <zone:searchSubscriptionRequest>
          <!--You may enter the following 2 items in any order-->
          <requestTag>test</requestTag>
          <zipcode>000 AB</zipcode>
       </zone:searchSubscriptionRequest>
  </soapenv:Body>

它沒有使用標准的<SOAP-ENV:Header>身份驗證,而是用戶名和密碼是<SOAP-ENV:Body>中的常規變量。

該代碼段沒有上下文,因此我無法告訴您如何設置它們,但是您可以使用一些WSDL至PHP代碼生成器來獲取PHP類供您發現。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM