Search in sources :

Example 6 with SetLightRequest

use of org.opensmartgridplatform.adapter.ws.schema.publiclighting.adhocmanagement.SetLightRequest in project open-smart-grid-platform by OSGP.

the class OsgpPublicLightingClientSoapService method switchLightRequest.

/**
 * Creates a SetLight request using the parameters deviceId and lightOn. Sends the request to the
 * platform using the WebServiceTemplate.
 *
 * <p>Returns the CorrelationId response from the Platform.
 */
public String switchLightRequest(final String deviceId, final boolean lightOn) {
    final SetLightRequest request = new SetLightRequest();
    final LightValue lightValue = new LightValue();
    lightValue.setOn(lightOn);
    final WebServiceTemplate template = this.soapRequestHelper.createPublicLightingRequest();
    request.setDeviceIdentification(deviceId);
    request.getLightValue().add(lightValue);
    final SetLightAsyncResponse response = (SetLightAsyncResponse) template.marshalSendAndReceive(request);
    return response.getAsyncResponse().getCorrelationUid();
}
Also used : LightValue(org.opensmartgridplatform.adapter.ws.schema.publiclighting.adhocmanagement.LightValue) WebServiceTemplate(org.springframework.ws.client.core.WebServiceTemplate) SetLightRequest(org.opensmartgridplatform.adapter.ws.schema.publiclighting.adhocmanagement.SetLightRequest) SetLightAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.publiclighting.adhocmanagement.SetLightAsyncResponse)

Aggregations

LightValue (org.opensmartgridplatform.adapter.ws.schema.publiclighting.adhocmanagement.LightValue)6 SetLightRequest (org.opensmartgridplatform.adapter.ws.schema.publiclighting.adhocmanagement.SetLightRequest)6 When (io.cucumber.java.en.When)3 SoapFaultClientException (org.springframework.ws.soap.client.SoapFaultClientException)3 SetLightAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.publiclighting.adhocmanagement.SetLightAsyncResponse)2 WebServiceTemplate (org.springframework.ws.client.core.WebServiceTemplate)2