cancel
Showing results for 
Search instead for 
Did you mean: 

Web Services Question

luisg
Champ in-the-making
Champ in-the-making
Hi there. I've a big problem here, and don't know how to solve this.
Imagine the following scenario:
An application, A, need to access to a Web Service, B, (in a Tomcat 1) to invoke something. When A, make a request to B, B should make an operation in Alfresco (running in Tomcat 2). example: A make a request to B to create a folder in Alfresco. you know what I mean?

I did a Web Service in Eclipse and I wrote a simple function to login in Alfresco: the function receive a user (String) and a password (String) and return a message (String) that indicate if login succeeds or not. After that I generated a client with the wsdl.
If I make a request with that client to the service, giving the credentials ('admin', 'admin') I get this:

Request:

<soapenv:Envelope>
   <soapenv:Body>
      <q0:novaAccao>
      <q0:user>admin</q0:user>
      <q0Smiley Tongueass>admin</q0Smiley Tongueass>
     </q0:novaAccao>
   </soapenv:Body>
</soapenv:Envelope>

Response:

<soapenv:Envelope>
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode>soapenvSmiley Frustratederver.userException</faultcode>
         <faultstring>java.lang.reflect.InvocationTargetException</faultstring>
         <detail>
            <ns1:hostname>pt0103</ns1:hostname>
         </detail>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>

pt0103 is the name of my machine.

The code is working, cause I did a test with a class with that code. the code is:

public String novaAccao(java.lang.String user, java.lang.String pass){
      final String URL = "http://localhost:8080/alfresco/api";
      String result;
      try
      {
         System.out.println("Logging to " + URL);
         WebServiceFactory.setEndpointAddress(URL);
         AuthenticationUtils.startSession(user, pass);
         result = "success";
      }
      catch(Exception e)
      {
            System.err.println("FAIL.");
            result = "fail";
            e.printStackTrace();
       }
      return result;
   }

Any of you have (or had) the same problem?
What am I doing wrong?

Please, Help

Luis
9 REPLIES 9

luisg
Champ in-the-making
Champ in-the-making
I'm just trying to call Alfresco Web Services from a normal Web Service.
When I try to do that, I get the above error…

Please, I need help!

cheffilet
Champ in-the-making
Champ in-the-making
Its not possible for you to use Alfresco-WebServices?

luisg
Champ in-the-making
Champ in-the-making
Hi.

Thanks for your reply.

I think you don't understand my question…

I did a class in java that use the alfresco web services. That class can create folders, can do searches in Alfresco, etc. Works perfectly if I run as a normal java application.
But I need to do a Web Service that accept some credentials from another application, and after that, use the alfresco Web Services to create content in Alfresco.

                                 —— request ——>                           ——– request ——–>
External ApplicationA                              My Web Service                                      Alfresco
                                 <—– response —–                          <——- response ——-

I can do make it work.

If I run the code in my Web Service as a normal java application, it works.

Luis

luisg
Champ in-the-making
Champ in-the-making
oops… the schema looks bad

External Application  ——-request——> My Web Service   —–request——> Alfresco

My Web Service should receive a request from the external application and should do a request to Alfresco.
It seams that exists a conflict in axis… Maybe because he uses axis in External Application  ——-request——> My Web Service and in My Web Service   —–request——> Alfresco

Help

Luis

luisg
Champ in-the-making
Champ in-the-making
Hi

I did find the solution.

My problem was not related with Alfresco, but with missing libraries in my project.

Now it's working.

Thanks

Luis

veraniego
Champ in-the-making
Champ in-the-making
Im having the same problem…

How did you solve this issue??

Thank you in advance

ramzi1c
Champ in-the-making
Champ in-the-making
Hi luisg

I have the same problem and i couldn't solve it, would you please list the libraries needed to run the application.

thanks in advance.

lahdo
Champ in-the-making
Champ in-the-making
try with them:
commons-discovery-0.2.jar
commons-logging-1.1.jar
jaxrpc.jar
log4j-1.2.15.jar
opensaml-1.0.1.jar
wsdl4j-1.6.2.jar

openpj
Elite Collaborator
Elite Collaborator
You can find all the dependencies needed to use the Web Service Client in the SDK Remote project in the Alfresco SDK.

Hope this helps.