03-16-2009 11:45 AM
03-17-2009 10:30 AM
03-17-2009 10:58 AM
03-17-2009 11:12 AM
03-17-2009 11:42 AM
03-17-2009 12:12 PM
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();
}
}
}
Hope this helps.
03-19-2009 11:35 AM
03-19-2009 11:47 AM
03-20-2009 10:31 AM
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);
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.