cancel
Showing results for 
Search instead for 
Did you mean: 

Using SoapUI to access the CMIS web services

eliseosoto
Champ in-the-making
Champ in-the-making
Here's an overview of what I've done so far in order to use the CMIS Web Service implementation using the SoapUItool.

This assumes that you have the Alfresco Labs 3 Server running with the default admin/admin username.

The first thing I do is add this WSDL to SoapUI: http://localhost:8080/alfresco/wsdl/authentication-service.wsdl
And then I call startSession like this:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.alfresco.org/ws/service/authentication/1.0">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:startSession>
         <ns:username>admin</ns:username>
         <ns:password>admin</ns:password>
      </ns:startSession>
   </soapenv:Body>
</soapenv:Envelope>
This returns a different ticket every time, here's an example:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <startSessionResponse xmlns="http://www.alfresco.org/ws/service/authentication/1.0">
         <startSessionReturn>
            <username>admin</username>
            <ticket>TICKET_610f5e78c8e4932181abb7ef7f8a405719ec07b6</ticket>
            <sessionid>FF7AD69527D3E12D7A16852F608A3D34</sessionid>
         </startSessionReturn>
      </startSessionResponse>
   </soapenv:Body>
</soapenv:Envelope>

Then I add the RepositoryService WSDL (http://localhost:8080/alfresco/cmis/RepositoryService?wsdl) and configure WS-Security by double-clicking the Project Name in the Navigator like this:
[img]http://www.postimage.org/Pq1purHA.jpg[/img]

Username: admin
Password: The ticket (i.e. TICKET_610f5e78c8e4932181abb7ef7f8a405719ec07b6)
Must Understand: Checked
Add Nonce: Checked
Add Created: Checked
Password Type: PasswordDigest (as seen in some other topics in this forums, please search)

Then I set this to be used in the Outgoing WSS of the Aut section of the Request:
[img]http://www.postimage.org/aV1nmbzA.jpg[/img]

However when I invoke getRepositories like this (raw request):
<soapenv:Envelope xmlns:ns="http://www.cmis.org/2008/05" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header>
      <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
         <wsse:UsernameToken wsu:Id="UsernameToken-26993204" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
            <wsse:Username>admin</wsse:Username>
            <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">ITpkPgLw8IrNtexohxt4WhVlpUM=</wsse:Password>
            <wsse:Nonce>MW7JmYsaQIrM8DD63cdN3Q==</wsse:Nonce>
            <wsu:Created>2009-03-11T21:31:13.284Z</wsu:Created>
         </wsse:UsernameToken>
      </wsse:Security>
   </soapenv:Header>
   <soapenv:Body>
      <ns:getRepositories/>
   </soapenv:Body>
</soapenv:Envelope>

I get this error:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Header>
      <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
         <wsu:Timestamp wsu:Id="Timestamp-31502959" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
            <wsu:Created>2009-03-11T21:31:13.299Z</wsu:Created>
            <wsu:Expires>2009-03-11T21:36:13.299Z</wsu:Expires>
         </wsu:Timestamp>
      </wsse:Security>
   </soap:Header>
   <soap:Body>
      <soap:Fault>
         <faultcode xmlns:ns1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">ns1:FailedAuthentication</faultcode>
         <faultstring>The security token could not be authenticated or authorized</faultstring>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>

The security token could not be authenticated or authorized, this is the problem I have right now. What am I doing wrong? Why isn't Alfresco accepting my password?

Please help  😎
11 REPLIES 11

jmetzger
Champ in-the-making
Champ in-the-making
Sorry if I am being dense, but I'm not sure exactly how to follow the steps that Paul provided.  What is throwing me is that the tutorial provided by Jeff Potts uses Curl, and I'm not sure how that relates to soapui.  It may be my ignorance in how to send the login credentials.  Could someone please show me an example of a soap message that included the credentials? 

>> 1. Don't bother getting a token
fine
>> 2. Set the password to admin instead of a token
where?
>> 3. Ensure you also add a timestamp WSS entry with a sensible Time to Live value
again, where?  Can this be part of the soap:Header contents?

Thanks for any help!
Jim

jmetzger
Champ in-the-making
Champ in-the-making
The following message worked very well for me in SoapUI, once I adjusted the timestamps to reflect the current time.  I also loaded the RepositoryService WSDL into SoapUI, and used http://cmis.alfresco.com/cmis/RepositoryService as my endpoint.

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://docs.oasis-open.org/ns/cmis/messaging/200908/">
   <soapenv:Header>
      <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soapenv:mustUnderstand="1">
         <wsu:Timestamp
            xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
            <wsu:Created>2012-05-30T23:54:15.985Z</wsu:Created>
            <wsu:Expires>2012-05-31T01:52:36.221Z</wsu:Expires>
         </wsu:Timestamp>
         <wsse:UsernameToken>
            <wsse:Username>admin</wsse:Username>
            <wsse:Password
               Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">admin</wsse:Password>
         </wsse:UsernameToken>
      </wsse:Security>
   </soapenv:Header>
   <soapenv:Body>
      <ns:getRepositories>
      </ns:getRepositories>
   </soapenv:Body>
</soapenv:Envelope>

And here is the response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Header>
      <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
         <wsu:Timestamp wsu:Id="Timestamp-1800908370" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
            <wsu:Created>2012-05-30T23:54:17.887Z</wsu:Created>
            <wsu:Expires>2012-05-30T23:59:17.887Z</wsu:Expires>
         </wsu:Timestamp>
      </wsse:Security>
   </soap:Header>
   <soap:Body>
      <getRepositoriesResponse xmlns="http://docs.oasis-open.org/ns/cmis/messaging/200908/" xmlns:ns2="http://docs.oasis-open.org/ns/cmis/core/200908/" xmlns:ns3="http://www.alfresco.org">
         <repositories>
            <repositoryId>371554cd-ac06-40ba-98b8-e6b60275cca7</repositoryId>
            <repositoryName>Main Repository</repositoryName>
         </repositories>
      </getRepositoriesResponse>
   </soap:Body>
</soap:Envelope>