Partilhar via


ContractApiHttp Class

  • java.lang.Object
    • com.microsoft.azure.sdk.iot.provisioning.service.contract.ContractApiHttp

public class ContractApiHttp

This client handles the Device Provisioning Service HTTP communication.

This class implements the HTTPS contract between the Provisioning Service Client and the Device Provisioning Service. It is called by the Managers that implement the Provisioning Service Client public APIs. To access the public APIs, please see the ProvisioningServiceClient.

The follow diagram describe the relation between these 3 layers of the Service Client:

+-------------------------------------------------------------------+           +------------+
           |                        ProvisioningServiceClient                  |           |    Query   |
           +-----+----------------------------+--------------------------+-----+           +--+---+-----+
                /                             |                           \                   |   |
               /                              |                            \                  |   |
 +------------+----------------+  +-----------+------------+  +-------------+-------------+   |   |
 | IndividualEnrollmentManager |  | EnrollmentGroupManager |  | RegistrationStatusManager |   |   |
 +------------+--------+-------+  +-----------+------+-----+  +-------------+-------+-----+   |   |
              |         \                     |       \                     |        \        |   |
              |          +-----------------------------+------------------------------+-------+   |
              |                               |                             |                     |
 +------------+-------------------------------+-----------------------------+---------------------+---+
 |                                       ContractApiHttp                                              |
 +------------------------------------------------+---------------------------------------------------+
                                                  |
                                                  |
            +-------------------------------------+------------------------------------------+
            |                 com.microsoft.azure.sdk.iot.deps.transport.http                |
            +--------------------------------------------------------------------------------+

Method Summary

Modifier and Type Method and Description
static ContractApiHttp createFromConnectionString(ProvisioningConnectionString provisioningConnectionString)

Create a new instance of the ContractApiHttp.

synchronized HttpResponse request(HttpMethod httpMethod, String path, Map<String,String> headerParameters, String payload)

This function sends a raw information to the Device Provisioning Service service using http protocol.

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Method Details

createFromConnectionString

public static ContractApiHttp createFromConnectionString(ProvisioningConnectionString provisioningConnectionString)

Create a new instance of the ContractApiHttp.

Parameters:

provisioningConnectionString - is the Device Provisioning Service service connection string.

Returns:

an instance of ContractApiHttp.

request

public synchronized HttpResponse request(HttpMethod httpMethod, String path, Map headerParameters, String payload)

This function sends a raw information to the Device Provisioning Service service using http protocol.

The purpose of this function is be the base communication between the controllers and the Service, and should be used only if you have full understanding of the Device Provisioning Service rest APIs. We highly recommend that you uses the APis under ProvisioningServiceClient instead of directly access the rest API using this class.

Parameters:

httpMethod - is the http verb in the request (GET, POST, PUT, DELETE, PATCH).
path - is the path to the resource in the service that will compose the URL.
headerParameters - is a list of pairs key values that contains optional parameters in the http header.
payload - is the body of the message.

Returns:

the HttpResponse that contains the response of the request.

Throws:

ProvisioningServiceClientException - if the Service Client failed to exchange http messages with the Provisioning Service.

Applies to