WS_Division Class Reference

Static Public Member Functions

static createDivision ($auth, $division)
static readDivision ($auth)
static updateDivision ($auth, $division)
static deleteDivision ($auth)
static restoreDivision ($auth)

Member Function Documentation

static createDivision ( auth,
division 
) [static]

Description:

Create a new division under a specified existing company or division. The new division will be created by the specified keyword of the company or division.
Parameters:
WSAuthentication$authAuthentication Object
username  - String[40] (Required) - Username for company credentials
password  - String[40] (Required) - Password for company credentials
api_key   - String[40] (Required) - Credentials for company
code      - Integer    (Required) - Default shortcode or longcode for the new division
keyword   - String[40] (Required) - Default keyword for the company or division that the
                                     new division will be under
WSDivision$divisionDivision Object
name    - String  (Required) - New name for division being created
email   - String  (Optional)
phone   - String  (Optional) - Must include country code with number
url     - String  (Optional)
address - Object (Optional) - There is an address object inside the division object
 city       - String  (Optional)
 state      - String  (Optional)
 state_abbr - String  (Optional)
 street     - String  (Optional)
 street2    - String  (Optional)
 zip        - Integer (Optional)
 
Note:
The address object is an optional parameter to add to your new division.
Returns:
WSDivisionResponse $response
address object - If you set the address object this will return all that has been set
  city
  state
  state_abbr
  street
  street2
  zip
division object
  email          - If you set an email it will be show here
  keyword        - This is the default keyword for the newly created division
  name           - New name of the division
  phone          - If you set an phone it will be show here
  url            - If you set an url it will be show here
result         - True/False

Code Examples:

