cancel
Showing results for 
Search instead for 
Did you mean: 

[SOLVED]Creating a file

monitloth
Champ on-the-rise
Champ on-the-rise
I have a wizard, when I want to create a file, I use the following code:
   
AuthenticationUtils.startSession("admin", "admin");
      
      Store storeRef = new Store(Constants.WORKSPACE_STORE, "SpacesStore");
      String folderPath = "/app:company_home/cm:"/*;
      String timeStamp = new Long(System.currentTimeMillis()).toString();
      ParentReference docParent = new ParentReference(
      storeRef,
      null,
      folderPath,
      Constants.ASSOC_CONTAINS,
      "test");
      
      CMLCreate createDoc = new CMLCreate(
            "ref1",
            docParent,
            null,
            null,
            null,
            "test",
            null);
      
      CML cml = new CML();
      cml.setCreate(new CMLCreate[] {createDoc});
      
      UpdateResult[] results = WebServiceFactory.getRepositoryService().update(cml);
      Reference docRef = results[0].getDestination();
What I get is the following error:

Caused by: java.net.ConnectException: Connection refused: connect
   at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
   at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:154)
   at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
   at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
   at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
   at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
   at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
   at org.apache.axis.client.Call.invoke(Call.java:2767)
   at org.apache.axis.client.Call.invoke(Call.java:2443)
   at org.apache.axis.client.Call.invoke(Call.java:2366)
   at org.apache.axis.client.Call.invoke(Call.java:1812)
   at org.alfresco.webservice.authentication.AuthenticationServiceSoapBindingStub.startSession(AuthenticationServiceSoapBindingStub.java:187)
   at org.alfresco.webservice.util.AuthenticationUtils.startSession(AuthenticationUtils.java:79)
   … 41 more
Caused by: java.net.ConnectException: Connection refused: connect
   at java.net.PlainSocketImpl.socketConnect(Native Method)
   at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
   at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
   at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
   at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
   at java.net.Socket.connect(Socket.java:519)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSocketFactory.java:153)
   at org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSocketFactory.java:120)
   at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:191)
   at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:404)
   at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)
   … 52 more
I was "Admin" when I used the wizard.

It can be that the code for creating content is not right, but I get the error when authenticating.

Thanks.
1 REPLY 1

monitloth
Champ on-the-rise
Champ on-the-rise
Solution:
      FileInfo fileInfo = this.getFileFolderService().create(
            this.navigator.getCurrentNode().getNodeRef(), projName,
            ContentModel.TYPE_CONTENT);