AnsweredAssumed Answered

Accessing Alfresco WS through WCF ?

Question asked by onewnan on Jul 17, 2008
Latest reply on Jul 14, 2010 by trakhan
.NET access is an important repository requirement for us at Policy Studies, Inc.  To test Alfresco's capabilities in this area I downloaded the dotnet WSE examples from http://forge.alfresco.com/projects/dotnet/.  However, I found that WSE requires configuration support which seems to be lacking VS 2008– according to http://forums.alfresco.com/en/viewtopic.php?f=27&t=5218.  Therefore I'm attempting to build a demo using WCF, as suggested in that posting, to accomodate current current .NET tooling and technology. 

I am surprised that I haven't found working WCF examples out on the Web or in the Alfresco toolkit.  Kindly let me know if
* I'm missing something in the way of working WCF examples
* there is any documentation for AlfrescoWS above and beyond the WSDL
* community and enterprise support the same WSDLs (am running community 2.1.0 at this point)

Having said that, here's a progress report so far trying to use WCF:

Using the attached ant task I was able to generate a file that compiles all services.  For this to work I first had to modify repository-service.wsdl, removing the nillable attributes for the two groups having ChildAssociation refs. 
Having done that, svcutil generates code.  It issues seemingly spurious error messages for some of the services of the form "The WSDL binding named XX is not valid because no match for operation YY was found in the corresponding portType definition."  However, it seems to generate interfaces and clients for all services.

While separate .cs files are generated for all services, it turns out authentication-service.cs contains interfaces for all of them.   I'm therefore feeding that one file to my .NET demo. 

The next step is to port pieces of the WSE demo–such as AuthenticationUtils and WebServicesFactory–to WCF.  I'll keep you posted…

attachment

============================



        …

   <property name="build.wcf.dir" location="DotNet/AlfrescoWS"/>
   <property name="wsdl.dir" location="DotNet/AlfrescoWS/wsdl"/>
         <property name="svcutil" location="C:/Program Files/Microsoft SDKs/Windows/v6.0A/Bin/SvcUtil.exe"/>

   <target name="genall"
      description="Using svcutil to generate stubs.">
      <exec executable="${svcutil}" dir="${wsdl.dir}">
         <arg value="/t:code" />
         <arg value="*.wsdl" />
         <arg value="*.xsd" />
         <arg value="/language:cs" />
         <arg value="/config:${build.wcf.dir}/output.config" />
         <arg value="/d:${build.wcf.dir}" />
         <arg value="/async" />
         <arg value="/targetClientVersion:Version30" />
      </exec>
   </target>

Outcomes