cancel
Showing results for 
Search instead for 
Did you mean: 

Using the Web services interface

ucorda
Champ in-the-making
Champ in-the-making
I have been trying to use the Web services interface, but I have encountered a few difficulties

1) There is a mismatch between the implementation status as defined at http://wiki.alfresco.com/wiki/Alfresco_Draft_Implementation_Status and the actual operations made available via the WSDL files. For example, RepositoryService.wsdl declares 4 operations, while the implementation status document lists more than 4 and at the same time does not list getRepositories (which is included in the wsdl file)

2) I tried the getRepositories operation, by sending out this SOAP message:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:q0="http://www.cmis.org/2008/05" 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>
    <q0:getRepositories/>
  </soapenv:Body>
</soapenv:Envelope>

but I receive the following SOAP fault response:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<wsseSmiley Frustratedecurity xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <wsu:Timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="Timestamp-23366617">
        <wsu:Created xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2008-09-16T23:24:41.031Z</wsu:Created>
        <wsu:Expires xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2008-09-16T23:29:41.031Z</wsu:Expires>
      </wsu:Timestamp>
    </wsseSmiley Frustratedecurity>
  </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:InvalidSecurity</faultcode>
      <faultstring>An error was discovered processing the &lt;wsseSmiley Frustratedecurity&gt; header</faultstring>
    </soap:Fault>
  </soap:Body>
</soap:Envelope>

(not sure where the wsse header is coming from)

3) I tried to use getRepositoryInfo, which requires the input parameter repositoryID, but I have no idea where to get that information from. I set up my Alfresco server following exactly the Alfresco Tutorial PDF document. How do I get a repositoryID using the Web GUI?
15 REPLIES 15

vinila
Champ in-the-making
Champ in-the-making
Hi,

I am trying some web service requests to the "getRepositories" service under the WSDL, http://localhost:8080/alfresco/cmis/RepositoryService using the soapUI tool.

The request is

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cmis.org/2008/05">

<soapenv:Header>
   <wsseSmiley Frustratedecurity 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>2009-01-20T17:05:10.609Z</wsu:Created>
            <wsu:Expires>2010-01-20T20:05:22.609Z</wsu:Expires>
      </wsu:Timestamp>
      <wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
         <wsse:Username>vinila</wsse:Username>
         <wsseSmiley Tongueassword Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">TICKET_1c07c25b8dfae8e5746d877337c529aaa8b0ea7a</wsseSmiley Tongueassword>
      </wsse:UsernameToken>
   </wsseSmiley Frustratedecurity>
</soapenv:Header> 
 
<soapenv:Body>
   <ns:getRepositories/>
</soapenv:Body>

</soapenv:Envelope>

The response is

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Header>
      <wsseSmiley Frustratedecurity xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
         <wsu:Timestamp wsu:Id="Timestamp-25511702" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
            <wsu:Created>2009-02-04T14:36:03.515Z</wsu:Created>
            <wsu:Expires>2009-02-04T14:41:03.515Z</wsu:Expires>
         </wsu:Timestamp>
      </wsseSmiley Frustratedecurity>
   </soap:Header>
   <soap:Body>
      <soap:Fault>
         <faultcode>soapSmiley Frustratederver</faultcode>
         <faultstring>Incorrect password</faultstring>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>

In the response, I get this SOAP fault: "Incorrect password".

The password used in the request was obtained from, http://localhost:8080/alfresco/service/api/login?u=admin&pw=admin.

Am i missing something here? Please let me know how to resolve this issue.

Thanks

eliseosoto
Champ in-the-making
Champ in-the-making
I'm also having problems using soapUI, I've done a lot of tests…
where do I get the password for WS-Security? What's the username I should use? Right now my configuration is using the default admin/admin.

shamabbas
Champ in-the-making
Champ in-the-making
Hi all and eliseosoto

I was also just trying to solve this problem. First i tried to configure it admin/admin username/password but wasn't working then I add authentication web service by adding this wsdl in the project "
http://localhost:8080/alfresco/wsdl/authentication-service.wsdl"
and then in its startsession with request 1 i pasted the following code
<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>

and its response generated a ticket which I pasted into my ContentService requests against password and username i just used "admin" like this


<soapenv:Envelope xmlns:ns="http://www.alfresco.org/ws/service/content/1.0" xmlns:ns1="http://www.alfresco.org/ws/model/content/1.0" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

<soapenv:Header>
<requestFlow>
   <handler type="soapmonitor"/>
   <handler type="java:org.apache.ws.axis.security.WSDoAllReceiver">
     <parameter name="action" value="Signature Timestamp"/>
     <parameter name="signaturePropFile" value="server_crypto.properties" />
   </handler>
  </requestFlow>

  <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/2009/08/oasis-200908-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"><ticket>TICKET_b03374c1f074a1cf48ff5da1554c69b8fc2ca5e3</ticket></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:read xmlns="http://www.alfresco.org/ws/service/content/1.0">
         <ns:items>
            <!–You have a CHOICE of the next 2 items at this level–>
            <!–Zero or more repetitions:–>
            <ns1:nodes xmlns="http://www.alfresco.org/ws/model/content/1.0">
               <!–Optional:–>
               <ns1:store>
                  <!–Optional:–>
                  <ns1:scheme>workspace</ns1:scheme>
                   <ns1:address>SpacesStore</ns1:address>
               </ns1:store>
               <ns1:uuid>3d036088-e548-461f-ba9c-49497d3cf046</ns1:uuid>
                <ns1:path/>
            </ns1:nodes>
         </ns:items>
         <ns:property>{http://www.alfresco.org/model/content/1.0}content</ns:property>
      </ns:read>
   </soapenv:Body>
</soapenv:Envelope>

My authentication process worked but I got other exception. Which was

"<faultstring>org.xml.sax.SAXParseException: Element or attribute do not match QName production: QName::=(NCName':')?NCName.</faultstring>"
" <ns1:stackTrace xmlns:ns1="http://xml.apache.org/axis/">org.xml.sax.SAXParseException: Element or attribute do not match QName production: QName::=(NCName':')?NCName. "

I'm looking for its solution now maybe you have already done this? If not then authentication process can be resolve like such and maybe you can help me too with the exception im getting?

eliseosoto
Champ in-the-making
Champ in-the-making
sorry, I'm not working with Alfresco anymore, I think the WS support is a bit immature at this point.

shamabbas
Champ in-the-making
Champ in-the-making
ok I got. I'm trying to use alfresco web services and APIs to work with my Flex developed simple application to retrieve and upload files in alfresco repositroy. If you can help me anyway please do so. How and what APIs should use etc..

Thanks for quick response.

Sham

samir_raut34
Champ in-the-making
Champ in-the-making
I am using php to communicate with .NET web services and i am getting Invalid Security error.

<soap:Fault><faultcode xmlns:ns1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">ns1:InvalidSecurity</faultcode><faultstring>An error was discovered processing the &lt;wsseSmiley Frustratedecurity> header</faultstring></soap:Fault>

Please can any one help me out