能用PHP编写基于示例XML文件的SOAP函数


Can PHP write SOAP function base on sample XML file?

我有一个连接到SOAP服务器的示例XML文件,并将" userer1 "的"Tier"属性设置为"pkg01"。

当在SOAP UI上运行这个XML文件时,它工作了。

和我想通过PHP为这个工作创建一个SOAP函数。但我不知道如何开始,我需要调用多少函数?谁来帮忙。

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.subscriberservices.sandvine.com">
   <soapenv:Header xmlns:svsec="http://services.sandvine.com">
      <svsec:username>username</svsec:username>
      <svsec:password>password</svsec:password>
   </soapenv:Header>
   <soapenv:Body>
      <ws:SetSubscriberAttributesRequest>
         <Debug>false</Debug>
         <BulkOperationFailureBehaviour>AllOrNothing</BulkOperationFailureBehaviour>
         <SetSubscriberAttributeParameterSets>
            <SetSubscriberAttributeParameterSet>
               <SubscriberKey>
                  <SubscriberRealmKey>
                     <Name>DEFAULT</Name>
                  </SubscriberRealmKey>
                  <Name>user01</Name>
               </SubscriberKey>
               <SubscriberAttributeDefinitionKey>
                  <Name>Tier</Name>
               </SubscriberAttributeDefinitionKey>
               <Value>pkg01</Value>
            </SetSubscriberAttributeParameterSet>
        </SetSubscriberAttributeParameterSets>
         <ResponseGroups>
            <ResponseGroup>Subscriber.Shallow</ResponseGroup>
         </ResponseGroups>
      </ws:SetSubscriberAttributesRequest>
   </soapenv:Body>
</soapenv:Envelope>

XML文件没有连接到SOAP服务器- XML文件表示SOAP请求。

您需要做的是为SOAP服务器编写一个php SOAP客户机。为此,您需要:

  1. SOAP服务器的wsdl文件的uri(这本质上是允许您的客户机创建请求的元数据—它描述了服务器允许的功能)
  2. Zend_Soap_Client类- http://framework.zend.com/manual/2.0/en/modules/zend.soap.client.html

您可以在这里阅读更多关于PHP和SOAP的内容使用Zend框架实现SOAP服务