<?php
$wsdl = 'SSL//HOST_URL/webservices/?version=2.0.0&wsdl';
$soap = new SoapClient($wsdl);

    $auth = array();
    $auth['username'] = 'api_username';
    $auth['password'] = 'api_password';
    $auth['api_key'] = 'xxxxxxxxxxxxxx';
    $auth['keyword'] = 'keyword';
    $auth['code'] = 12345;
     
    //create a division object
    $div = array();
    $div["name"] = "Sample Division";
    $div["phone"] = "5551234567";
    $div["email"] = "email@test.com";
    $div["url"] = "www.test.com";
    //the following fields are optional to set but required to be passed in the object
    $div["default_code"] = 12345;
    $div["keyword"] = "";
    $div["divisions"] = "";
    $div["subscriptionnodes"] = "";
     
    //create an address object to go with the division
    $add = array();
    $add["street"] = "123 East";
    $add["street2"] = "234 North";
    $add["city"] = "Cityville";
    $add["state"] = "Idaho";
    $add["state_abbr"] = "ID";
    $add["zip"] = "12345";
    $div["address"] = $add;
    
    $results = $soap->createDivision($auth, $div);
    print_r($results);
    
    if ($results->result == 0 || $results->error > 0) {
 //error processing
 throw new Exception($results->message);
    } else {
 //after success processing
    }
                                                     SOAP Request

    <soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:urn="urn:webservices2_0_0">
    <soapenv:Header/>
    <soapenv:Body>
    <urn:createDivision soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <auth xsi:type="urn:WSAuthentication">
    <username xsi:type="xsd:string">api_username</username>
    <password xsi:type="xsd:string">api_password</password>
    <api_key xsi:type="xsd:string">xxxxxxxxxxxxxx</api_key>
    <code xsi:type="xsd:string">12345</code>
    <keyword xsi:type="xsd:string">parent_division_keyword</keyword>
    </auth>
    <division xsi:type="urn:WSDivision">
    <email xsi:type="xsd:string">test@test.com</email>
    <name xsi:type="xsd:string">Test Division</name>
    <phone xsi:type="xsd:string">8885554433</phone>
    <url xsi:type="xsd:string">http://www.test.com</url>
    <address xsi:type="urn:WSAddress">
    <city xsi:type="xsd:string">Cityville</city>
    <state xsi:type="xsd:string"></state>
    <state_abbr xsi:type="xsd:string">ID</state_abbr>
    <street xsi:type="xsd:string">123 East</street>
    <street2 xsi:type="xsd:string">234 South</street2>
    <zip xsi:type="xsd:integer">87654</zip>
    </address>
    </division>
    </urn:createDivision>
    </soapenv:Body>
    </soapenv:Envelope>

                                                  SOAP Response

    <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:ns1="urn:webservices2_0_0"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
    <SOAP-ENV:Body>
    <ns1:createDivisionResponse>
    <createDivisionReturn xsi:type="ns1:WSDivisionResponse">
    <message xsi:type="xsd:string">Successfully created division.</message>
    <response xsi:type="ns1:WSDivision">
    <address xsi:type="ns1:WSAddress">
    <city xsi:type="xsd:string">Cityville</city>
    <state xsi:type="xsd:string">Idaho</state>
    <state_abbr xsi:type="xsd:string">ID</state_abbr>
    <street xsi:type="xsd:string">123 East</street>
    <street2 xsi:type="xsd:string">234 South</street2>
    <zip xsi:type="xsd:int">87654</zip>
    </address>
    <divisions SOAP-ENC:arrayType="ns1:WSDivision[0]" xsi:type="ns1:WSDivisionArray"/>
    <email xsi:type="xsd:string">test@test.com</email>
    <keyword xsi:type="xsd:string">new_keyword</keyword>
    <name xsi:type="xsd:string">Test Division</name>
    <phone xsi:type="xsd:string">8885554433</phone>
    <subscriptionnodes SOAP-ENC:arrayType="ns1:WSSubscriptionnode[0]" xsi:type="ns1:WSSubscriptionnodeArray"/>
    <url xsi:type="xsd:string">http://www.test.com</url>
    </response>
    <result xsi:type="xsd:boolean">true</result>
    </createDivisionReturn>
    </ns1:createDivisionResponse>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    //create web service authentication
     
    WSAuthentication auth = new WSAuthentication();
    auth.username = "api_username";
    auth.password = "api_password";
    auth.api_key = "xxxxxxxxxxxxxx";
    auth.keyword = "";
    auth.code = "12345";
     
    //create division object
    WSDivision div = new WSDivision();
    div.name = "Test Division";
    div.phone = "8885554433";
    div.email = "support@company.com";
    div.url = "www.company.com";
     
    //create address object
    WSAddress add = new WSAddress();
    add.street = "123 East";
    add.street2 = "234 South";
    add.city = "Cityville";
    add.state_abbr = "ID";
    add.zip = 87654;
    div.address = add;
     
    //create task bind
    WS_DivisionBinding bind = new WS_DivisionBinding();
    bind.Url = "SSL//HOST_URL/webservices/division/2.0.0";
     
    //create result object
    WSDivisionResponse ws_result = new WSDivisionResponse();
     
    //call bind event
    ws_result = bind.createDivision(auth, div);
     
    //check to see if there was an error
    if (!ws_result.result) {
    label.Text = ws_result.message;
    } else {
    label.Text = ws_result.message;
    bool response_status = ws_result.result;
    WSDivision d = ws_result.response;
    }
 Request
SSL//HOST_URL/httppost/nvp?version=2.0.0&method_name=division.createDivision&username={username}&password={password}&api_key={api_key}&code=12345&keyword={Company Keyword}&name=New Division

 Response
<?xml version="1.0" encoding="utf-8"?>
<createDivision>
  <message>Successfully created division.</message>
  <error_code></error_code>
  <result>true</result>
  <response>
    <name>New Division</name>
    <address>
      <street></street>
      <street2></street2>
      <city></city>
      <state></state>
      <state_abbr></state_abbr>
      <zip></zip>
    </address>
    <phone></phone>
    <email></email>
    <url></url>
    <keyword>31321</keyword>
    <default_code></default_code>
    <divisions></divisions>
    <subscriptionnodes></subscriptionnodes>
  </response>
</createDivision>
static deleteDivision ( auth) [static]

Description:

Delete an existing division. The division is specified by the keyword provided in the authentication object.
Parameters:
WSAuthentication$authAuthentication Object
username  - String[40] (Required) - Username for company credentials
password  - String[40] (Required) - Password for company credentials
api_key   - String[40] (Required) - Credentials for company
code      - Integer    (Required) - Shortcode or longcode for the division that is to be deleted
keyword   - String[40] (Required) - Default keyword for the division that is to be deleted
Returns:
WSDivisionResponse $response
message - A message stating successful or not
result  - True/False based on successfulness
Coded Examples:
<?php
$wsdl = 'SSL//HOST_URL/webservices/?version=2.0.0&wsdl';
$soap = new SoapClient($wsdl);

//create an authentication object
$auth = array();
$auth['username'] = 'api_username';
$auth['password'] = 'api_password';
$auth['api_key'] = 'xxxxxxxxxxxxxx';
$auth['keyword'] = 'division_keyword';
$auth['code'] = 12345;

$results = $soap->deleteDivision($auth);

print_r($results);

if ($results->result == 0 || $results->error == 0){
    // error processing
    throw new Exception($results->message);
} else {
    // after success processing
}
                                                           SOAP Request 

    <soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:urn="urn:webservices2_0_0">
    <soapenv:Header/>
    <soapenv:Body>
    <urn:deleteDivision soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <auth xsi:type="urn:WSAuthentication">
    <username xsi:type="xsd:string">api_username</username>
    <password xsi:type="xsd:string">api_password</password>
    <api_key xsi:type="xsd:string">xxxxxxxxxxxxxx</api_key>
    <code xsi:type="xsd:string">12345</code>
    <keyword xsi:type="xsd:string">division_keyword</keyword>
    </auth>
    </urn:deleteDivision>
    </soapenv:Body>
    </soapenv:Envelope>

                                                         SOAP Response

    <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:ns1="urn:webservices2_0_0" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
    <SOAP-ENV:Body>
    <ns1:deleteDivisionResponse>
    <deleteDivisionReturn xsi:type="ns1:WSDivisionResponse">
    <message xsi:type="xsd:string">Successfully deleted division.</message>
    <response xsi:nil="true" xsi:type="ns1:WSDivision"/>
    <result xsi:type="xsd:boolean">true</result>
    </deleteDivisionReturn>
    </ns1:deleteDivisionResponse>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    //create web service authentication
    WSAuthentication auth = new WSAuthentication();
    auth.username = "api_username";
    auth.password = "api_password";
    auth.api_key = "xxxxxxxxxxxxxx";
    auth.keyword = "keyword_of_division_to_delete";
    auth.code = "12345";
     
    //create task bind
    WS_DivisionBinding bind = new WS_DivisionBinding();
    bind.Url = "SSL//HOST_URL/webservices/division/2.0.0";
     
    //create result object
    WSDivisionResponse ws_result = new WSDivisionResponse();
     
    //call bind event
    ws_result = bind.deleteDivision(auth);
     
    //check to see if there was an error
    if (!ws_result.result)
    {
    //handle error
    label.Text = ws_result.message;
    }
    else
    {
    //handle successful response
    label.Text = ws_result.message;
    }
 Request
SSL//HOST_URL/httppost/nvp?version=2.0.0&method_name=division.deleteDivision&username={username}&password={password}&api_key={api_key}&code=12345&keyword={Division keyword to be deleted}


 Response
<?xml version="1.0" encoding="utf-8"?>
<deleteDivision>
  <message>Successfully deleted division.</message>
  <error_code></error_code>
  <result>true</result>
  <response></response>
</deleteDivision>
static readDivision ( auth) [static]

Description:

Read an existing division. The division is specified by the keyword in the authentication object.
Parameters:
WSAuthentication$authAuthentication Object
username  - String[40] (Required) - Username for company credentials
password  - String[40] (Required) - Password for company credentials
api_key   - String[40] (Required) - Credentials for company
code      - Integer    (Required) - Default shortcode or longcode for the division to be read
keyword   - String[40] (Required) - Default keyword for the division to be read
Returns:
WSDivisionResponse $response
address object - If you set the address object this will return all that has been set
  city
  state
  state_abbr
  street
  street2
  zip
division object
  email          - If you set an email it will be show here
  keyword        - This is the default keyword for the division
  name           - Name of the division
  phone          - If you set a phone it will be show here
  url            - If you set a url it will be show here
result         - True/False

Code Examples:

<?php
$wsdl = 'SSL//HOST_URL/webservices/?version=2.0.0&wsdl';
$soap = new SoapClient($wsdl);

//create an authentication object
$auth = array();
$auth['username'] = 'api_username';
$auth['password'] = 'api_password';
$auth['api_key'] = 'xxxxxxxxxxxxxx';
$auth['keyword'] = 'division_keyword';
$auth['code'] = 12345;

$results = $soap->readDivision($auth);

print_r($results);

if ($results->result == 0 || $results->error > 0) {
 //error processing
 throw new Exception($results->message);
} else {
 //after success processing
}
  
                                                   SOAP Request 

    <soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:urn="urn:webservices2_0_0">
    <soapenv:Header/>
    <soapenv:Body>
    <urn:readDivision soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <auth xsi:type="urn:WSAuthentication">
    <username xsi:type="xsd:string">api_username</username>
    <password xsi:type="xsd:string">api_password</password>
    <api_key xsi:type="xsd:string">xxxxxxxxxxxxxx</api_key>
    <code xsi:type="xsd:string">12345</code>
    <keyword xsi:type="xsd:string">division_keyword</keyword>
    </auth>
    </urn:readDivision>
    </soapenv:Body>
    </soapenv:Envelope>

                                                   SOAP Response

<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
 xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
 xmlns:ns1="urn:webservices2_0_0" 
 xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
   <SOAP-ENV:Body>
      <ns1:readDivisionResponse>
         <readDivisionReturn xsi:type="ns1:WSDivisionResponse">
            <error_code xsi:type="xsd:int">0</error_code>
            <message xsi:type="xsd:string">Successfully read division.</message>
            <response xsi:type="ns1:WSDivision">
               <address xsi:type="ns1:WSAddress">
                  <city xsi:type="xsd:string"/>
                  <state xsi:type="xsd:string"/>
                  <state_abbr xsi:type="xsd:string"/>
                  <street xsi:type="xsd:string"/>
                  <street2 xsi:type="xsd:string"/>
                  <zip xsi:nil="true"/>
               </address>
               <default_code xsi:type="xsd:string">12345</default_code>
               <divisions SOAP-ENC:arrayType="ns1:WSDivision[0]" xsi:type="ns1:WSDivisionArray"/>
               <email xsi:type="xsd:string"/>
               <keyword xsi:type="xsd:string">57032</keyword>
               <name xsi:type="xsd:string">Division</name>
               <phone xsi:type="xsd:string"/>
               <subscriptionnodes SOAP-ENC:arrayType="ns1:WSSubscriptionnode[3]" xsi:type="ns1:WSSubscriptionnodeArray">
                  <item xsi:type="ns1:WSSubscriptionnode">
                     <default_code xsi:type="xsd:string">12345</default_code>
                     <ispublic xsi:type="xsd:int">1</ispublic>
                     <keywords SOAP-ENC:arrayType="ns1:WSKeyword[1]" xsi:type="ns1:WSKeywordArray">
                        <item xsi:type="ns1:WSKeyword">
                           <app_identifier xsi:type="xsd:string"/>
                           <auto_subscribe xsi:type="xsd:int">0</auto_subscribe>
                           <callback_url xsi:type="xsd:string"/>
                           <keyword_type xsi:type="xsd:int">1</keyword_type>
                           <note xsi:type="xsd:string"/>
                           <response xsi:type="xsd:string"/>
                           <subscribed_response xsi:type="xsd:string"/>
                           <word xsi:type="xsd:string">Group_default_keyword3</word>
                        </item>
                     </keywords>
                     <name xsi:type="xsd:string">Group3</name>
                     <stackOrder xsi:type="xsd:int">0</stackOrder>
                  </item>
                  <item xsi:type="ns1:WSSubscriptionnode">
                     <default_code xsi:type="xsd:string">12345</default_code>
                     <ispublic xsi:type="xsd:int">1</ispublic>
                     <keywords SOAP-ENC:arrayType="ns1:WSKeyword[2]" xsi:type="ns1:WSKeywordArray">
                        <item xsi:type="ns1:WSKeyword">
                           <app_identifier xsi:type="xsd:string"/>
                           <auto_subscribe xsi:type="xsd:int">0</auto_subscribe>
                           <callback_url xsi:type="xsd:string"/>
                           <keyword_type xsi:type="xsd:int">5</keyword_type>
                           <note xsi:type="xsd:string"/>
                           <response xsi:type="xsd:string"/>
                           <subscribed_response xsi:type="xsd:string"/>
                           <word xsi:type="xsd:string">Group_custom_keyword</word>
                        </item>
                        <item xsi:type="ns1:WSKeyword">
                           <app_identifier xsi:type="xsd:string"/>
                           <auto_subscribe xsi:type="xsd:int">0</auto_subscribe>
                           <callback_url xsi:type="xsd:string"/>
                           <keyword_type xsi:type="xsd:int">1</keyword_type>
                           <note xsi:type="xsd:string"/>
                           <response xsi:type="xsd:string"/>
                           <subscribed_response xsi:type="xsd:string"/>
                           <word xsi:type="xsd:string">Group_default_keyword1</word>
                        </item>
                     </keywords>
                     <name xsi:type="xsd:string">Group1</name>
                     <stackOrder xsi:type="xsd:int">0</stackOrder>
                  </item>
                  <item xsi:type="ns1:WSSubscriptionnode">
                     <default_code xsi:type="xsd:string">12345</default_code>
                     <ispublic xsi:type="xsd:int">1</ispublic>
                     <keywords SOAP-ENC:arrayType="ns1:WSKeyword[2]" xsi:type="ns1:WSKeywordArray">
                        <item xsi:type="ns1:WSKeyword">
                           <app_identifier xsi:type="xsd:string"/>
                           <auto_subscribe xsi:type="xsd:int">0</auto_subscribe>
                           <callback_url xsi:type="xsd:string"/>
                           <keyword_type xsi:type="xsd:int">5</keyword_type>
                           <note xsi:type="xsd:string"/>
                           <response xsi:type="xsd:string"/>
                           <subscribed_response xsi:type="xsd:string"/>
                           <word xsi:type="xsd:string">Group_custom_keyword2</word>
                        </item>
                        <item xsi:type="ns1:WSKeyword">
                           <app_identifier xsi:type="xsd:string"/>
                           <auto_subscribe xsi:type="xsd:int">0</auto_subscribe>
                           <callback_url xsi:type="xsd:string"/>
                           <keyword_type xsi:type="xsd:int">1</keyword_type>
                           <note xsi:type="xsd:string"/>
                           <response xsi:type="xsd:string"/>
                           <subscribed_response xsi:type="xsd:string"/>
                           <word xsi:type="xsd:string">Group_default_keyword</word>
                        </item>
                     </keywords>
                     <name xsi:type="xsd:string">Group2</name>
                     <stackOrder xsi:type="xsd:int">0</stackOrder>
                  </item>
               </subscriptionnodes>
               <url xsi:type="xsd:string"/>
            </response>
            <result xsi:type="xsd:boolean">true</result>
         </readDivisionReturn>
      </ns1:readDivisionResponse>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
    //create web service authentication

    WSAuthentication auth = new WSAuthentication();
    auth.username = "api_username";
    auth.password = "api_password";
    auth.api_key = "xxxxxxxxxxxxxx";
    auth.keyword = "keyword_of_division_read";
    auth.code = "12345";

    //create task bind
    WS_DivisionBinding bind = new WS_DivisionBinding();
    bind.Url = "SSL//HOST_URL/webservices/division/2.0.0";

    //create result object
    WSDivsionResponse ws_result = new WSDivsionResponse();

    //call bind event
    ws_result = bind.readDivision(auth);

    //check to see if there was an error
    if (!ws_result.result)
    {
    //handle error
    label.Text = ws_result.message;
    }
    else
    {
    //handle successful response
    label.Text = ws_result.message;
    WSDivision d = ws_result.response;
    }
 Request
SSL//HOST_URL/httppost/nvp?version=2.0.0&method_name=division.readDivision&username={username}&password={password}&api_key={api_key}&code=12345&keyword=Divison keyword

 Response
<?xml version="1.0" encoding="utf-8"?>
<readDivision>
  <message>Successfully read division.</message>
  <error_code></error_code>
  <result>true</result>
  <response>
    <name>Division</name>
    <address>
      <street></street>
      <street2></street2>
      <city></city>
      <state></state>
      <state_abbr></state_abbr>
      <zip></zip>
    </address>
    <phone></phone>
    <email></email>
    <url></url>
    <keyword>31321</keyword>
    <default_code>12345</default_code>
    <divisions></divisions>
    <subscriptionnodes></subscriptionnodes>
  </response>
</readDivision>
static restoreDivision ( auth) [static]

Description:

Restore an existing division. The keyword used in the authentication object is the keyword of the division that will be restored.
Parameters:
WSAuthentication$authAuthentication Object
username  - String[40] (Required) - Username for company credentials
password  - String[40] (Required) - Password for company credentials
api_key   - String[40] (Required) - Credentials for company
code      - Integer    (Required) - Default shortcode or longcode for the division
keyword   - String[40] (Required) - Default keyword for the division that will be restored
Returns:
WSDivisionResponse $response
address object - If you set the address object this will return all that has been set
  city
  state
  state_abbr
  street
  street2
  zip
