2017 © Pedro Peláez
 

library soap-plus

PHP SoapClient wrapper class

image

dcarbone/soap-plus

PHP SoapClient wrapper class

  • Tuesday, September 13, 2016
  • by dcarbone
  • Repository
  • 2 Watchers
  • 23 Stars
  • 2,218 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 3 Open issues
  • 24 Versions
  • 65 % Grown

The README.md

soap-plus

Tests, (*1)

In a nutshell, this class replaces the internal query mechanism used by PHP's SoapClient class. The main reason for this wrapper is to enable consumption of NTLM-authenticated SharePoint SOAP services in a PHP application. This is not a data-mapper, it simply returns data as the normal SoapClient would, but all of the internal querying is handled by the PHP CURL library., (*2)

Installation

This lib is designed to be used with Composer, (*3)

"Require" entry:, (*4)

{
    "dcarbone/soap-plus": "2.1.*"
}

Constructor

The constructor has been overloaded to allow for a few new nifty features. All of the base construction options are usable. To see a list of built-in available options, see here http://www.php.net/manual/en/soapclient.soapclient.php., (*5)

Additional Options

auth_type, (*6)

  • basic
  • ntlm
  • digest
  • any
  • anysafe
  • NULL / undefined

These directly relate to the built-in CURLAUTH_XXX options available (see here, search for "CURLAUTH") It is entirely optional, and should only be set if you also define "login" and "password" options., (*7)

If you define a remote WSDL, the same parameters will be used for WSDL retrieval as well as querying., (*8)

user_agent, (*9)

This property is optional, and allows you to define a custom User Agent header value in requests., (*10)

debug, (*11)

By setting "debug" => true in your configuration array, every query and result will be stored in an internally array that can be accessed via the methods getDebugQueries() and getDebugResults(). You may also enable/disable debugging post-construct with enableDebug() and disableDebug()., (*12)

One word of caution on debugging. SOAP results can often be quite large, meaning you could potentially have lots of memory being sucked up for the strings that are saved in the internal array. I would recommend NOT enabling this feature anywhere outside of a dev / local dev environment. I have also provided a resetDebugValue() method which will empty the arrays., (*13)

wsdl_cache_path, (*14)

This option will allow you to specify the directory in which the WSDL cache files will be generated. If no value is passed for this option, sys_get_temp_dir value is used., (*15)

Querying

The typical mechanism by which PHP's SoapClient expects results is for them to be in an array. Coming from the SharePoint world, where most documentation outlines how to construct queries in XML, this can be a bit tedious. As such, I have provided a simple XML -> array conversion functionality in this library. For example:, (*16)

SharePoint Lists GetListItems, (*17)

Below is an example XML SOAP query against SharePoint's GetListItems action on the Lists WSDL., (*18)

<GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>
  <listName>My List Name</listName>
  <rowLimit>150</rowLimit>
  <query>
    <any>
      <Query xmlns=''>
        <Where>
          <And>
            <Eq>
              <FieldRef Name='Column1' />
              <Value Type='Integer'>1</Value>
            </Eq>
            <And>
              <Neq>
                <FieldRef Name='Column3' />
                <Value Type='Text'>value i don't want</Value>
              </Neq>
              <IsNotNull>
                <FieldRef Name='Column3' />
              </IsNotNull>
            </And>
          </And>
        </Where>
        <OrderBy>
          <FieldRef Name='Column1' Ascending='True' />
          <FieldRef Name='Column2' Ascending='True' />
          <FieldRef Name='Column3' Ascending='True' />
        </OrderBy>
      </Query>
    </any>
  </query>
  <viewFields>
    <any>
      <ViewFields>
        <FieldRef Name='Column1' />
        <FieldRef Name='Column2' />
        <FieldRef Name='Column3' />
      </ViewFields>
    </any>
  </viewFields>
  <queryOptions>
    <any>
      <QueryOptions xmlns=''>
        <DateInUtc>TRUE</DateInUtc>
        <IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns>
      </QueryOptions>
    </any>
  </queryOptions>
</GetListItems>

Using SoapClientPlus, this is transformed into..., (*19)

array (
  'GetListItems' =>
  array (
    'listName' => 'My List Name',
    'rowLimit' => '150',
    'query' =>
    array (
      'any' => '<Query xmlns=""><Where><And><Eq><FieldRef Name="Column1"/><Value Type="Integer">1</Value></Eq><And><Neq><FieldRef Name="Column3"/><Value Type="Text">value i don\'t want/Value></Neq><IsNotNull><FieldRef Name="Column3"/></IsNotNull></And></And></Where><OrderBy><FieldRef Name="Column1" Ascending="True"/><FieldRef Name="Column2" Ascending="True"/><FieldRef Name="Column3" Ascending="True"/></OrderBy></Query>',
    ),
    'viewFields' =>
    array (
      'any' => '<ViewFields><FieldRef Name="Column1"/><FieldRef Name="Column2"/><FieldRef Name="Column3"/></ViewFields>',
    ),
    'queryOptions' =>
    array (
      'any' => '<QueryOptions xmlns=""><DateInUtc>TRUE</DateInUtc><IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns></QueryOptions>',
    ),
  ),
)

... which is then passed into the standard SoapClient's own __soapCall method., (*20)

Note You do not HAVE to use XML, you may pass in an array. It is simply there as some people might find it easier to use. I use PHP's SimpleXMLElement implementation to handle the transformation., (*21)

Questions / Comments

