Search in sources :

Example 1 with MSSRegistrationReq

use of fi.laverca.jaxb.mss.MSSRegistrationReq in project laverca by laverca.

the class MssClient method sendMat.

/**
 * Sends an MSS request.
 *
 * @param req Abstract request type
 * @param context Context
 * @param security WSSE security headers
 * @throws IOException if a HTTP communication error occurred i.e. a SOAP fault was generated by the <i>local</i> SOAP client stub.
 */
private MessageAbstractType sendMat(final MessageAbstractType req, final LavercaContext context, final Security security) throws AxisFault, IOException {
    AbstractSoapBindingStub port = null;
    try {
        Long timeout = null;
        if (req instanceof MSSSignatureReq) {
            timeout = ((MSSSignatureReq) req).getTimeOut();
            port = (MSS_SignatureBindingStub) this.mssService.getMSS_SignaturePort(this.MSSP_SI_URL);
        } else if (req instanceof MSSReceiptReq) {
            port = (MSS_ReceiptBindingStub) this.mssService.getMSS_ReceiptPort(this.MSSP_RC_URL);
        } else if (req instanceof MSSHandshakeReq) {
            port = (MSS_HandshakeBindingStub) this.mssService.getMSS_HandshakePort(this.MSSP_HS_URL);
        } else if (req instanceof MSSStatusReq) {
            port = (MSS_StatusQueryBindingStub) this.mssService.getMSS_StatusQueryPort(this.MSSP_ST_URL);
        } else if (req instanceof MSSProfileReq) {
            port = (MSS_ProfileQueryBindingStub) this.mssService.getMSS_ProfileQueryPort(this.MSSP_PR_URL);
        } else if (req instanceof MSSRegistrationReq) {
            port = (MSS_RegistrationBindingStub) this.mssService.getMSS_RegistrationPort(this.MSSP_RG_URL);
        }
        if (port == null) {
            throw new IOException("Invalid request type");
        }
        if (timeout != null) {
            // ETSI TS 102 204 defines TimeOut in seconds instead of milliseconds
            port.setTimeout(timeout.intValue() * 1000);
        }
    } catch (ServiceException se) {
        log.error("Failed to get port: " + se.getMessage());
        throw new IOException(se.getMessage());
    }
    try {
        if (port._getCall() == null) {
            port._createCall();
        }
    } catch (Exception e) {
        log.fatal("Could not do port._createCall()", e);
    }
    // Set tools for each context.
    port.setProperty(ComponentsHTTPSender.HTTPCLIENT_INSTANCE, this.getHttpClient());
    LavercaSSLTrustManager.getInstance().setExpectedServerCerts(this.expectedServerCerts);
    MessageAbstractType resp = null;
    if (port instanceof MSS_SignatureBindingStub) {
        resp = ((MSS_SignatureBindingStub) port).MSS_Signature((MSSSignatureReq) req);
    } else if (port instanceof MSS_StatusQueryBindingStub) {
        resp = ((MSS_StatusQueryBindingStub) port).MSS_StatusQuery((MSSStatusReq) req);
    } else if (port instanceof MSS_ReceiptBindingStub) {
        resp = ((MSS_ReceiptBindingStub) port).MSS_Receipt((MSSReceiptReq) req);
    } else if (port instanceof MSS_HandshakeBindingStub) {
        resp = ((MSS_HandshakeBindingStub) port).MSS_Handshake((MSSHandshakeReq) req);
    } else if (port instanceof MSS_ProfileQueryBindingStub) {
        resp = ((MSS_ProfileQueryBindingStub) port).MSS_ProfileQuery((MSSProfileReq) req);
    } else if (port instanceof MSS_RegistrationBindingStub) {
        resp = ((MSS_RegistrationBindingStub) port).MSS_Registration((MSSRegistrationReq) req, security);
    } else {
        throw new IOException("Invalid call parameters");
    }
    if (context != null) {
        try {
            context.setMessageContext(port.getMessageContext());
        } catch (ServiceException e) {
            log.warn("Unable to pass context", e);
        }
    }
    return resp;
}
Also used : MSSProfileReq(fi.laverca.jaxb.mss.MSSProfileReq) MSSRegistrationReq(fi.laverca.jaxb.mss.MSSRegistrationReq) MSS_ReceiptBindingStub(fi.laverca.mss.ws.MSS_ReceiptBindingStub) MSSHandshakeReq(fi.laverca.jaxb.mss.MSSHandshakeReq) MSS_ProfileQueryBindingStub(fi.laverca.mss.ws.MSS_ProfileQueryBindingStub) MSS_StatusQueryBindingStub(fi.laverca.mss.ws.MSS_StatusQueryBindingStub) IOException(java.io.IOException) MSSSignatureReq(fi.laverca.jaxb.mss.MSSSignatureReq) MSSStatusReq(fi.laverca.jaxb.mss.MSSStatusReq) MSS_RegistrationBindingStub(fi.laverca.mss.ws.MSS_RegistrationBindingStub) GeneralSecurityException(java.security.GeneralSecurityException) ServiceException(javax.xml.rpc.ServiceException) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) MSS_HandshakeBindingStub(fi.laverca.mss.ws.MSS_HandshakeBindingStub) ServiceException(javax.xml.rpc.ServiceException) MSS_SignatureBindingStub(fi.laverca.mss.ws.MSS_SignatureBindingStub) MSSReceiptReq(fi.laverca.jaxb.mss.MSSReceiptReq) MessageAbstractType(fi.laverca.jaxb.mss.MessageAbstractType) AbstractSoapBindingStub(fi.laverca.util.AbstractSoapBindingStub)

