As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
import org.apache.axis.client.Call; import org.apache.axis.client.Service; import javax.xml.namespace.QName; import javax.xml.rpc.ParameterMode; import org.apache.axis.message.SOAPHeaderElement; import org.apache.axis.message.SOAPEnvelope; import org.apache.ws.security.message.token.UsernameToken; import org.apache.ws.security.WSConstants; import org.apache.ws.security.message.WSSecHeader; import org.apache.ws.security.util.WSSecurityUtil; import org.w3c.dom.Document; import org.apache.ws.security.message.token.Timestamp; public class CMISTest { public static void main(String [] args) { try { String endpoint = "http://localhost:8080/alfresco/cmis/RepositoryService"; String repID = "33405a73-54c4-4fcf-92c5-2a7bb4a4568f"; Service serv = new Service(); Call call = (Call) serv.createCall(); call.setTargetEndpointAddress( new java.net.URL(endpoint) ); call.setOperationName(new QName("http://www.cmis.org/2008/05", "getRepositoryInfo")); call.addParameter( "id",new QName("http://www.w3.org/2001/XMLSchema','string"),ParameterMode.IN); call.setReturnType( new QName("http://www.w3.org/2001/XMLSchema','string")); //call.setUsername("admin"); //call.setPassword("admin"); SOAPEnvelope se = new SOAPEnvelope(); // dummy envelope to create Header Document doc = se.getAsDocument(); WSSecHeader secHeader = new WSSecHeader(); secHeader.setMustUnderstand(true); secHeader.insertSecurityHeader(doc); UsernameToken username = new UsernameToken(Boolean.TRUE,doc,WSConstants.PASSWORD_DIGEST); username.setName("admin"); username.setPassword("admin"); Timestamp ts = new Timestamp(true, doc,300); WSSecurityUtil.prependChildElement(doc, secHeader.getSecurityHeader(), username.getElement(), false); WSSecurityUtil.prependChildElement(doc, secHeader.getSecurityHeader(), ts.getElement(), false); SOAPHeaderElement she = new SOAPHeaderElement(secHeader.getSecurityHeader()); call.addHeader(she); String ret = call.invoke(new Object[] {repID}).toString(); System.out.println(ret); } catch (Exception e) { e.printStackTrace(); } } }
Entry entry = abdera.newEntry(); entry.setTitle("bigfile.bin"); entry.setSummary("something really big …"); entry.setContent(new FileInputStream("c:\\temp\bigfile.bin"), "application/octet-stream"); ClientResponse resp = client.post("http://localhost:8080/alfresco/service/api/path/workspace/SpacesStore/Company%20Home/Folder/children", entry);