简体   繁体   English

使用PHP WSDL进行SOAP身份验证

[英]SOAP authentication with PHP WSDL

I have looked at several related topics, but none solved my wsdl/soap/php issue. 我看了几个相关主题,但没有一个解决我的wsdl / soap / php问题。

My header looks like this; 我的标题看起来像这样;

<?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> 

I am not able to succesfully connect. 我无法成功连接。 I've tried sample codes but none of them worked. 我已经尝试过示例代码,但是没有一个起作用。

Any help is appreciated. 任何帮助表示赞赏。

Additional authentication info: 其他身份验证信息:

<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>

A full working request looks like this: 完整的工作请求如下所示:

<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>

It's not using standard <SOAP-ENV:Header> authentication, instead username and password are regular variables inside <SOAP-ENV:Body> . 它没有使用标准的<SOAP-ENV:Header>身份验证,而是用户名和密码是<SOAP-ENV:Body>中的常规变量。

The snippet is out of context, so I can't tell you how to set them, but you can use some WSDL to PHP code generator to get PHP classes for you to discover. 该代码段没有上下文,因此我无法告诉您如何设置它们,但是您可以使用一些WSDL至PHP代码生成器来获取PHP类供您发现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM