2017-09-05 67 views
0

我正在使用alfresco-web-service-client 5.0.a,我正嘗試登錄到部署在:localhost:8081/alfresco的露天社區2017。使用alfresco-web-service-client連接到露天2017年

這是我迄今所做的:

import org.alfresco.webservice.authentication.AuthenticationFault; 
    import org.alfresco.webservice.util.AuthenticationUtils; 
    import org.alfresco.webservice.util.WebServiceFactory; 

    public class Main { 

     public static void main(String[] args) throws AuthenticationFault { 

      WebServiceFactory.setEndpointAddress("http://localhost:8081/alfresco/api");  
      AuthenticationUtils.startSession("admin", "admin"); 

     } 
    } 

這是我所得到的,當我運行的類:

Exception in thread "main" org.alfresco.webservice.util.WebServiceException: Error starting session. 
    at org.alfresco.webservice.util.AuthenticationUtils.startSession(AuthenticationUtils.java:99) 
    at com.lydec.Main.Main.main(Main.java:12) 
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:84) 
    ... 1 more 
Caused by: java.net.ConnectException: Connection refused: connect 
    at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method) 
    at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) 
    at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) 
    at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) 
    at java.net.AbstractPlainSocketImpl.connect(Unknown Source) 
    at java.net.PlainSocketImpl.connect(Unknown Source) 
    at java.net.SocksSocketImpl.connect(Unknown Source) 
    at java.net.Socket.connect(Unknown Source) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
    at java.lang.reflect.Method.invoke(Unknown Source) 
    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) 
    ... 12 more 

的pom.xml

+0

爲什麼在地球上你使用古老的不推薦的WS *的東西?爲什麼不使用公共休息API和/或CMIS? – Gagravarr

+0

是的,加格拉瓦爾是對的。你應該使用CMIS。 –

回答

0

您不能使用舊的(不穩定的)5.0.a Web服務客戶端與服務器上的現代版Alfresco交談。

這個link提供了與基於SOAP的Web服務相關的變化信息。

如果您必須使用基於SOAP的Web服務,請使用CMIS(sample code)。

我強烈建議您改用REST代替基於SOAP的Web服務來處理任何事情。對於Alfresco,您可以使用新的public REST API,也可以使用CMIS(Atom Pub綁定或瀏覽器綁定)。