division object
  email          - If you set an email it will be show here
  keyword        - This is the default keyword for the restored division
  name           - Name of the division
  phone          - If you set an phone it will be show here
  url            - If you set an url it will be show here
result         - True/False
Coded Examples:
<?php
$wsdl = 'SSL//HOST_URL/webservices/?version=2.0.0&wsdl';
$soap = new SoapClient($wsdl);

//create an authentication object
$auth = array();
$auth['username'] = 'api_username';
$auth['password'] = 'api_password';
$auth['api_key'] = 'xxxxxxxxxxxxxx';
$auth['keyword'] = 'division_keyword';
$auth['code'] = 12345;

$results = $soap->restoreDivision($auth);

print_r($results);

if ($results->result == 0 || $results->error > 0) {
 //error processing
 throw new Exception($results->message);
} else {
 //after success processing
}
  
                                                                 SOAP Request 

    <soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:urn="urn:webservices2_0_0">
    <soapenv:Header/>
    <soapenv:Body>
    <urn:restoreDivision soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <auth xsi:type="urn:WSAuthentication">
    <username xsi:type="xsd:string">api_username</username>
    <password xsi:type="xsd:string">api_password</password>
    <api_key xsi:type="xsd:string">xxxxxxxxxxxxxx</api_key>
    <code xsi:type="xsd:string">12345</code>
    <keyword xsi:type="xsd:string">group_keyword</keyword>
    </auth>
    </urn:restoreDivision>
    </soapenv:Body>
    </soapenv:Envelope>

                                                      SOAP Response

    <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:ns1="urn:webservices2_0_0"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
    <SOAP-ENV:Body>
    <ns1:restoreDivisionResponse>
    <restoreDivisionReturn xsi:type="ns1:WSDivisionResponse">
    <message xsi:type="xsd:string">Successfully restored division.</message>
    <response xsi:type="ns1:WSDivision">
    <name xsi:type="xsd:string">Test Division</name>
    <address xsi:type="ns1:WSAddress">
    <street xsi:type="xsd:string">123 East</street>
    <street2 xsi:type="xsd:string">234 South</street2>
    <city xsi:type="xsd:string">Cityville</city>
    <state xsi:type="xsd:string">Idaho</state>
    <state_abbr xsi:type="xsd:string">ID</state_abbr>
    <zip xsi:type="xsd:int">87654</zip>
    </address>
    <phone xsi:type="xsd:string">8885554433</phone>
    <email xsi:type="xsd:string">test@test.com</email>
    <url xsi:type="xsd:string">http://www.test.com</url>
    <keyword xsi:type="xsd:string">default_keyword</keyword>
    </response>
    <result xsi:type="xsd:boolean">true</result>
    </restoreDivisionReturn>
    </ns1:restoreDivisionResponse>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    //create web service authentication
    WSAuthentication auth = new WSAuthentication();
    auth.username = "api_username";
    auth.password = "api_password";
    auth.api_key = "xxxxxxxxxxxxxx";
    auth.keyword = "parent_keyword_of_division_to_restore";
    auth.code = "12345";
     
    string keyword = "keyword of division to restore";
     
    //create task bind
    WS_DivisionBinding bind = new WS_DivisionBinding();
    bind.Url = "SSL//HOST_URL/webservices/division/2.0.0";
     
    //create result object
    WSDivisionResponse ws_result = new WSDivisionResponse();
     
    //call bind event
    ws_result = bind.restoreDivision(auth);
     
    //check to see if there was an error
    if (!ws_result.result)
    {
    //handle error
    label.Text = ws_result.message;
    }
    else
    {
    //handle successful response
    label.Text = ws_result.message;
    WSDivision d = ws_result.response;
    }
 Request
