Consuming Calendar.ReadCalendars > CalendarFilterInvalid

B

Bart

Hello there,

I want to consume the PSI Calendar webservice for reporting purposes. I
created a shared datasource in Visual Studio 2008 (installed by SQL2008) to
access the PSI ListCalendars webservice and it works fine (finally).

Now I'm trying to consume the Calendar.ReadCalendars PSI webservice via the
same datasource but it keeps on giving me the following error:

***
The remote server returned an error: (500) Internal Server Error.
<?xml version="1.0" encoding="utf-8"?><soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>System.Web.Services.Protocols.SoapException:
ProjectServerError(s) LastError=CalendarFilterInvalid Instructions: Pass this
into PSClientError constructor to access all error information
at
Microsoft.Office.Project.Server.WebService.Calendar.ReadCalendars(String
filter, Boolean
autoCheckOut)</faultstring><faultactor>http://exsto:56737/SharedServices1/PSI/Calendar.asmx</faultactor><detail><errinfo><general><class
name="Value cannot be null.
Parameter name: s"><error id="13043" name="CalendarFilterInvalid"
uid="7ae0376c-f8c9-48ed-8184-c9e0fd6c3694"
/></class></general></errinfo></detail></soap:Fault></soap:Body></soap:Envelope>
----------------------------
Failed to execute web request for the specified URL.
Soap Fault:
System.Web.Services.Protocols.SoapException: ProjectServerError(s)
LastError=CalendarFilterInvalid Instructions: Pass this into PSClientError
constructor to access all error information
at
Microsoft.Office.Project.Server.WebService.Calendar.ReadCalendars(String
filter, Boolean autoCheckOut)
***
Obviously he complains about 'CalendarFilterInvalid', but the filter
parameter is set (see below) and even when put a value in it, it keeps on
giving the same error.

I am using this query...

<Query
<SoapAction>http://schemas.microsoft.com/office/project/server/webservices/Calendar/ReadCalendars</SoapAction>
<Method Name="ReadCalendars"
Namespace="http://schemas.microsoft.com/office/project/server/webservices/Calendar">
<Parameters>
<Parameter Name="filter">
<DefaultValue>String.Empty</DefaultValue>
</Parameter>
<Parameter Name="autoCheckOut">
<DefaultValue>false</DefaultValue>
</Parameter>
</Parameters>
</Method>
<ElementPath IgnoreNamespaces="true">*</ElementPath>
</Query>

Just can't figure out what to change to make it work. Can't find any usefull
info online or in the SDK... your help is appreciated ;-)

Thanks in advance, Bart
 
S

Stephen Sanderlin [MVP]

Bart,

I've confirmed your issue with passing in String.Empty and passed it
along to Microsoft.

Were you to run the exception through the PSClientError constructor
(obviously difficult in SSRS), I suspect you would receive the same
error in the InnerXML as I'm seeing:
"The filter parameter cannot be empty. You must at least specify the
table and fields to return."

If you are only interested in the GUID and Name, this query should work:
<Query>
<Method
Namespace="http://schemas.microsoft.com/office/project/server/webservices/Calendar/"
Name="ListCalendars"/>
<SoapAction>http://schemas.microsoft.com/office/project/server/webservices/Calendar/ListCalendars</SoapAction>
<ElementPath
IgnoreNamespaces="true">ListCalendarsResponse/ListCalendarsResult/diffgram/CalendarDataSet/Calendars</ElementPath>
</Query>

As far as using ReadCalendars, use the following query:
<Query>
<Method
Namespace="http://schemas.microsoft.com/office/project/server/webservices/Calendar/"
Name="ReadCalendars"/>
<SoapAction>http://schemas.microsoft.com/office/project/server/webservices/Calendar/ReadCalendars</SoapAction>
<Parameters>
<Parameter Name="filter" Type="xml">
</Parameter>
<Parameter Name="autoCheckOut" Type="boolean">
</Parameter>
</Parameters>
<ElementPath
IgnoreNamespaces="true">ReadCalendarsResponse/ReadCalendarsResult/diffgram/CalendarDataSet/Calendars</ElementPath>
</Query>

Make sure to leave the parameter elements blank!

Next, create two parameters in the dataset -- one called autoCheckOut
and another called filter.

Set 'false' as the parameter value for autoCheckOut and populate the
parameter value for filter with:
<?xml version="1.0" encoding="utf-16"?><Filter
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" filterTableName="Calendars"
xmlns="http://microsoft.com/ProjectServer/FilterSchema.xsd">
<Fields>
<Field tableName="Calendars" fieldName="CAL_CHECKOUTBY" />
<Field tableName="Calendars" fieldName="CAL_CHECKOUTDATE" />
<Field tableName="Calendars" fieldName="CAL_IS_STANDARD_CAL" />
<Field tableName="Calendars" fieldName="CAL_NAME" />
<Field tableName="Calendars" fieldName="CAL_UID" />
</Fields>
<Criteria />
</Filter>

Finally, delete whatever fields the report designer puts in the fields
for the dataset and add the fields from the Calendars table you want. In
my case, I just added CAL_UID and CAL_NAME. The field name and field
source should match.

Then, put the fields into the report and execute.

The reason you need to do it this way is that the query designer mangles
the XML needed for the filter if you put it into the query. Placing it
in a proper parameter for the dataset prevents this from happening.

Good luck!
Steve

--
Stephen Sanderlin, Project MVP
VP of Technology
MSProjectExperts

For Project Server Consulting: http://www.msprojectexperts.com
For Project Server Training: http://www.projectservertraining.com

Read our blog at: http://www.projectserverhelp.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top