English 中文(简体)
add users to liferay from .net using liferay webservices
原标题:

I have some users in csv files to be imported into liferay. I don t have any idea about Hypersonic sql. So thought of inserting the users from .net.

I tried calling getUserById() to test. It gives me this error.

RPC Message updateUserRequest1 in operation updateUser1 has an invalid body name updateUser. It must be updateUser1

Any idea how to do this? or any other better approach to insert users into liferay. I know sql server and C#, no java

问题回答

I realize that this response is not particularly timely, but I just ran into this same issue, which I had to figure out to keep working.

The message you received is caused by a problem in the proxy classes generated by the tool:

RPC Message updateUserRequest1 in operation updateUser1 has an invalid body name updateUser. It must be updateUser1

You can go into the source code generated, Reference.cs, and look for the partial class definition of updateUserRequest1:

    [System.ServiceModel.MessageContractAttribute(WrapperName="updateUser", 
WrapperNamespace="urn:http.service.portal.liferay.com", IsWrapped=true)]
public partial class updateUserRequest1 {

and change the WrapperName value to "updateUser1":

    [System.ServiceModel.MessageContractAttribute(WrapperName="updateUser1", 
WrapperNamespace="urn:http.service.portal.liferay.com", IsWrapped=true)]
public partial class updateUserRequest1 {

This will get you past that issue. There is another problem in the generated proxy class for the UserService, but it can be fixed in the same way.

I ran into a couple of other gotchas beyond this, so created this blog post. There s a link there to a full VS2010 .Net solution if you need it. Good luck.

You first need to add a Web Reference to the specific web service in you .net project. for users you are specifically looking for the Portal_UserService web serice. If you are running Liferay locally for testing purposes, the complete address for the web service should look like this:

http://127.0.0.1:8080/tunnel-web/axis/Portal_UserService?wsdl

Otherwise, you can still point to a live installation by following the correct URL to the web service.

Now, as far as your project goes, once you have added the Web Reference to the project you should be able to call it and its methods/interfaces/classes and do all the coding in C#. Here is a small example:

name_of_your_web_reference.UserServiceSoapService proxy = new name_of_your_web_reference.UserServiceSoapService();
proxy.addUser("testUser",...);

All you should have to do is read through your cvs file and use the method to add the users in.

Here is also a reference to their most current API documents. You can look up the methods there if you have any additional problems calling them.

Liferay 6.0.5 API Portal Services

Hope it helps.





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签