cancel
Showing results for 
Search instead for 
Did you mean: 

HWC Application Connection

Former Member
0 Kudos

Hello All,

I would like to programmatic ally create application connections and assign work flow for HWC project.

Am using 2.1.3.

Any help with sample source code is appreciated.

Note : This is not for Native Applications.

Thanks,

Priya James

Accepted Solutions (0)

Answers (1)

Answers (1)

Dan_vL
Product and Topic Expert
Product and Topic Expert
0 Kudos

I believe the admin API's are documented here.

http://infocenter.sybase.com/help/topic/com.sybase.infocenter.dc01852.0222/doc/html/sau1341520845321...

For creating application connections, one way to do this is to use the automatic device registration feature.  I believe you would tie your SUP server into your existing security provider and then users after initially installing the Hybrid Web Container on their device would use their regular user id and password on the settings screen and an application connection would be created for them.

You can try it out by selecting automatic device registration and then using the supAdmin and s3pAdmin (assuming that is your SUP server password) when creating a device registration.

Former Member
0 Kudos

Thanks for your response Daniel.

I am looking for some API. Exactly the requirement is ; I have more than 7000 unique clients who would be connecting to SCC 2.1.3. I have to manually register there User ID, Activation Code and assign workflow. I don't want it to be automatic registration as I would like to identify each unique customer.

So, I am looking for some API in Java or any other programming language which registers application and assign workflow to user dynamically in SCC 2.1.3.

Hope my point is clear.

Any help with sample source code would be appreciate.

Thanks,

Priya James

Former Member
0 Kudos

Hi,

SUP does provide some API's called Unwired Server Management API's.

Using these you can create a simple Java application, applet or Web Service which can be later consumed. You can choose the most desired way you want that fits your requirements.

To get more details you can look for Developer Guide: Unwired Server Management API SUP 2.1.3 ESD#3 (http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc01332.0213/doc/html/title...).

You can find some Code Samples as well (http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc01332.0213/doc/html/aba12...).

In your code, you just need to connect to your Unwired Server using Admin Credentials > create necessary User Id(s) > get the list of Workflows > Assign the desired ones > finally close the connection to your server.

Let me know if its useful.

Regards,

Dharmaraj.

Former Member
0 Kudos

Hi Mr Patil,

Thank You. It is very useful and Yes, I have seen those documents. Even tried to implement it but faced few issues.

Have you implemented it ? If yes, can u provide more detail documentation on it or any source which you have done. 

I have tried it implementing following the above document but haven't able to solve few bugs.

It would be grateful if I could get more help from your side.

Thank You,

James Priya. 

Dan_vL
Product and Topic Expert
Product and Topic Expert
0 Kudos

I have not personally tried the admin API.  What sort of problems are you running into? 

Do your 7000 users currently have a unique login and password in an authentication system such as LDAP?  The SUP server has login modules to work with existing authentication modules. 

http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc01703.0213/doc/html/asc12...

In this way, each user would login using their existing user id and password, the SUP server would verify the credentials against your LDAP server (or other system) and then automatically create the application connection after the user fills in the settings screen of the Hybrid Web Container.

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

Hi Priya James,

I would like to know the issues you are facing.

In order to make use of the User Management API's you need to first import the jar's > sup-admin-pub-client.jar & sup-admin-pub-common.jar which are available on the SUP server.

Then in your java code try connecting to the server:

ServerContext serverContext = new ServerContext();

serverContext = new ServerContext("your server ip/fqdn", 2001, "Admin user id", "Admin pwd", true);

Create an object of SUPApplication:

ClusterContext clusterContext = serverContext.getClusterContext("SUP Server's Cluster Context");

SUPApplication app = getSUPApplication(clusterContext);

Register the User:

AppConnectionRegistrationRequestVO acrrvo1 = new AppConnectionRegistrationRequestVO();

  Map<APPCONNECTION_REGISTRATION, Object> req1 = new HashMap<APPCONNECTION_REGISTRATION, Object>();

  req1.put(APPCONNECTION_REGISTRATION.USER_ID,user_name);

  req1.put(APPCONNECTION_REGISTRATION.ACTIVATION_CODE, "123");

  req1.put(APPCONNECTION_REGISTRATION.EXPIRATION_HOUR, "72");

  acrrvo1.setRequest(req1);

  Collection<AppConnectionRegistrationRequestVO> reqs = new ArrayList<AppConnectionRegistrationRequestVO>();

  reqs.add(acrrvo1);

  AppConnectionSettingVO settings = new AppConnectionSettingVO();

  Map<APPCONNECTION_SETTING_FIELD, Object> setting = new HashMap<APPCONNECTION_SETTING_FIELD, Object>();

  setting.put(APPCONNECTION_SETTING_FIELD.SECURITY_CONF,"admin");

  setting.put(APPCONNECTION_SETTING_FIELD.ALLOW_ROAMING, "true");

  setting.put(APPCONNECTION_SETTING_FIELD.DOMAIN, domain);

  setting.put(APPCONNECTION_SETTING_FIELD.SERVER_NAME, "SUP server ip/fqdn");

  settings.setSetting(setting);

  app.registerApplicationConnections("HWC", reqs, settings);

Try out the above piece of sample code and check if the user is getting created in SCC.

Regards,

Dharmaraj Patil

Former Member
0 Kudos

Hi Mr Patil,

Yes, I have done this part. I am successfully able to make connection in SCC. 2.1.3.

But I am getting one warning.

Log4j:WARN No appenders could be found for logger (com.sybase.ua.services.security.tool.ChiperTool).

log4j:WARN Please initialize the log4j system properly.