Example 2 with MSSRegistrationReq

use of fi.laverca.jaxb.mss.MSSRegistrationReq in project laverca by laverca.

the class RegistrationClient method send.

/**
 * Send an MSS_RegistrationRequest (with MReg extension)
 *
 * @param req MReg Request
 * @return parsed MReg response
 * @throws IOException
 */
public MregResponse send(final MregRequest req) throws IOException {
    req.context = new LavercaContext();
    MSSRegistrationReq _req = req.toMSSReq(this.client);
    MSSRegistrationResp _resp = this.client.send(_req, req.context, req.security);
    return new MregResponse(_resp, req.context);
}
Also used : MSSRegistrationReq(fi.laverca.jaxb.mss.MSSRegistrationReq) LavercaContext(fi.laverca.util.LavercaContext) MSSRegistrationResp(fi.laverca.jaxb.mss.MSSRegistrationResp)

Example 3 with MSSRegistrationReq

use of fi.laverca.jaxb.mss.MSSRegistrationReq in project laverca by laverca.

the class RegistrationClient method send.

/**
 * Send a multi-operation MSS_RegistrationRequest (with MReg extension)
 * <p>Reads the target and AP_TransID from {@code req}. Adds a new RegistrationInput for each element in {@code additionalRequests}
 * @param req MReg Request
 * @param additionalRequests Additional requests (only operation content is fetched from these - target is ignored
 * @return parsed MReg response
 * @throws IOException
 */
public MregResponse send(final MregRequest req, final List<MregRequest> additionalRequests) throws IOException {
    req.context = new LavercaContext();
    MSSRegistrationReq _final = req.toMSSReq(this.client);
    int i = 100;
    for (MregRequest data : additionalRequests) {
        MSSRegistrationReq _data = data.toMSSReq(this.client);
        RegistrationInput _input = _data.getRegistrationInputs().get(0);
        _input.setInputId("_" + i++);
        _final.getRegistrationInputs().add(_input);
    }
    MSSRegistrationResp _resp = this.client.send(_final, req.context, req.security);
    return new MregResponse(_resp, req.context);
}
Also used : MSSRegistrationReq(fi.laverca.jaxb.mss.MSSRegistrationReq) LavercaContext(fi.laverca.util.LavercaContext) RegistrationInput(fi.laverca.jaxb.mreg.RegistrationInput) MSSRegistrationResp(fi.laverca.jaxb.mss.MSSRegistrationResp)

Example 4 with MSSRegistrationReq

use of fi.laverca.jaxb.mss.MSSRegistrationReq in project laverca by laverca.

the class MssClient method createRegistrationReq.

/**
 * Create a MSS_RegistrationReq
 *
 * @param apTransId
 * @return
 */
