Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to access/get serviceProviderId after login #15

Closed
xciser77 opened this issue Aug 11, 2017 · 2 comments
Closed

How to access/get serviceProviderId after login #15

xciser77 opened this issue Aug 11, 2017 · 2 comments

Comments

@xciser77
Copy link

After login I like to get the serviceProviderID because it is needed for some/many request.
I can find the spid after login with $client->getResponse(), but it is protected so i cannot get the value.

How can I get the serviceproviderid after login ?
Code I use is:
$client = Factory::getSOAPClient('serveradres);
$client->login('username','password');

    $connectinfo = $client->getResponse();

In the above code I removed the server/username/password

@TwinMist
Copy link

TwinMist commented Aug 14, 2017

You will need to do a UserGetLoginInfoRequest, then in the UserGetLoginInfoResponse will return
<xs:element name="loginType" type=" LoginType "/>
<xs:element name="locale" type=" OCILocale "/>
<xs:element name="encoding" type=" Encoding "/>
<xs:element name="groupId" type=" GroupId " minOccurs="0"/>
<xs:element name="serviceProviderId" type=" ServiceProviderId " minOccurs="0"/>
<xs:element name="isEnterprise" type=" xs:boolean "/>
<xs:element name="passwordExpiresDays" type=" xs:int " minOccurs="0"/>
<xs:element name="lastName" type=" LastName " minOccurs="0"/>
<xs:element name="firstName" type=" FirstName " minOccurs="0"/>
<xs:element name="userId" type=" UserId "/>
<xs:element name="phoneNumber" type=" DN " minOccurs="0"/>

@lukebeer
Copy link
Owner

$serviceProviderId will be the service provider ID result or null.

<?php
require_once 'vendor/autoload.php';

use BroadworksOCIP\api\Rel_17_sp4_1_197_OCISchemaAS\OCISchemaLogin\UserGetLoginInfoRequest;

$client = BroadworksOCIP\Factory::getSOAPClient('ocip.example.com');
if ($client->login('user', 'pass')) {
    $request = new UserGetLoginInfoRequest();
    $serviceProviderId = $request->get($client)->getServiceProviderId();
    $client->logout();
}
?>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants