07-05-2012 06:12 AM
07-05-2012 01:50 PM
07-16-2012 09:14 AM
package mypackage1;
import oracle.soap.transport.http.OracleSOAPHTTPConnection;
import org.apache.soap.encoding.soapenc.BeanSerializer;
import org.apache.soap.encoding.SOAPMappingRegistry;
import org.apache.soap.util.xml.QName;
import java.util.Vector;
import org.w3c.dom.Element;
import java.net.URL;
import org.apache.soap.Body;
import org.apache.soap.Envelope;
import org.apache.soap.messaging.Message;
import oracle.jdeveloper.webservices.runtime.WrappedDocLiteralStub;
import java.util.Properties;
/**
* Generated by the Oracle9i JDeveloper Web Services Stub/Skeleton Generator.
* Date Created: Mon Jul 16 17:24:04 IST 2012
* WSDL URL: http://172.27.34.55:8080/alfresco/api/AuthenticationService?WSDL
*
*
* Provides simple authentication capability.
*/
public class AuthenticationServiceStub extends WrappedDocLiteralStub
{
public AuthenticationServiceStub()
{
System.setProperty("oracle.soap.transport.noHTTPClient", "true");
m_httpConnection = new OracleSOAPHTTPConnection();
Properties props = new Properties();
props.put(OracleSOAPHTTPConnection.AUTH_TYPE, "basic");
props.put(OracleSOAPHTTPConnection.USERNAME, "admin");
props.put(OracleSOAPHTTPConnection.PASSWORD, "123456");
m_httpConnection.setProperties(props);
}
public static void main(String[] args)
{
try
{
AuthenticationServiceStub stub = new AuthenticationServiceStub();
// Add your own code here.
System.out.println("Authenticated sucessfully into alfresco using admin");
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
public String endpoint = "http://172.27.34.55:8080/alfresco/api/AuthenticationService";
private OracleSOAPHTTPConnection m_httpConnection = null;
private SOAPMappingRegistry m_smr = null;
public AuthenticationResult1 startSession(String username, String password) throws Exception
{
URL endpointURL = new URL(endpoint);
Envelope requestEnv = new Envelope();
Body requestBody = new Body();
Vector requestBodyEntries = new Vector();
String wrappingName = "startSession";
String targetNamespace = "http://www.alfresco.org/ws/service/authentication/1.0";
Vector requestData = new Vector();
requestData.add(new Object[] {"username", username});
requestData.add(new Object[] {"password", password});
requestBodyEntries.addElement(toElement(wrappingName, targetNamespace, requestData));
requestBody.setBodyEntries(requestBodyEntries);
requestEnv.setBody(requestBody);
Message msg = new Message();
msg.setSOAPTransport(m_httpConnection);
msg.send(endpointURL, "http://www.alfresco.org/ws/service/authentication/1.0/startSession", requestEnv);
Envelope responseEnv = msg.receiveEnvelope();
Body responseBody = responseEnv.getBody();
Vector responseData = responseBody.getBodyEntries();
return (AuthenticationResult1)fromElement((Element)responseData.elementAt(0), mypackage1.AuthenticationResult1.class);
}
public void endSession(String ticket) throws Exception
{
URL endpointURL = new URL(endpoint);
Envelope requestEnv = new Envelope();
Body requestBody = new Body();
Vector requestBodyEntries = new Vector();
String wrappingName = "endSession";
String targetNamespace = "http://www.alfresco.org/ws/service/authentication/1.0";
Vector requestData = new Vector();
requestData.add(new Object[] {"ticket", ticket});
requestBodyEntries.addElement(toElement(wrappingName, targetNamespace, requestData));
requestBody.setBodyEntries(requestBodyEntries);
requestEnv.setBody(requestBody);
Message msg = new Message();
msg.setSOAPTransport(m_httpConnection);
msg.send(endpointURL, "http://www.alfresco.org/ws/service/authentication/1.0/endSession", requestEnv);
Envelope responseEnv = msg.receiveEnvelope();
Body responseBody = responseEnv.getBody();
Vector responseData = responseBody.getBodyEntries();
fromElement((Element)responseData.elementAt(0), null);
}
}
07-16-2012 09:33 AM
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.