public MSSRegistrationReq createRegistrationReq(final String apTransId) {
    MSSRegistrationReq req = mssObjFactory.createMSSRegistrationReq();
    this.initializeRequestMessage(req, apTransId);
    req.setMobileUser(mssObjFactory.createMobileUserType());
    return req;
}
Also used : MSSRegistrationReq(fi.laverca.jaxb.mss.MSSRegistrationReq)

Example 5 with MSSRegistrationReq

use of fi.laverca.jaxb.mss.MSSRegistrationReq in project laverca by laverca.

the class MregRequest method toMSSReq.

/**
 * Construct a raw {@link MSSRegistrationReq} object to be sent via {@link MssClient}
 * @param client MSS Client reference used for building the {@link MSSRegistrationReq}
 * @return a {@link MSSRegistrationReq} built from this {@link MregRequest}
 */
public MSSRegistrationReq toMSSReq(final MssClient client) {
    MSSRegistrationReq req = client.createRegistrationReq(this.apTransId);
    RegistrationInput input = new RegistrationInput();
    input.setTarget(this.buildTarget());
    MregRequestType mreq = new MregRequestType();
    OperationInputType prop;
    if (this.wireless) {
        prop = new WirelessOperation();
        mreq.setWirelessOperation((WirelessOperation) prop);
    } else {
        prop = new ProvisioningOperation();
        mreq.setProvisioningOperation((ProvisioningOperation) prop);
    }
    for (MregParam param : this.params) {
        prop.getParameters().add(param.getType());
    }
    prop.setName(this.operation);
    prop.setNameSpace(this.namespace);
    input.getMregRequests().add(mreq);
    input.setInputId("_1");
    req.getRegistrationInputs().add(input);
    // Override AP ID and AP PWD if they are set for this req.
    if (this.senderApId != null)
        req.getAPInfo().setAPID(this.senderApId);
    if (this.senderApPwd != null)
        req.getAPInfo().setAPPWD(this.senderApPwd);
    return req;
}
Also used : WirelessOperation(fi.laverca.jaxb.mreg.WirelessOperation) MSSRegistrationReq(fi.laverca.jaxb.mss.MSSRegistrationReq) MregRequestType(fi.laverca.jaxb.mreg.MregRequestType) OperationInputType(fi.laverca.jaxb.mreg.OperationInputType) ProvisioningOperation(fi.laverca.jaxb.mreg.ProvisioningOperation) RegistrationInput(fi.laverca.jaxb.mreg.RegistrationInput)

Aggregations

MSSRegistrationReq (fi.laverca.jaxb.mss.MSSRegistrationReq)5 RegistrationInput (fi.laverca.jaxb.mreg.RegistrationInput)2 MSSRegistrationResp (fi.laverca.jaxb.mss.MSSRegistrationResp)2 LavercaContext (fi.laverca.util.LavercaContext)2 MregRequestType (fi.laverca.jaxb.mreg.MregRequestType)1 OperationInputType (fi.laverca.jaxb.mreg.OperationInputType)1 ProvisioningOperation (fi.laverca.jaxb.mreg.ProvisioningOperation)1 WirelessOperation (fi.laverca.jaxb.mreg.WirelessOperation)1 MSSHandshakeReq (fi.laverca.jaxb.mss.MSSHandshakeReq)1 MSSProfileReq (fi.laverca.jaxb.mss.MSSProfileReq)1 MSSReceiptReq (fi.laverca.jaxb.mss.MSSReceiptReq)1 MSSSignatureReq (fi.laverca.jaxb.mss.MSSSignatureReq)1 MSSStatusReq (fi.laverca.jaxb.mss.MSSStatusReq)1 MessageAbstractType (fi.laverca.jaxb.mss.MessageAbstractType)1 MSS_HandshakeBindingStub (fi.laverca.mss.ws.MSS_HandshakeBindingStub)1 MSS_ProfileQueryBindingStub (fi.laverca.mss.ws.MSS_ProfileQueryBindingStub)1 MSS_ReceiptBindingStub (fi.laverca.mss.ws.MSS_ReceiptBindingStub)1 MSS_RegistrationBindingStub (fi.laverca.mss.ws.MSS_RegistrationBindingStub)1 MSS_SignatureBindingStub (fi.laverca.mss.ws.MSS_SignatureBindingStub)1 MSS_StatusQueryBindingStub (fi.laverca.mss.ws.MSS_StatusQueryBindingStub)1