none
Project Server 2010 Custom Web Part Connection RRS feed

  • Question

  • Does anybody have any example code for a working web part for Project Server 2010?

    I want to create a Web Part to use on a PWA page in a Project Server 2010 environment. (Note: I'm using the beta image of Project Server, and C#, but I can translate from VB if needed.)

    I can't seem to get the web part to successfully call the appropriate services. For example, when I try to use ResourceClient.GetUserID(), I get and Exception: "There was no endpoint listening at http://moss.contoso.com/PWA/_vdi_bin/PSI/Resource.svc that could accept the message."

    I've even tried calling ResourceClient.Open() first. I've tried every combination I can think of, including using the .asmx?wsdl approach, with no luck. Thank you in advance to anybody who can help.

    - Doug

    Wednesday, May 12, 2010 5:11 PM

Answers

  • Hi Doug,

    I understand your frustration -- and unfortunately, it is more confusing than it has to be. This is how it works: You'll have to generate your proxies by targeting the "live" services, but at runtime, you target (that is point your URL to) ProjectServer.svc -- obviously you'll need the rest of the Uri components like server, port, path etc.

    Hope this helps,

    Boaz Lev

    MSFT

    Wednesday, May 19, 2010 4:47 AM
    Moderator

All replies

  • ? _vdi_bin ? --> _vti_bin

    Hopefully it is that simple :-)

    SDK : http://www.microsoft.com/downloads/details.aspx?FamilyID=46007f25-b44e-4aa6-80ff-9c0e75835ad9&displaylang=en (has updated WCF samples as well)

    cheers...pc

    Thursday, May 13, 2010 1:35 AM
    Moderator
  • Thanks, and I'm sorry, but no such luck. I just mis-typed it. (I am not allowed to hook up the 2010 demo system to our network.)

    What I really need is a working example of a web part the successfully speaks to project server, and can be hosted on a project server page. If I understand correctly, one that uses the .svc approach is supposed to be faster than one that uses the .asmx?wsdl approach, but I'll take whatever I can get.

    Can anybody provide any more detailed assistance/examples?

    Thanks again for trying, Patrick. I really do appreciate it.

    Doug

    Thursday, May 13, 2010 2:58 AM
  • No worries, didn't want to miss the obvious!

    I'd start here with the code samples and get them going and then build on them...

    http://msdn.microsoft.com/en-us/library/ms454394.aspx 

    Thursday, May 13, 2010 9:28 AM
    Moderator
  • Thanks, Patrick. Do those samples apply to Project Server 2010? Both Project Server and SharePoint are different for 2010.
    Thursday, May 13, 2010 10:00 AM
  • It is probably also of value to point out that the error message indicates I am successfully contacting the service (if the endpoint isn't found, you get a different message). The problem is that it seems to think there is not a GetUserID() function. The Open() method does cause the state to change from Created to Open, so it is definitely talking to the service. I just can't get it to get useful info from the service. I have similar difficulties with other services, like Admin.svc and QueueSystem.svc.

    Resource.svc doesn't even return user info, using either of these other two methods...

    • ResourceClient.ClientCredentials.UserName.UserName
    • ResourceClient.ClientCredentials.Windows.ClientCredential.UserName

    ...but I can get info like ResourceClient.State and ResourceClient.InnerChannel.Via.AbsolutePath.

    So it seems like somehow the service isn't initializing all the way or something.

    Thanks again, Patrick.

    Doug

    Thursday, May 13, 2010 11:04 AM
  • Doug, I'll pass on your issue to the WCF test team, they should be able to dig deeper than I can :-)

    Cheers...pc

    Friday, May 14, 2010 11:07 AM
    Moderator
  • Doug - test asked me to clafify that you are using the ProjectServer.svc and then using objects/methods within?....thx...pc
    Friday, May 14, 2010 10:28 PM
    Moderator
  • Doug, and you should call: GetCurrentUserUid()
    Friday, May 14, 2010 10:40 PM
    Moderator
  • Thanks, Patrick. As to calling GetCurrentUserUid(), it's not the specific call I'm asking about. (Also, I can't get on my test system at just this moment, but I think that might have been another mistype.) My problem is none of the calls to get useful information are working. My plan has been to get info, display it in a grid, change info, and update it back to the service. But if I can't get anything useful, I fail at step one.

    As to calling ProjectServer.svc, no. I've tried Project.svc, Resource.svc, QueueService.svc, and a couple others I can't remember at just this moment, because those are what are called by the examples I can find. The exact thing I am trying to do is to create a timesheet like thing that combines certain info together that's not in the timesheet as it exists today. Are you implying that I can get everything I need from ProjectServer.svc? Why would the other services exist?

    Thanks,

    Doug

    Monday, May 17, 2010 9:54 AM
  • Hi Doug,

    WCF back-end services in Project server are not directly accessible, you need to go through ProjectServer.svc on the front end. For an example that uses the Project service proxy file, see steps 4 - 6 in Procedure 3 of Walkthrough: Customizing the PWA Ribbon and Accessing the JS Grid. In particular, see the SetClientEndpoints method there, which programmatically configures the Project service.

    --Jim

    Monday, May 17, 2010 4:33 PM
  • I think I see what you mean. But I'm a little confused. It look like you create a proxy service called ProjectServer.svc (since there isn't one on the system to start with). Then, from another system, you access it and do what needs done. Right?

    If yes to the above, given the Hyper-V image that the beta is structured to run under, do I need to set up another image to run on Hyper-V and set up an inter-image network? Would that work? Am I missing something obvious? Is there some other, more direct route?

    Thanks

    Doug

    Monday, May 17, 2010 6:42 PM
  • Hi Doug,

    I understand your frustration -- and unfortunately, it is more confusing than it has to be. This is how it works: You'll have to generate your proxies by targeting the "live" services, but at runtime, you target (that is point your URL to) ProjectServer.svc -- obviously you'll need the rest of the Uri components like server, port, path etc.

    Hope this helps,

    Boaz Lev

    MSFT

    Wednesday, May 19, 2010 4:47 AM
    Moderator