cancel
Showing results for 
Search instead for 
Did you mean: 

Use the web service client with java and ecplipse

peppelinux
Champ in-the-making
Champ in-the-making
There are some operations to do for use correctly the web services client,

1- Create the project
2- Create the package org.alfresco.sample.webservice
3- Copy in this package the files that you find in this position http://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/HEAD/root/projects/sdk/samples/WebServic...
4 -Download the web service client
5- Click with the rigth button on the project "Build Path" –> "Configure Build Path" import alfresco-web-service-client.jar and other jars like axis.jar and related. You can find this file http://ws.apache.org/axis/ or in your alfresco installation  alfresco/tomcat/webapps/alfresco/WEB-INF/lib
6- Modify the webserviceclient.properties
7- You must create a package alfresco in the src directory and you put into the file webserviceclient.properties
I hope that someone will find useful this post
10 REPLIES 10

peppelinux
Champ in-the-making
Champ in-the-making
The only library necessary in the  server directory alfresco/tomcat/webapps/alfresco/WEB-INF/lib
are these:
alfresco-remote-api.jar   
commons-logging-1.1.jar 
mail.jar           
wss4j.jar
axis-1.4.jar              
jaxrpc.jar              
opensaml-1.0.1.jar 
xmlsec-1.4.1.jar
commons-discovery-0.2.jar 
log4j-1.2.15.jar        
wsdl4j-1.6.2.jar

grosisimo
Champ in-the-making
Champ in-the-making
I tried using those libraries only and it didn't work. java threw
Exception in thread "main" java.lang.NoClassDefFoundError: org/bouncycastle/jce/provider/BouncyCastleProvider
   at org.apache.ws.axis.security.WSDoAllSender.<clinit>(WSDoAllSender.java:69)
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Class.java:247)
   at org.apache.axis.utils.ClassUtils$2.run(ClassUtils.java:177)
   at java.security.AccessController.doPrivileged(Native Method)
   at org.apache.axis.utils.ClassUtils.loadClass(ClassUtils.java:160)
   at org.apache.axis.utils.ClassUtils.forName(ClassUtils.java:100)
   at org.apache.axis.deployment.wsdd.WSDDDeployableItem.getJavaClass(WSDDDeployableItem.java:353)
   at org.apache.axis.deployment.wsdd.WSDDDeployableItem.makeNewInstance(WSDDDeployableItem.java:295)
   at org.apache.axis.deployment.wsdd.WSDDDeployableItem.getNewInstance(WSDDDeployableItem.java:274)
   at org.apache.axis.deployment.wsdd.WSDDDeployableItem.getInstance(WSDDDeployableItem.java:260)
   at org.apache.axis.deployment.wsdd.WSDDChain.makeNewInstance(WSDDChain.java:125)
   at org.apache.axis.deployment.wsdd.WSDDDeployableItem.getNewInstance(WSDDDeployableItem.java:274)
   at org.apache.axis.deployment.wsdd.WSDDDeployableItem.getInstance(WSDDDeployableItem.java:260)
   at org.apache.axis.deployment.wsdd.WSDDDeployment.getGlobalRequest(WSDDDeployment.java:473)
   at org.apache.axis.configuration.FileProvider.getGlobalRequest(FileProvider.java:269)
   at org.apache.axis.AxisEngine.getGlobalRequest(AxisEngine.java:365)
   at org.apache.axis.client.AxisClient.invoke(AxisClient.java:126)
   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.action.ActionServiceSoapBindingStub.executeActions(ActionServiceSoapBindingStub.java:964)
   at com.hco.util.AlfrescoActionCallUtils.moveFromInboxAction(AlfrescoActionCallUtils.java:85)
   at com.hco.util.Test.main(Test.java:28)

That missing class is in bcprov-jdk15-137.jar, but i have already tried it a long time ago and that wasn't the only one needed. Finally I had to include all jars that come with alfresco (50Mb of jars).

Could you get it working? I only need to call action web service.
Is the list of jars documented somewhere?

Thanks in advance

dsauser001
Champ in-the-making
Champ in-the-making
I am trying to run the webservice samples that were extracted from Alfresco 3.1 jar files. I am using eclipse to run sample applications, but I am getting this "Failed to open session to passthru server" error. Does anyone encounter the same problem when connecting to Alfresco 3.1 by using the web service client.

Here is the complete error log:

Exception in thread "main" AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
faultSubcode:
faultString:
faultActor:
faultNode:
faultDetail:
   {http://www.alfresco.org/ws/service/authentication/1.0}AuthenticationFault:<ns1:errorCode>100</ns1:errorCode><ns1:message>Failed to open session to passthru server</ns1:message>
   {http://xml.apache.org/axis/}exceptionName:org.alfresco.repo.webservice.authentication.Authentication...
   {http://xml.apache.org/axis/}stackTrace:
   at org.alfresco.repo.webservice.authentication.AuthenticationWebService.startSession(AuthenticationWebService.java:96)
   at sun.reflect.GeneratedMethodAccessor4376.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397)
   at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186)
   at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
   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.handlers.soap.SOAPService.invoke(SOAPService.java:454)
   at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
   at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
   at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
   at java.lang.Thread.run(Thread.java:595)

   {http://xml.apache.org/axis/}hostname:JBOSSDEVSI1


   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
   at java.lang.reflect.Constructor.newInstance(Unknown Source)
   at java.lang.Class.newInstance0(Unknown Source)
   at java.lang.Class.newInstance(Unknown Source)
   at org.apache.axis.encoding.ser.BeanDeserializer.<init>(BeanDeserializer.java:104)
   at org.apache.axis.encoding.ser.BeanDeserializer.<init>(BeanDeserializer.java:90)
   at org.alfresco.webservice.authentication.AuthenticationFault.getDeserializer(AuthenticationFault.java:146)
   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.encoding.ser.BaseDeserializerFactory.getSpecialized(BaseDeserializerFactory.java:154)
   at org.apache.axis.encoding.ser.BaseDeserializerFactory.getDeserializerAs(BaseDeserializerFactory.java:84)
   at org.apache.axis.encoding.DeserializationContext.getDeserializer(DeserializationContext.java:464)
   at org.apache.axis.encoding.DeserializationContext.getDeserializerForType(DeserializationContext.java:547)
   at org.apache.axis.message.SOAPFaultDetailsBuilder.onStartChild(SOAPFaultDetailsBuilder.java:157)
   at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
   at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
   at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
   at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
   at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
   at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
   at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
   at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
   at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
   at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
   at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
   at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
   at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
   at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
   at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
   at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
   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)
   at org.alfresco.sample.webservice.GetStores.main(GetStores.java:60)[code]

grosisimo
Champ in-the-making
Champ in-the-making
Solved my part. I found the libraries needed to access through the web service interface.
Just in case someone have the same problem i had, the libraries needed are these:
activation.jar
axis-1.4.jar
bcprov-jdk15-137.jar
commons-discovery-0.2.jar
commons-logging-1.1.jar
jaxrpc.jar
mail.jar
opensaml-1.0.1.jar
saaj.jar
wsdl4j-1.5.1.jar
wss4j.jar
xalan.jar
xercesImpl-2.8.0.jar
xmlsec-1.4.1.jar
in order to access you need alfresco web service client library.

Bye

peppelinux
Champ in-the-making
Champ in-the-making
It's possible that in your code you use some methods needs the bcprov-jdk15-137.jar
The list of jars provided by me is only the base
Thanks for your contribute
Bye

mrsmile
Champ in-the-making
Champ in-the-making
im really thanks alot to the owner post..
Really help me how to config SDK web client into eclipse.
there is no error from beginning until it works.

1st - i get error - session not start, because my stupidly not start the server client alfresco.
after that. it works..

some post make resolve - just put before trying login to alfresco.
" WebServiceFactory.setEndpointAddress("http://10.232.10.171:8080/alfresco/api"); "

for me.. it not necessary.

thanks again…

samtiku
Champ in-the-making
Champ in-the-making
Hi All,

We have to integrate Alfresco for Document Management with our Java Application.
But I could not understand from where I need to download all API's, jars required. Please let me know the path and if possible some background on this. I am doing my development in MyEclipse.
Could you please let me know from where I need to download because I could see lot of options in Alfesco like SDK, Alfresco Labs. I just need it for upload/downloa/authentication kind of stuff from java application.

Regards,
Sameer

dhsaha
Champ in-the-making
Champ in-the-making
Hi I am getting the Following Error after importing the WerserviceSample project and When run it from CheckInCheckOut.java File. I put all the needed jar files as per document . I am getting the following exception while try to run it .

Exception in thread "main" AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
faultSubcode:
faultString:
faultActor:
faultNode:
faultDetail:
   {http://www.alfresco.org/ws/service/authentication/1.0}AuthenticationFault:<ns1:errorCode>100</ns1:errorCode><ns1:message>07170003 Failed to authenticate</ns1:message>
   {http://xml.apache.org/axis/}exceptionNameSmiley Surprisedrg.alfresco.repo.webservice.authentication.AuthenticationFa...
   {http://xml.apache.org/axis/}stackTrace:
   at org.alfresco.repo.webservice.authentication.AuthenticationWebService.startSession(AuthenticationWebService.java:90)
   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.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397)
   at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186)
   at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
   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.handlers.soap.SOAPService.invoke(SOAPService.java:454)
   at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
   at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
   at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
   at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859)
   at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
   at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1555)
   at java.lang.Thread.run(Thread.java:619)

   {http://xml.apache.org/axis/}hostname:BLR-P7107289


   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
   at java.lang.reflect.Constructor.newInstance(Unknown Source)
   at java.lang.Class.newInstance0(Unknown Source)
   at java.lang.Class.newInstance(Unknown Source)
   at org.apache.axis.encoding.ser.BeanDeserializer.<init>(BeanDeserializer.java:104)
   at org.apache.axis.encoding.ser.BeanDeserializer.<init>(BeanDeserializer.java:90)
   at org.alfresco.webservice.authentication.AuthenticationFault.getDeserializer(AuthenticationFault.java:146)
   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.encoding.ser.BaseDeserializerFactory.getSpecialized(BaseDeserializerFactory.java:154)
   at org.apache.axis.encoding.ser.BaseDeserializerFactory.getDeserializerAs(BaseDeserializerFactory.java:84)
   at org.apache.axis.encoding.DeserializationContext.getDeserializer(DeserializationContext.java:464)
   at org.apache.axis.encoding.DeserializationContext.getDeserializerForType(DeserializationContext.java:547)
   at org.apache.axis.message.SOAPFaultDetailsBuilder.onStartChild(SOAPFaultDetailsBuilder.java:157)
   at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
   at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
   at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
   at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
   at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
   at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
   at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
   at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
   at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
   at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
   at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
   at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
   at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
   at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
   at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
   at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
   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:73)
   at org.alfresco.sample.webservice.CheckOutCheckIn.main(CheckOutCheckIn.java:60)

