How do I set my Username and Password through the SOAP API?
Official
Response
-
You must authenticate your requests to the API using your ScrumWorks Pro username and password.
Sample clients are included in the server installation directory:
{YOUR INSTALL DIR}/apiclient
The following is a Java example of API authentication:
....
@Override
public void setUp() throws Exception {
MasterReset.send();
ScrumWorksServiceLocator locator = new ScrumWorksServiceLocator();
endpoint = locator.getScrumWorksEndpointP
ort();
((ScrumWorksEndpointBindingStub)endpoint).setUsername("enter_username_here");
((ScrumWorksEndpointBindingStub)endpoint).setPassword(Password.getHashedPassword("enterp_password_here",
"testSalt"));
TimeZone.setDefault(TimeZone.getTimeZone(endpoint.getTimezone()));
-
You must authenticate your requests to the API using your ScrumWorks Pro username and password.
Sample clients are included in the server installation directory:
{YOUR INSTALL DIR}/apiclient
The following is a Java example of API authentication:
....
@Override
public void setUp() throws Exception {
MasterReset.send();
ScrumWorksServiceLocator locator = new ScrumWorksServiceLocator();
endpoint = locator.getScrumWorksEndpointP
ort();
((ScrumWorksEndpointBindingStub)endpoint).setUsername("enter_username_here");
((ScrumWorksEndpointBindingStub)endpoint).setPassword(Password.getHashedPassword("enterp_password_here",
"testSalt"));
TimeZone.setDefault(TimeZone.getTimeZone(endpoint.getTimezone())); -
-
-
-
Figured it out (was rusty on SOAP). In case anyone else is interested:
First I developed a singleton for access to the SOAP server:
//
// Get connection to the Scrumworks SOAP API (singleton).
//
class ScrumWorksAPI
{
private static $m_soapClient;
private function __construct() {}
public static function getInstance()
{
if (!self::$m_soapClient)
{
try
{
self::$m_soapClient = @new SoapClient("http://your.scrumworks.address:[port]...,
array(
"exceptions" => 1,
"login" => "your_username",
"password" => "your_password",
));
}
catch (SoapFault $e)
{
echo $e->faultstring;
}
}
return self::$m_soapClient;
}
}
Using the above you can, for example, call the getVersion() method:
echo ScrumWorksAPI::getInstance()->getVersion()->return;
If you wish to call other methods the use complex types (and just about everything is a complex type in the API, even things like int or string params), then you must first create a corresponding class. For example, consider the getProductByName() method. It takes an input param of type "getProductByName". You need to create a class with a public "getProductByName" member variable.
Example of calling getProductName:
class ProductName
{
public $productName;
public __construct($pname)
{
$this->productName = $pname;
}
}
$productName = new ProductName('Your Product Name');
$product = ScrumWorksAPI::getInstance()->getProductByName($productName);
echo $product->return->id;
You could, if so desired, wrap everything into the class:
class GetProductByName
{
public $productName;
public $return;
public function __construct($pname)
{
$this->productName = $pname;
$this->return = ScrumWorksAPI::getInstance()->getProductByName($this)->return;
}
}
$product = new GetProductByName('Your Product Name');
echo $product->return->id;
etc...
Also, you can obtain a list of all the complex types using:
var_dump(ScrumWorksAPI::getInstance()->__getTypes());
And a list of the available methods using:
print_r(ScrumWorksAPI::getInstance()->__getFunctions());
You could also use PHP's 'classmap' feature:
http://stackoverflow.com/questions/37... -
Loading Profile...



Twitter,
Facebook, or email.
EMPLOYEE

