none
Problems instantiating proxy classes within the Microsoft.Office.Project.Server.WebServiceProxy namespace RRS feed

  • Question

  • Hi,

    I'm currently developing a Project Server 2010 workflow, and I was interested in making some PSI calls within a custom code activity. Googling around I found a post by Jim Corbin talking about the WebServiceProxy namespace and its features. This post can be found here:

    http://social.technet.microsoft.com/Forums/en-US/project2010custprog/thread/e4e953bb-efe2-40e6-a8e3-806e0e2a105f

    There, Jim gives an example of how to instantiate the proxy class, using the following sentence:

    WfPsiProxy.Project proj = new WfPsiProxy.Project();

    The problem for me is that I get an error when trying to do so, complaining about the lack of constructor for that class:

    "The type 'Microsoft.Office.Project.Server.WebServiceProxy.Project' has no constructors defined"

    I've investigated about that kind of error and found out that it may be caused because the constructor for the proxy class is internal. In that case, does anybody know the way to access that constructor? Am I wrong about the internal thing? Is there any "special" way to work with the proxy classes within WebServiceProxy? Did I miss any previous steps?

    Any help would be really appreciated, thanks in advance.

     

    Friday, May 13, 2011 7:43 AM

Answers

All replies

  • Any ideas about this issue? I've been trying to find any kind of solution, but I'm still lost. Has anybody managed to make PSI calls from within the workflow context?

     

    Thanks in advance!

    Monday, May 16, 2011 10:07 AM
  •  Hi mr_sd,

    have you read through the overview developing PSI apps using WCF?

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

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

     

    In there they discuss the internal/external routing for the PSI web services and three ways to access them in your code.

    Specifically this part here: As it says you will need the Project server SDK to either build the proxy classes or the DLL.

    To use the front-end ProjectServer.svc for routing calls to the WCF interface of the PSI in your applications, you must do the following:

    1. Add references for the PSI services that you need. As described in Prerequisites for WCF-Based Code Samples, there are three ways to add a service reference. We

      • Set a reference to the ProjectServerServices.dll PSI proxy assembly.

      • Add the SvcUtil.exe output file of the WCF reference to the Visual Studio solution.

      • Add a service reference using Visual Studio.

      Instead of directly setting a service reference, we recommend that you set a reference to the ProjectServerServices.dll proxy assembly or add a proxy source file to your Visual Studio solution. The proxy assembly and source files are in the Project 2010 SDK download.

    2. Create endpoints for the services that point to ProjectServer.svc on the Project Web App front end. For more information about creating WCF endpoints for Project Server services, see Walkthrough: Developing PSI Applications Using WCF, which shows how to programmatically create WCF bindings and endpoints without using an app.config file, and also how to modify an app.config file by using the WCF Service Configuration Editor in Visual Studio.

    hope this helps I found the articles above very helpful and the walkthrough worked allowing me to copy the code and use in event handlers etc.

     


    Ray Letts Arbutus Solutions
    Monday, May 16, 2011 7:39 PM
  • Hi Ray,

    First, thanks for your reply. I took a look at your links, and although they seem to be useful to use the PSI services through WCF, that's not what I was looking for. As far as I was able to understand in Jim's post and in the WebServiceProxy namespace documentation, its seems like it is not necessary to actually create a binding for the client endpoints when using the provided proxy classes, since you're directly accessing the service through the proxy from within the workflow context. I don't know if I'm right with this conclussion, but if not, I don't see the point of using the classes from the WebServiceProxy namespace.

    Has anybody worked with any of the WebServiceProxy namespace classes? Should I forget about that and use the full connection procedure described in the links from Ray's post?

    Thanks!

     

     

    Tuesday, May 17, 2011 10:19 AM
  • Hi there,

    Still having the same problems here. I've been revolving around the whole web service and proxy documentation and found nothing useful. I don't know if I'm doing something wrong or what. What feels even stranger to me is that after calling the proj object instantiation with the constructor, smartsense lets me access the methods from the Project class through the proj instance. That makes me think that the constructor "is there", but is not reachable, which points to the internal constructor theory.

    Could anyone help me please?

    Thanks in advance!

    Thursday, May 19, 2011 11:29 AM
  • Hello again,

    I remember getting issues like that when I tried to use the proxies generated by one of those methods in the MSDN article I pointed you to above so I then did the DLL method, strong named it, added it to my project & GAC and then used code like this in an event handler in project server 2010

    using backendProject = SvcProject;

    then in the class declare this:

    private backendProject.ProjectClient projectClient;

    Then in the setClientEndPoint routine you can find in the articles above

     projectClient = new backendProject.ProjectClient(binding, address);
                    projectClient.ChannelFactory.Credentials.Windows.AllowedImpersonationLevel
                        = TokenImpersonationLevel.Impersonation;

                    projectClient.ChannelFactory.Credentials.Windows.AllowNtlm = true;

     

    Now I can use the projectClient to get access to the PSI project methods like this to get a project dataset

     projectDs = projectClient.ReadProject(projectGuid, backendProject.DataStoreEnum.PublishedStore); 

     

    So maybe try this method, refer to the above articles and this way you can call the WCF PSI in project server for your workflow.

     


    Ray Letts Arbutus Solutions
    Thursday, May 19, 2011 4:51 PM
  • Please see the May 19 answer in Ho to access project site through workflow code?.

    To summarize: To call the PSI from a workflow, you need to create a custom Project Server activity. There is a good example in the CustomWorkflow solution that's in the SDK download.


    Jim Corbin [MSFT]
    • Marked as answer by mr_sd Wednesday, May 25, 2011 2:40 PM
    Thursday, May 19, 2011 8:25 PM
  • Thank you Jim!

    Everything went down pretty well with the custom activity. It has been a way easier approach, and the example you pointed was quite useful!

     

    Thanks!

    Wednesday, May 25, 2011 2:43 PM