Search in sources :

Example 1 with WSClient

use of lucee.runtime.net.rpc.client.WSClient in project Lucee by lucee.

the class RemoteClientImpl method getId.

@Override
public String getId(Config config) {
    if (id != null)
        return id;
    Struct attrColl = new StructImpl();
    attrColl.setEL(KeyConstants._action, "getToken");
    Struct args = new StructImpl();
    args.setEL(KeyConstants._type, getType());
    args.setEL(RemoteClientTask.PASSWORD, getAdminPasswordEncrypted());
    args.setEL(RemoteClientTask.CALLER_ID, "undefined");
    args.setEL(RemoteClientTask.ATTRIBUTE_COLLECTION, attrColl);
    try {
        WSClient rpc = WSClient.getInstance(null, getUrl(), getServerUsername(), getServerPassword(), getProxyData());
        Object result = rpc.callWithNamedValues(config, KeyConstants._invoke, args);
        return id = IdentificationImpl.createId(securityKey, Caster.toString(result, null), false, null);
    } catch (Throwable t) {
        ExceptionUtil.rethrowIfNecessary(t);
        return null;
    }
}
Also used : StructImpl(lucee.runtime.type.StructImpl) WSClient(lucee.runtime.net.rpc.client.WSClient) Struct(lucee.runtime.type.Struct)

Example 2 with WSClient

use of lucee.runtime.net.rpc.client.WSClient in project Lucee by lucee.

the class Invoke method doWebService.

/**
 * @param webservice
 * @throws PageException
 */
private void doWebService(String webservice) throws PageException {
    if (username != null) {
        if (password == null)
            password = "";
    }
    ProxyData pd = StringUtil.isEmpty(proxy.getServer()) ? null : proxy;
    WSClient ws = username != null ? WSClient.getInstance(pageContext, webservice, username, password, pd) : WSClient.getInstance(pageContext, webservice, null, null, pd);
    Object rtn = ws.callWithNamedValues(pageContext, KeyImpl.init(method), data);
    // return
    if (!StringUtil.isEmpty(returnvariable))
        pageContext.setVariable(returnvariable, rtn);
// throw new ApplicationException("type webservice is not yet implemented for tag invoke");
}
Also used : ProxyData(lucee.runtime.net.proxy.ProxyData) WSClient(lucee.runtime.net.rpc.client.WSClient)

Aggregations

WSClient (lucee.runtime.net.rpc.client.WSClient)2 ProxyData (lucee.runtime.net.proxy.ProxyData)1 Struct (lucee.runtime.type.Struct)1 StructImpl (lucee.runtime.type.StructImpl)1