使用 liferay webservices 将用户从 .net 添加到 liferay

发布于 2024-11-01 16:11:20 字数 279 浏览 7 评论 0原文

我有一些 csv 文件中的用户要导入到 liferay 中。我对 Hypersonic sql 没有任何想法。所以想到从.net插入用户。

我尝试调用 getUserById() 进行测试。它给了我这个错误。

updateUser1 操作中的 RPC 消息 updateUserRequest1 具有无效的正文名称 updateUser。它必须是 updateUser1

知道如何做到这一点吗?或任何其他更好的方法将用户插入 liferay。我懂 sql server 和 C#,不懂 java

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

开始看清了 2024-11-08 16:11:20

我意识到这个回复不是特别及时,但我刚刚遇到了同样的问题,我必须弄清楚这个问题才能继续工作。

您收到的消息是由该工具生成的代理类存在问题引起的:

操作 updateUser1 中的 RPC 消息 updateUserRequest1 具有无效的正文名称 updateUser。必须是updateUser1

您可以进入生成的源代码 Reference.cs,并查找 updateUserRequest1: 的部分类定义:

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

并将 WrapperName 值更改为“updateUser1”:

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

这将使您解决该问题。为 UserService 生成的代理类中还有另一个问题,但可以用相同的方式修复。

除此之外,我遇到了其他一些问题,因此创建了这个 博客文章。如果您需要,这里有一个完整的 VS2010 .Net 解决方案的链接。祝你好运。

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.

小矜持 2024-11-08 16:11:20

您首先需要向 .net 项目中的特定 Web 服务添加 Web 引用。对于您专门寻找 Portal_UserService Web 服务的用户。如果您出于测试目的在本地运行 Liferay,则 Web 服务的完整地址应如下所示:

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

否则,您仍然可以通过遵循 Web 服务的正确 URL 来指向实时安装。

现在,就您的项目而言,一旦将 Web 引用添加到项目中,您应该能够调用它及其方法/接口/类,并使用 C# 进行所有编码。这是一个小例子:

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

您所要做的就是通读您的 cvs 文件并使用该方法添加用户。

这里还提供了他们最新的 API 文档的参考。如果您在调用这些方法时遇到任何其他问题,可以在那里查找这些方法。

Liferay 6.0.5 API 门户服务

希望有帮助。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文