AnsweredAssumed Answered

Help about C# can't catch SOAP Exception

Question asked by nguyenhoathuan on Apr 29, 2010
Hi everyone, I use C# to create a space in alfresco through webservice,now it can create new space if this not exist before.If it exist, the program through a soap exception, but C# can't catch it !?
Below is my code

RepositoryWebService.Reference refspace = new Alfresco.RepositoryWebService.Reference();//The space i want to create. I locate it is User Home space
           = spaceStore;                  
                    refspace.path = "app:company_home/cm:user_homes/cm:"+NormalizeNodeName(sSpaceName);//sSpaceName is string name of new space
                    {//First I enter this space if exist
                        RepositoryWebService.Predicate predicate = new Alfresco.RepositoryWebService.Predicate();
//I don't clearly understand predicate  var use for, but i see on wiki                      
                        predicate.Items = new[] { refspace };
                       [i] repoService.get(predicate);[/i]//I think this command write info on alfresco to predicate. But at line, occurred soap exception as I said and visual stop , instead of step to catch block

                        // repoService.get(predicate);
//If can't see this space mean that it not exist, so I create it
                    catch (Exception ex1)
//if the space not exist, it would create by this code
                        parentreference.childName = Constants.createQNameString(Constants.NAMESPACE_CONTENT_MODEL, sSpaceName);
                        NamedValue[] Properties = new NamedValue[1];
                        NamedValue nameProperty = new NamedValue();
               = Constants.PROP_NAME;
                        nameProperty.value = sFileName;
                        nameProperty.isMultiValue = false;
                        Properties[0] = nameProperty;
                        CMLCreate create = new CMLCreate();
                        create.parent = parentreference;
               = "1";
                        create.type = Constants.TYPE_FOLDER;
               = Properties;

                        // Create and execute the cml statement
                        CML cml = new CML();
                        cml.create = new CMLCreate[] { create };

                            UpdateResult[] updateResult = repoService.update(cml);
                            LocationUuid = updateResult[0].destination.uuid;
                            MessageBox.Show("I have created space "+sFileName+"/n Link Here: "+updateResult[0].destination.path);
                        catch (SoapException se)
                            MessageBox.Show("Can't create space " + sFileName + "/n" + se.ToString());

Maybe I catch this exception incorrect or other reason, but i really …crisis. So i post here,hope anyone give me few propose.
Thanks !