SSL//HOST_URL/httppost/nvp?version=2.0.0&method_name=division.restoreDivision&username={username}&password={password}&api_key={api_key}&code=12345&keyword={Division to be restored}


 Response
<?xml version="1.0" encoding="utf-8"?>
<restoreDivision>
  <message>Successfully restored division.</message>
  <error_code></error_code>
  <result>true</result>
  <response>
    <name>Division</name>
    <address>
      <street></street>
      <street2></street2>
      <city></city>
      <state></state>
      <state_abbr></state_abbr>
      <zip></zip>
    </address>
    <phone></phone>
    <email></email>
    <url></url>
    <keyword>31321</keyword>
    <default_code>12345</default_code>
    <divisions></divisions>
    <subscriptionnodes></subscriptionnodes>
  </response>
</restoreDivision>
static updateDivision ( auth,
division 
) [static]

Description:

Update an existing division. The division that you wish to update is specified by the keyword provided in the authentication object and the updated version of the division is specified in the division object that is also passed in.
Parameters:
WSAuthentication$authAuthentication Object
username  - String[40] (Required) - Username for company credentials
password  - String[40] (Required) - Password for company credentials
api_key   - String[40] (Required) - Credentials for company
code      - Integer    (Required) - Default shortcode or longcode for the division to be updated
keyword   - String[40] (Required) - Default keyword for the division to be updated
WSDivision$divisionDivision Object
name    - String  (Optional)
email   - String  (Optional)
phone   - String  (Optional) - Must include country code with number
url     - String  (Optional)
address - Object (Optional) - There is an address object inside the division object
 city       - String  (Optional)
 state      - String  (Optional)
 state_abbr - String  (Optional)
 street     - String  (Optional)
 street2    - String  (Optional)
 zip        - Integer (Optional)
 
Note:
Anything you add/change in the division object will be updated to the division.
Returns:
WSDivisionResponse $response
address object - If you set the address object this will return all that has been set
  city
  state
  state_abbr
  street
  street2
  zip
division object
  email          - If you set an email it will be show here
  keyword        - This is the default keyword for the division
  name           - Name of the division
  phone          - If you set an phone it will be show here
  url            - If you set an url it will be show here
result         - True/False
Code Examples:
<?php
$wsdl = 'SSL//HOST_URL/webservices/?version=2.0.0&wsdl';
$soap = new SoapClient($wsdl);

//create an authentication object
$auth = array();
$auth['username'] = 'api_username';
$auth['password'] = 'api_password';
$auth['api_key'] = 'xxxxxxxxxxxxxx';
$auth['keyword'] = 'keyword';
$auth['code'] = 12345;
 
//create a division object
$div = array();
$div["name"] = "Sample Division";
$div["phone"] = "5551234567";
$div["email"] = "email@test.com";
$div["url"] = "www.test.com";
//the following fields are optional to set but required to be passed in the object
$div["default_code"] = 12345;
$div["keyword"] = "";
$div["divisions"] = "";
$div["subscriptionnodes"] = "";
 
//create an address object to go with the division
$add = array();
$add["street"] = "123 East";
$add["street2"] = "234 North";
$add["city"] = "Cityville";
$add["state"] = "Idaho";
$add["state_abbr"] = "ID";
$add["zip"] = "12345";
$div["address"] = $add;

$results = $soap->updateDivision($auth, $div);

print_r($results);

