Home > API General > SWS2 API Documentation

SWS2 API Documentation


Overview
SWS2 was written to eventually replace the current Yardi Centershift SWS API. Several improvements have been made to security, performance and use. There are three primary changes.
The first is the use of tokenization. Instead of the LookupUser_Request object used in most methods of the old API the new version is tokenized. The user name and password are passed in through the Credentials and a token is created. This token’s lifecycle allows for access with an approved token independent of connection timeouts. This means much less overhead when initiating a connection after a brief lapse since the last connection. Since it is the token that is verified with each call instead of the user name and password, several seconds are shaved off each call after the token is obtained. The configuration and binding do require a bit more effort as the addition of the service reference does not complete the configuration process, however details are documented in the Configuration section of this paper.
The second improvement is the use of the new WCF service. The older Soap versions were slower and less efficient with data compression. The newer WCF service uses more efficient compression and processing requests more quickly. It can also be used with Java and with PHP although Yardi, as a Microsoft shop does not provide documentation on using those platforms.
The last improvement is removing Store defined objects from the request and the response objects. There will still be some collections but the WSDL size should be greatly reduced as the Store.exe is no longer referenced. Again this should significantly improve performance particularly with the initial handshake.

Configuration
If you are using Visual Studio .Net the following is an example of a correct application configuration file for the Sandbox environment. Production environments will vary slightly in names and tokens. There are several elements that must be added manually as adding the reference does not automatically create these elements.

Supplying Credentials and Calling a Method
This is sample code for Microsoft .Net Framework. You will need to reference the System.IdentityModel available in the .Net Framework assemblies. Once you have done that you will want to add the following to the initial call to the API.

C#Example

Those using PHP

We are a Microsoft shop and do not have any users who can assist with setting up SWS2 for the API. However, in the past we have had third parties create a .NET passthrough app and use PHP to access it. This would be your only option at this time to use PHP with SWS2.

Categories: API General
  1. Sandeep
    April 7, 2015 at 1:59 pm

    Hello, I am using php soapUI to call the method but it is responding as an error like below response.
    How can i authenticate the username and password?
    also can you please provide sample php demo code to authenticate and get the response using soap. I am unable to crack it and very less documentation is present over internet.

    Please help.



    http://www.w3.org/2005/08/addressing/soap/fault
    uuid:7785c7b5-2965-43be-9234-73477dfd72ee




    s:Sender

    a:InvalidSecurity


    An error occurred when verifying security for the message.

    • swsjen
      April 7, 2015 at 2:07 pm

      Yardi does not have any PHP programmers on staff. The following is the best information we can offer PHP programmers.

      The type of authentication/authorization that is being used with SWS2 calls is active federation using the wsFederation protocol (good search terms for further research if desired).

      In this scenario the client (your program that would like to use SWS2) would construct a wsFederation channel (you may have seen examples of .NET configuration files structuring such a channel), passing in the username and password that you wish to authenticate with. The identity provider will send back an XML response (matching the WS-Federation protocol (containing permission claims, etc.) which will allow the client to continue using the now federated channel as desired.

      Something like https://simplesamlphp.org/ can be used for such a purpose according to online documentation.

  2. Shane N
    October 1, 2015 at 10:32 am

    Sandeep – did you ever figure out how to do this? Trying to do the same thing with PHP, but everything I try is a dead end.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s