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;
}
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);
}
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);
}
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;
}
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;
}
Aggregations