cancel
Showing results for 
Search instead for 
Did you mean: 

Wordless exception during write

mellen
Champ in-the-making
Champ in-the-making
Hi all. I'm trying to integrate the Alfresco web services with .NET using Visual Studio 2008

I tried the alfresco-dotNET 0.2Beta but it wouldn't compile, so I generated the C# source for the services using WSDL, and changed the object types form System.Web.Services.Protocols.SoapHttpClientProtocol to Microsoft.Web.Service3.WebServicesClientProtocol.

This works ok for authentication, but if I try and write data then I get a SOAP exception with no error message in it. Here's the code:

        AuthenticationService auth = new AuthenticationService();

        AuthenticationResult ar = auth.startSession("Mellen", "Mellen");

        ContentService cs = new ContentService();

        UsernameToken userToken = new UsernameToken(ar.username, ar.ticket, PasswordOption.SendPlainText);
        cs.RequestSoapContext.Security.Timestamp.TtlInSeconds = 300;
        cs.RequestSoapContext.Security.Tokens.Add(userToken);

        StreamReader sr = new StreamReader(Server.MapPath("web.config"));

        byte[] newContent = new byte[sr.BaseStream.Length];

        sr.BaseStream.Read(newContent, 0, (int)sr.BaseStream.Length);

        sr.Close();

        Reference refer = new Reference();
        refer.store = new Store();
        refer.store.address = "SpacesStore";
        refer.store.scheme = "workspace";

        cs.write(refer, "web.config", newContent, new ContentFormat());

        auth.endSession(ar.ticket);

The exception gets thrown on the penultimate line.

I'm really new to Alfresco, so I'm guessing it's something simple.

Any help would be gratefully appreciated.
1 REPLY 1

mellen
Champ in-the-making
Champ in-the-making
OK, I seem to have sorted out the issue with the dotNET tool kit not compiling.

For some reason when converting the solution from vs2005 to vs2008 the web references went from Microsoft.Web.Services3.WebServicesClientProtocol to System.Web.Services.Protocols.SoapHttpClientProtocol. Doing a search and replace on the project sorted this out.

I'll let you know if I can use this to integrate the tool kit into a ASP.NET web page.