As I stated in the buff, I created this library to help ease the pain of SharePoint services consumption in PHP wherein I had to use the NTLM auth mechanism. I am always open to new feature ideas from the community, so if you are using this library and have a suggestion, please let me know. I always enjoy a good challenge :), (*22)

The Versions

13/09 2016

dev-master

9999999-dev https://github.com/dcarbone/soap-plus

PHP SoapClient wrapper class

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Daniel Carbone

php soap soapclient

13/09 2016

1.0.0

1.0.0.0 https://github.com/dcarbone/soap-plus

PHP SoapClient wrapper class

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Daniel Carbone

php soap soapclient

03/02 2015

0.8.0

0.8.0.0 https://github.com/dcarbone/soap-plus

PHP SoapClient wrapper class

  Sources   Download

MIT

The Requires

 

The Development Requires

by Daniel Carbone

php soap soapclient

15/12 2014

0.7.3

0.7.3.0 https://github.com/dcarbone/soap-plus

PHP SoapClient wrapper class

  Sources   Download

MIT

The Requires

 

The Development Requires

by Daniel Carbone

php soap soapclient

15/12 2014

0.7.2

0.7.2.0 https://github.com/dcarbone/soap-plus

PHP SoapClient wrapper class

  Sources   Download

MIT

The Requires

 

The Development Requires

by Daniel Carbone

php soap soapclient

07/10 2014

0.7.1

0.7.1.0 https://github.com/dcarbone/soap-plus

PHP SoapClient wrapper class

  Sources   Download

MIT

The Requires

 

The Development Requires

by Daniel Carbone

php soap soapclient

16/09 2014

0.7.0

0.7.0.0 https://github.com/dcarbone/soap-plus

PHP SoapClient wrapper class

  Sources   Download

MIT

The Requires

 

The Development Requires

by Daniel Carbone

php soap soapclient

11/09 2014

0.6.1

0.6.1.0 https://github.com/dcarbone/soap-plus

PHP SoapClient wrapper class

  Sources   Download

MIT

The Requires

 

The Development Requires

by Daniel Carbone

php soap soapclient

01/09 2014

0.6.0

0.6.0.0 https://github.com/dcarbone/soap-plus

PHP SoapClient wrapper class

  Sources   Download

MIT

The Requires

 

The Development Requires

by Daniel Carbone

php soap soapclient

26/06 2014

0.5.2

0.5.2.0 https://github.com/dcarbone/soap-plus

PHP SoapClient wrapper class

  Sources   Download

MIT

The Requires

 

by Daniel Carbone

php soap soapclient

25/06 2014

0.5.1

0.5.1.0 https://github.com/dcarbone/soap-plus

PHP SoapClient wrapper class

  Sources   Download

MIT

The Requires

 

by Daniel Carbone

php soap soapclient

23/06 2014

0.5.0

0.5.0.0 https://github.com/dcarbone/soap-plus

PHP SoapClient wrapper class

  Sources   Download

MIT

The Requires

 

by Daniel Carbone

php soap soapclient

18/06 2014

0.4.3

0.4.3.0 https://github.com/dcarbone/soap-plus

PHP SoapClient wrapper class

  Sources   Download

MIT

The Requires

 

by Daniel Carbone

php soap soapclient

03/06 2014

0.4.2

0.4.2.0 https://github.com/dcarbone/soap-plus

PHP SoapClient wrapper class

  Sources   Download

MIT

The Requires

 

by Daniel Carbone

php soap soapclient

29/05 2014

0.4.1

0.4.1.0 https://github.com/dcarbone/soap-plus

PHP SoapClient wrapper class

  Sources   Download

MIT

The Requires

 

by Daniel Carbone

php soap soapclient

13/05 2014

0.4.0

0.4.0.0 https://github.com/dcarbone/soap-plus

PHP SoapClient wrapper class

  Sources   Download

MIT

The Requires

 

by Daniel Carbone

php soap soapclient

13/05 2014

0.3.3

0.3.3.0 https://github.com/dcarbone/soap-plus

PHP SoapClient wrapper class

  Sources   Download

MIT

The Requires

 

by Daniel Carbone

php soap soapclient

29/04 2014

0.3.2

0.3.2.0 https://github.com/dcarbone/soap-plus

PHP SoapClient wrapper class

  Sources   Download

MIT

The Requires

 

by Daniel Carbone

php soap soapclient

29/04 2014

0.3.1

0.3.1.0 https://github.com/dcarbone/soap-plus

PHP SoapClient wrapper class

  Sources   Download

MIT

The Requires

 

by Daniel Carbone

php soap soapclient

21/04 2014

0.3.0

0.3.0.0 https://github.com/dcarbone/soap-plus

PHP SoapClient wrapper class

  Sources   Download

MIT

The Requires

 

by Daniel Carbone

php soap soapclient

14/04 2014

0.2.5

0.2.5.0 https://github.com/dcarbone/soap-plus

PHP SoapClient wrapper class

  Sources   Download

MIT

The Requires

 

by Daniel Carbone

php soap soapclient

21/02 2014

0.2.4

0.2.4.0 https://github.com/dcarbone/soap-plus

PHP SoapClient wrapper class

  Sources   Download

MIT

The Requires

 

by Daniel Carbone

php soap soapclient

06/02 2014

0.2.2

0.2.2.0 https://github.com/dcarbone/dom-plus

PHP SoapClient wrapper class

  Sources   Download

MIT

The Requires

 

by Daniel Carbone

php soap soapclient

04/02 2014

0.2.1

0.2.1.0

More Better PHP Soap implementation

  Sources   Download

The Requires

 

by Daniel Carbone