dhsaha
Champ in-the-making
Champ in-the-making
Hi ,

i did the following steps:

1- Create the project in Eclipse
2- Create the package org.alfresco.sample.webservice
3- Copy in this package the files that you find in this position http://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/HEAD/root/projects/sdk/samples/WebServic...
4 -Download the web service client
5- Click with the rigth button on the project "Build Path" –> "Configure Build Path" import alfresco-web-service-client.jar and other jars like axis.jar and related.
6- Modify the webserviceclient.properties
7- You must create a package alfresco in the src directory and you put into the file webserviceclient.properties

my main purpose is to see sample upload and download file into the Alfresco server.

After that I put the following jar files in  server directory alfresco/tomcat/webapps/alfresco/WEB-INF/lib

alfresco-remote-api.jar
commons-logging-1.1.jar
mail.jar
wss4j.jar
axis-1.4.jar
jaxrpc.jar
opensaml-1.0.1.jar
xmlsec-1.4.1.jar
commons-discovery-0.2.jar
log4j-1.2.15.jar
wsdl4j-1.6.2.jar
alfresco-web-services-client 3.3 .jar
alfresco-web-client 3.3

I am using the WeBServiceSample project into my Eclipse from Alfresco SDK. I am using alfresco sdk 3.3 version.
After this when i started from CheckInCheckOut.java File in the WeBServiceSample project it is giving me the Following Error:

Exception in thread "main" org.alfresco.webservice.util.WebServiceException: Error starting session.
   at org.alfresco.webservice.util.AuthenticationUtils.startSession(AuthenticationUtils.java:88)
   at org.alfresco.sample.webservice.CheckOutCheckIn.main(CheckOutCheckIn.java:60)
Caused by: (404)Not Found
   at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:744)
   at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)
   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:73)
   … 1 more

Anybody Please suggest me What should I do to remove the ERROR?
From Which Class should i run in the WebServicesSample project ?
Anyone Please suggest me ASAP.

Thanks,
Dhruba