cancel
Showing results for 
Search instead for 
Did you mean: 

Access Portal Content using .NET..Urgent

Former Member
0 Kudos

Hello All,

I would like to extract user information like Roles assigned, iViews attached along with the ACL (access Control list) for existing Portal users using .NET (Csharp)

Im working on EP6 SP9.0, Visual Studio 2003 and .NET Framework 1.1. Patch3.

I had read a related post on link:

and if yes, this is the soluton, then request you to please let me know how can I create a webservices that can be used in .NET.

Am very confused on this actually. I have similar programs using Java which do extract this information along with the ACL. How can this be customized so that they can be used in .NET?

Also I chekced the UserManagement package thats available in Csharp and cud not find a way by which I can replicate the same in Csharp.

Please help.

Awaiting Reply.

Thanks and Warm Regards,

Ritu R Hunjan

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Ritu, I created some webservices with Netweaver Developer Studio to expose

the User Management API and I'm using it in C#

I posted this sample here:

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/webservices/... sample for web service to get a user property.doc

You can use this tutorial to learn how to create the Java WebService:

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/webservices/... to create a web service from a portal service.mht

I also extend this webservice to have functionality like change a user property, change password,

unblock user, retreive user groups and roles, assign to a role or group, etc.

This is an example (also in Java) for changing a user property:

public String setProperty(String userID, String property, String value)

{

String values[]= new String[1];

values[0]=value;

try

{

IUserFactory userFact = UMFactory.getUserFactory();

IUserMaint user = userFact.getMutableUser(

userFact.getUserByLogonID(

userID).getUniqueID());

res = user.setAttribute("com.sap.security.core.usermanagement", property,values);

user.commit();

}

catch(UMException ex)

{

//you exception code

}

catch (Exception ex2)

{

//your exception code

}

return "ok";

}

I can sent to you all the source code if you need it.

Hope this helps

Message was edited by: Rafael Cardenas

Message was edited by: Rafael Cardenas

Former Member
0 Kudos

Hi Rafael,

I would appreciate if you please send me the sample doc "samples/Code%20Sample%20for%20Web%20Service%20to%20Get%20a%20User%20Property.doc " on my id: rituh@kpitcummins.com, since im unable to access the link. Am getting an Error 400 - do not have permissions.

Currently am able to remove/extract total no of existing Portal users along with their User Profile Information and roles assigned to each one of the users.

Please confirm whether its just not possible to extract low-level information like iView/Pages/Worksets details for each user?

Have done this in Java but my requirement is in C#.

One option is as you said earlier - creation of Portal service & Web Service.

But is it possible to extract all this information without deploying any file (example .par) on WAS/Portal Server??

I other words, is it possible to extract information without the file being deployed on the portal, just like we write a simple Java program extracting information, compile and execute....

Please help.....its kinda urgent.

Awaiting Reply.

Thanks and Warm Regards,

Ritu R Hunjan

Former Member
0 Kudos

Hi Rafael,

I created web service from portal service for similar kind of functionality, but i am getting some configuration error.

Could u please tell me what are the configurations u performed or steps to keep in mind while creating a web service.

Thanks and regards

Santosh

Former Member
0 Kudos

Hi Ritu,

Roles assigned to a user could be retrieved by the user management service.

If you cant find the api you are looking for in the user management service or you need other portal services, you could expose them using your own custom web service.

In order to write a portal web service, you need to have the SAP NetWeaver Developer Studio. I suggest you ask in the portal forum on how exactly to create a web service.

I could not understand what you mean by: "I checked the UserManagement package that's available in Csharp and cud not find a way by which I can replicate the same in Csharp". You should know that not all the User management service API that is available in java is available is .NET.

Former Member
0 Kudos

Hi Tsachi,

To solve this initial problem of data extraction, im in the process of creating a Java Web Service/Portal Service (have created a dummy/sample Web Service) but now my second query is....

How am gonna use this Web Service in C#?

In other words, how should I execute the web services in C#????

Please help.

Awaiting Reply.

Thanks and Warm Regards,

Ritu R Hunjan

Former Member
0 Kudos

Hi Ritu,

You can consume a portal web service like any other web service.

You need to add a web reference to your the portal application project (right click on the References folder and choose "Add Web reference", and then in the URL field you need to type the webService URL.

This will add a new class (that inherits from SoapHttpClientProtocol) through which you would call the service.

It would be great if you will post your sample as an article on SDN, so everyone can benefit from it

Former Member
0 Kudos

Hi Tsachi,

Firstly thanks for responding so fast.

Im not able to add the Web Reference. Am getting a message as "The HTML document does not contain Web service discovery information."

how can I solve this...?

Also i tried creating a Portal Web Service from NDWS File->New->Others->Create a new Portal Applciation -> Portal Service but then i need to write some further code extending IService.

I have the APIs but am find stuck as what am to write here......?

if you know please guide me.

Take Care & awaiting reply.

Thanx and Warm Regards,

Ritu R Hunjan

Former Member
0 Kudos

You wrote that you created a dummy web service, is it not a portal web service?

There are 2 issues at hand here:

1. Creating a portal web service: to my knowledge you need to have a portal service and than to expose it as a web service using the NWDS. (In order to test your web service, you could use the NWDS Portal WebService Checker component). If this is troublesome, You might want to post a question in the portal forum, since those guys have more experience in this area.

2. consuming the web service: This could be done after you are done with creating the web service you would like to consume. This is the easy part