----

And I am working on assigning workflow but unable to understand the clear concept.

I am unable to understand how should I add my workflow dynamically to the user created in above way. Assuming my workflow name is "Happy"

Following is my code :

private SUPMobileWorkflow workflow;

ServerContext serverContext = new ServerContext("priya", 2001, "supAdmin", "supPwd", true);

clusterContext = serverContext.getClusterContext("wangf's cluster");

workflow = SUPObjectFactory.getSUPMobileWorkflow(clusterContext);

Thanks for your help.

Priya James

Dan_vL
Product and Topic Expert
Product and Topic Expert
0 Kudos

One other point is that in SUP 2.2 SP02, you can assign hybrid apps to the application template.  This means that if you have 100 users that have the Hybrid Web Container deployed to them and you wish to push a new hybrid app to all 100 users, you can simply assign the new hybrid app to the application template and all 100 users will get the new hybrid app.

See Automatic Hybrid App Provisioning at

http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc01203.0222/doc/html/vhu13...

Former Member
0 Kudos

Hi Mr. Patil,

I have worked with your code through Dos and eclipse. Through Dos it is creating connection but at some point of time the execution is stopping and have to press Ctrl + c to stop the execution..

And in Eclipse,  its giving Exception. Kindly check the screenshot.

I have google it about the issue and checked forums.. But no success ..

Can u help out ?

Thanks,

Priya James

Former Member
0 Kudos

After you register the user to the server, you need to assign required workflow(s) to that particular user.

For that you need to first get the numeric ID of the registered user.

AppConnectionFilterSortVO filter = new AppConnectionFilterSortVO();

FilterExpression<APPCONNECTION> fe = new FilterExpression< APPCONNECTION >();

FilterExpression< APPCONNECTION > fe1 = fe.eq(APPCONNECTION.DOMAIN, domain);

filter.setFilterExpression(fe1);

filter.setSortField(APPCONNECTION.APPLICATION_ID);

PaginationResult<ApplicationConnectionVO> result = app.getApplicationConnections(filter, 0L, required_size_int_value);

for (ApplicationConnectionVO appConn : result.getItems())

{

if(appConn.getApplicationUser().equals(registered_user_id))

{

                              deviceIdList.add(appConn.getNumericId());

}

}

Now, you need assign the required workflow to user.

For that you need to get the list of available workflows from the server.


List<MobileWorkflowVO> workflows = SUPObjectFactory.getSUPMobileWorkflow(your_cluster_context).getMobileWorkflowList();

Once the list of workflows is available, you can assign the desired workflow(s) to the user obtained in earlier code.


SUPMobileWorkflow  workflow =  SUPObjectFactory.getSUPMobileWorkflow(your_cluster_context);;

workflow.assignMobileWorkflowToDevices(List_of_workflow_ID’s, List_of_device_ID’s);

Check SCC to know if the workflows are assigned to the user.

Hope this helps.

Regards

Dharmaraj Patil

Former Member
0 Kudos

Hi Priya,

I will look into the warning message and try to find out the reason behind.

I have also provided some sample code to assign workflows to a user.

Please let me know if it works for you.

Don't forget to close connection to your server once the task is completed.

Regards,

Dharmaraj Patil.

Former Member
0 Kudos

Hello Dharam,

Sorry for late response, a good holiday break.   Your post have been really very helpful. I am able to make connections, delete and modify them through DOS.

Dharam, did u get time to check the Eclipse issue ?  I am trying with Eclipse but not able to understand why it is giving exceptions? Is there any issue with Jar files ?

Pls let me know if you have figure out the issue..

Looking forward for your response.

Thanks,

Priya James.

Former Member
0 Kudos

Hi Priya,

Glad to know you cracked it up.

Yes, I am checking the issue. It's just a warning message. Will try to find the cause.

Regards,

Dharmaraj Patil

Former Member
0 Kudos

Dharam,

Sorry to inform you. I guess you haven't read my second last post clearly or I wasn't able to write it down properly. Apologize !

1) The Code is working perfectly with Dos. I am able to create, delete and modify connections.

2) While in Eclipse, I am not able to run the same code and getting Exceptions. In the last screen shot, with the warning message, there is an Exception which I have printed.

Java.lang.reflect.InvocationTargetException

I am getting this exception in following line.

  app.registerApplicationConnections("HWC", reqs, settings);


Pls check the screen shot again.

Awaiting your reply at the earliest.

Thanks,

Priya James.

Former Member
0 Kudos

Hi Priya,

Were you able to successfully create users via Java client in eclipse ? I was able to connect;however, I am unable to call methods of SUPObjectFactory.

Former Member
0 Kudos

Hello Suraj,

Yes I am able to do it .. Everything works fine.

What is the issue you are facing ? And Which version of SUP you are using ?

Thanks.

James Priya

[REDACTED]

Former Member
0 Kudos

Hi James Priya,

I am unable to call methods of SUPObjectFactory. I have imported the respective libraries into my project.

If possible, you can attach your code snapshot or attach the project file.

-Suraj

Former Member
0 Kudos

Suraj ji,

Pls check the Jar files.

Use the Jar files of the same SUP.

You are doing it for SUP 2.1.3 or 2.2 ? I was not successful in 2.3 and the requirement was not of 2.3 so I haven't concentrated much on it.

Thanks,

Priya James.

Former Member
0 Kudos

Hello,

You can ignore log4j warning message. It has no effect on what you are trying to do. However, Unknown Error needs to be located in your code. You can try putting break points in your TestAPI.java class. Also check if messaging service is running properly and your code is able to access that service.

Regards,