Gemini Community Support Site

This Gemini community support site can be used to find solutions to product issues. You can log in using Open Id, Google Profile and even Facebook. Feel free to ask a question or browse FAQs and documentation. Product tour videos are also available along with how-to videos demonstrating key Gemini capabilities.




Problems with AddProjectGroupMembership()

api

Gemini version: 3.5.4 (build 2435)

Issue:

I'm trying to add users to project groups using the API. However, when I call GroupsService AddProjectGroupMembership(), I get an XmlException: '"' is an unexpected token. Expecting white space. Line 1, position 50.

I tried to refer to the sample code, but I didn't see anything regarding project groups in that codebase. What am I doing wrong?

photosinensis
· 1
photosinensis
Replies (27)
helpful
0
not helpful

Can you please post sample code?


Saar Cohen
· 5000
Saar Cohen
helpful
0
not helpful

A sample:

            UserEN tUser = us.GetUserByName(nUser.UserName);
            if (tUser == null)
            {
                tUser = us.CreateUser(nUser);
            }



            GroupsService gs = sm.GroupsService;
            ProjectGroupEN group = gs.GetProjectGroup(9);
            var groupid = gs.AddProjectGroupMembership(group.ProjectGroupID, 34, tUser.UserID);

34 is the project id, entered ad-hoc at the moment.


photosinensis
· 1
photosinensis
helpful
0
not helpful

Can you please check in Gemini if the user was added to the project group? It works for me but the return value is throwing an exception.


Saar Cohen
· 5000
Saar Cohen
helpful
0
not helpful

No, the user was not added to the project group.


photosinensis
· 1
photosinensis
helpful
0
not helpful

Are you sure that project group id 9 exists?


Saar Cohen
· 5000
Saar Cohen
helpful
0
not helpful

Yes, I am.


photosinensis
· 1
photosinensis
helpful
0
not helpful

Can you please use Fiddler2 (http://www.fiddler2.com/fiddler2/) to inspect what is the web service returns?


Saar Cohen
· 5000
Saar Cohen
helpful
0
not helpful

The return content is as follows:

POST //api/groups.ashx/projectgroups/9/projects/34/users/1063/membership HTTP/1.1
Accept: text/xml
Content-Type: text/xml
Host: [redacted]
Connection: Close


HTTP/1.1 411 Length Required
Content-Type: text/html; charset=us-ascii
Server: Microsoft-HTTPAPI/2.0
Date: Fri, 02 Apr 2010 14:20:24 GMT
Connection: close
Content-Length: 344

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Length Required</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Length Required</h2>
<hr><p>HTTP Error 411. The request must be chunked or have a content length.</p>
</BODY></HTML>


photosinensis
· 1
photosinensis
helpful
0
not helpful

Are you using a proxy server?

It seems like your server is rejecting the request because the length of it is not set.


Saar Cohen
· 5000
Saar Cohen
helpful
0
not helpful

No, I'm not using a proxy server. The Gemini server and my computer are on the same physical network.


photosinensis
· 1
photosinensis
helpful
0
not helpful

Which version of IIS and OS are you running?


Saar Cohen
· 5000
Saar Cohen
helpful
0
not helpful

This is on a Windows Sever 2008 instance running IIS 7.


photosinensis
· 1
photosinensis
helpful
0
not helpful

Very strange we have it running on win 2008 and IIS7.5 with no issues.

I will have to investigate and see if we can reproduce this.

Do you have WebDAV installed on the server?


Saar Cohen
· 5000
Saar Cohen
helpful
0
not helpful

No, WebDAV is not installed on this server.


photosinensis
· 1
photosinensis
helpful
0
not helpful

Can you please check using Fiddler2 the request? It should contain a Content-Length header.


Saar Cohen
· 5000
Saar Cohen
helpful
0
not helpful

The request header does NOT have a Content-Length header.


photosinensis
· 1
photosinensis
helpful
0
not helpful

Is there some way I can fix the malformed header?


photosinensis
· 1
photosinensis
helpful
0
not helpful

Please try the attached DLL and let me know how it goes.

I kept it the same version so you should be able to just drop it in and test.


Saar Cohen
· 5000
Saar Cohen
helpful
0
not helpful

The DLL actually breaks things to the point that my code does not compile.

The problem is that many methods seem to reference a UserEN type in the namespace "CounterSoft.Gemini.Commons", but that particular type does not exist in that namespace from what I can tell.  The UserEN type is in CounterSoft.Gemini.Commons.Entity.

For example, the following line:

(line 24)     UserEN user = sm.IssuesService.WhoAmI();

produces the following error:

    Error    2    Cannot implicitly convert type 'CounterSoft.Gemini.Commons.UserEN' to 'CounterSoft.Gemini.Commons.Entity.UserEN'    C:\Documents and Settings[redacted]\My Documents\Visual Studio 2008\Projects\geminiTest2\geminiTest2\Program.cs



photosinensis
· 1
photosinensis
helpful
0
not helpful

Are you sure that you are running using the 3.5.4 webservice dll?


Saar Cohen
· 5000
Saar Cohen
helpful
0
not helpful

Okay, everything compiles again.

However, after substituting out the old DLL, I still have the same problem as I did when I made the first post.  Nothing has changed with respect to the request header.


photosinensis
· 1
photosinensis
helpful
0
not helpful

Is it possible for you to test this on another client?


Saar Cohen
· 5000
Saar Cohen
helpful
0
not helpful

New computer, fresh compile.

Same error.


photosinensis
· 1
photosinensis
helpful
0
not helpful

Can you please test against our site? (http://gemini.countersoft.com)


Mark Wing
· 9108
Mark Wing
helpful
0
not helpful

We have managed to replicate the issue and are looking for a solution.


Mark Wing
· 9108
Mark Wing
helpful
0
not helpful

Please use the attached it shoud solve your issue.


Mark Wing
· 9108
Mark Wing
helpful
0
not helpful

Thanks!  That works!


photosinensis
· 1
photosinensis