if ($results->result == 0 || $results->error > 0) {
 //error processing
 throw new Exception($results->message);
} else {
 //after success processing
}
  
         SOAP Request
    <soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:urn="urn:webservices2_0_0">
    <soapenv:Header/>
    <soapenv:Body>
    <urn:updateDivision soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <auth xsi:type="urn:WSAuthentication">
    <username xsi:type="xsd:string">api_username</username>
    <password xsi:type="xsd:string">api_password</password>
    <api_key xsi:type="xsd:string">xxxxxxxxxxxxxx</api_key>
    <code xsi:type="xsd:string">12345</code>
    <keyword xsi:type="xsd:string">division_keyword</keyword>
    </auth>
    <division xsi:type="urn:WSDivision">
    <email xsi:type="xsd:string">test@test.com</email>
    <name xsi:type="xsd:string">Test Division</name>
    <phone xsi:type="xsd:string">8885554433</phone>
    <url xsi:type="xsd:string">http://www.test.com</url>
    <address xsi:type="urn:WSAddress">
    <city xsi:type="xsd:string">Cityville</city>
    <state xsi:type="xsd:string"></state>
    <state_abbr xsi:type="xsd:string">ID</state_abbr>
    <street xsi:type="xsd:string">123 East</street>
    <street2 xsi:type="xsd:string">234 South</street2>
    <zip xsi:type="xsd:integer">87654</zip>
    </address>
    </division>
    </urn:updateDivision>
    </soapenv:Body>
    </soapenv:Envelope>
         SOAP Response
    <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:ns1="urn:webservices2_0_0"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
    <SOAP-ENV:Body>
    <ns1:updateDivisionResponse>
    <updateDivisionReturn xsi:type="ns1:WSDivisionResponse">
    <message xsi:type="xsd:string">Successfully updated division.</message>
    <response xsi:type="ns1:WSDivision">
    <address xsi:type="ns1:WSAddress">
    <city xsi:type="xsd:string">Cityville</city>
    <state xsi:type="xsd:string">Idaho</state>
    <state_abbr xsi:type="xsd:string">ID</state_abbr>
    <street xsi:type="xsd:string">123 East</street>
    <street2 xsi:type="xsd:string">234 South</street2>
    <zip xsi:type="xsd:int">87654</zip>
    </address>
    <divisions SOAP-ENC:arrayType="ns1:WSDivision[0]" xsi:type="ns1:WSDivisionArray"/>
    <email xsi:type="xsd:string">test@test.com</email>
    <keyword xsi:type="xsd:string">31122</keyword>
    <name xsi:type="xsd:string">Test Division</name>
    <phone xsi:type="xsd:string"/>
    <subscriptionnodes SOAP-ENC:arrayType="ns1:WSSubscriptionnode[0]" xsi:type="ns1:WSSubscriptionnodeArray"/>
    <url xsi:type="xsd:string">http://www.test.com</url>
    </response>
    <result xsi:type="xsd:boolean">true</result>
    </updateDivisionReturn>
    </ns1:updateDivisionResponse>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    //create web service authentication
    WSAuthentication auth = new WSAuthentication();
    auth.username = "api_username";
    auth.password = "api_password";
    auth.api_key = "xxxxxxxxxxxxxx";
    auth.keyword = "keyword_of_division_to_update";
    auth.code = "12345";
     
    //create division object
    WSDivision div = new WSDivision();
    div.name = "Test Division";
    div.phone = "8885554433";
    div.email = "support@company.com";
    div.url = "www.company.com";
     
    //create address object
    WSAddress add = new WSAddress();
    add.street = "123 East";
    add.street2 = "234 South";
    add.city = "Cityville";
    add.state_abbr = "ID";
    add.zip = 87654;
    div.address = add;
     
    //create task bind
    WS_DivisionBinding bind = new WS_DivisionBinding();
    bind.Url = "SSL//HOST_URL/webservices/division/2.0.0";
     
    //create result object
    WSDivisionResponse ws_result = new WSDivisionResponse();
     
    //call bind event
    ws_result = bind.updateDivision(auth,div);
     
    //check to see if there was an error
    if (!ws_result.result)
    {
    //handle error
    label.Text = ws_result.message;
    }
    else
    {
    //handle successful response
    label.Text = ws_result.message;
    WSDivision d = ws_result.response;
    }
 Request
SSL//HOST_URL/httppost/nvp?version=2.0.0&method_name=division.updateDivision&username={username}&password={password]&api_key={api_key}&code=12345&keyword={Division Keyword}&name=UpdateDivisionName

 Response
<?xml version="1.0" encoding="utf-8"?>
<updateDivision>
  <message>Successfully updated division.</message>
  <error_code></error_code>
  <result>true</result>
  <response>
    <name>UpdateDivisionName</name>
    <address>
      <street></street>
      <street2></street2>
      <city></city>
      <state></state>
      <state_abbr></state_abbr>
      <zip></zip>
    </address>
    <phone></phone>
    <email></email>
    <url></url>
    <keyword>31321</keyword>
    <default_code>12345</default_code>
    <divisions></divisions>
    <subscriptionnodes></subscriptionnodes>
  </response>
</updateDivision>