このページは、お客様の言語ではご利用いただけません。Huawei Cloudは、より多くの言語バージョンを追加するために懸命に取り組んでいます。ご協力ありがとうございました。

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

HttpClient

Updated on 2022-09-01 GMT+08:00

Path

  • com.roma.apic.livedata.client.v1.HttpClient
  • com.huawei.livedata.lambdaservice.livedataprovider.HttpClient

Description

This class is used to send HTTP requests.

NOTE:

Some common HTTP response headers, such as Location, cannot be returned.

Example

  • com.roma.apic.livedata.client.v1.HttpClient
    importClass(com.roma.apic.livedata.client.v1.HttpClient);
    importClass(com.roma.apic.livedata.provider.v1.APIConnectResponse);
    function execute(data) {
        var httpClient = new HttpClient();
        var resp = httpClient.request('GET', 'http://apigdemo.exampleRegion.com/api/echo', {}, null, 'application/json');
        myHeaders = resp.headers();
        proxyHeaders = {};
        for (var key in myHeaders) {
            proxyHeaders[key] = myHeaders.get(key);
        }
        return new APIConnectResponse(resp.code(), proxyHeaders, resp.body().string(), false);
    }
  • com.huawei.livedata.lambdaservice.livedataprovider.HttpClient
    importClass(com.huawei.livedata.lambdaservice.livedataprovider.HttpClient);
    function excute(data) {
        var httpExecutor = new HttpClient();
        var obj = JSON.parse(data);
        var host = 'xx.xx.xxx.xx:xxxx';
        var headers = {
            'clientapp' : 'FunctionStage'
        };
        var params = {
            'employ_no' :'00xxxxxx'
        };
        var result = httpExecutor.callGETAPI(host,'/livews/rest/apiservice/iData/personInfo/batch',JSON.stringify(params),JSON.stringify(headers));
        return result;
    }

Constructor Details

  • com.roma.apic.livedata.client.v1.HttpClient

    public HttpClient()

    Constructs an HttpClient without parameters.

    public HttpClient(HttpConfig config)

    Constructs an HttpClient that contains the HttpConfig configuration information.

    Parameter: config indicates the HttpClient configuration information.

  • com.huawei.livedata.lambdaservice.livedataprovider.HttpClient

    public HttpClient()

    Constructs an HttpClient without parameters.

Method List

  • com.roma.apic.livedata.client.v1.HttpClient

    Returned Type

    Method and Description

    okhttp3.Response

    request(HttpConfig config)

    Send REST requests.

    okhttp3.Response

    request(String method, String url)

    Send a REST request by specifying the request method and path.

    okhttp3.Response

    request(String method, String url, Map<String,String> headers)

    Send a REST request by specifying the request method, path, and header.

    okhttp3.Response

    request(String method, String url, Map<String,String> headers, String body)

    Send a REST request by specifying the request method, path, header, and body.

    okhttp3.Response

    request(String method, String url, Map<String,String> headers, String body, String contentType)

    Send a REST request by specifying the request method, path, header, body, and content type.

  • com.huawei.livedata.lambdaservice.livedataprovider.HttpClient

    Returned Type

    Method and Description

    String

    callGETAPI(String url)

    Use the get method to invoke the HTTP or HTTPS service.

    String

    callGETAPI(String host, String service, String params, String header)

    Use the get method to invoke the HTTP or HTTPS service.

    Response

    get(String url, String header)

    Use the get method to invoke the HTTP or HTTPS service.

    String

    callPostAPI(String host, String service, String content, String header, String contentType)

    Use the post method to invoke the HTTP or HTTPS service.

    String

    callPostAPI(String url, String header, String requestBody, String type)

    Use the post method to invoke the HTTP or HTTPS service.

    Response

    post(String url, String header, String content, String type)

    Use the post method to invoke the HTTP or HTTPS service.

    String

    callFormPost(String url, String header, String/Map param)

    Invoke the HTTP or HTTPS service in the formdata format.

    Response

    callFormPost(String url, String header, String param, FormDataMultiPart form)

    Invoke the HTTP or HTTPS service in the formdata format.

    String

    callDelAPI(String url, String header, String content, String type)

    Use the delete method to invoke the HTTP or HTTPS service.

    String

    callPUTAPI(String url, String header, String content, String type)

    Use the put method to invoke the HTTP or HTTPS service.

    String

    callPatchAPI(String url, String header, String content, String type)

    Use the patch method to invoke the HTTP or HTTPS service.

    Response

    put(String url, String header, String content, String type)

    Use the put method to invoke the HTTP or HTTPS service.

Method Details

  • com.roma.apic.livedata.client.v1.HttpClient
    • public okhttp3.Response request(HttpConfig config)

      Send REST requests.

      Input Parameter

      config indicates the HttpConfig configuration information.

      Returns

      Response body.

    • public okhttp3.Response request(String method, String url)

      Send a REST request by specifying the request method and path.

      Input Parameter

      • method indicates a request method.
      • url indicates a request URL.

      Returns

      Response body.

    • public okhttp3.Response request(String method, String url, Map<String,String> headers)

      Send a REST request by specifying the request method, path, and header.

      Input Parameter

      • method indicates a request method.
      • url indicates a request URL.
      • headers indicates the request header information of the map type.

      Returns

      Response body.

    • public okhttp3.Response request(String method, String url, Map<String,String> headers, String body)

      Send a REST request by specifying the request method, path, header, and body.

      Input Parameter

      • method indicates a request method.
      • url indicates a request URL.
      • headers indicates the request header information of the map type.
      • body indicates the request body.

      Returns

      Response body.

    • public okhttp3.Response request(String method, String url, Map<String,String> headers, String body, String contentType)

      Send a REST request by specifying the request method, path, header, body, and content type.

      Input Parameter

      • method indicates a request method.
      • url indicates a request URL.
      • headers indicates the request header information of the map type.
      • body indicates the request body.
      • contentType indicates the content type of the request body.

      Returns

      Response body.

  • com.huawei.livedata.lambdaservice.livedataprovider.HttpClient
    • public String callGETAPI(String url)

      Use the get method to invoke the HTTP or HTTPS service.

      Input Parameter

      url indicates the service address.

      Returns

      Response body.

    • public String callGETAPI(String host, String service, String params, String header)

      Use the get method to invoke the HTTP or HTTPS service.

      Input Parameter

      • host indicates the service address.
      • service indicates the service path.
      • params indicates the HTTP parameter information.
      • header indicates the HTTP header information.

      Returns

      Response body.

    • public Response get(String url, String header)

      Use the get method to invoke the HTTP or HTTPS service.

      Input Parameter

      • url indicates the service address.
      • header indicates the request header information.

      Returns

      Response body.

    • public String callPostAPI(String host, String service, String content, String header, String contentType)

      Use the post method to invoke the HTTP or HTTPS service.

      Input Parameter

      • host indicates the service address.
      • service indicates the service path.
      • content indicates the message body.
      • header indicates the request header information.
      • contentType indicates the content type.

      Returns

      Response body.

    • public String callPostAPI(String url, String header, String requestBody, String type)

      Use the post method to invoke the HTTP or HTTPS service.

      Input Parameter

      • url indicates the service address.
      • header indicates the request header information.
      • requestBody indicates the message body.
      • type indicates the MIME type.

      Returns

      Response body.

    • public Response post(String url, String header, String content, String type)

      Use the post method to invoke the HTTP or HTTPS service.

      Input Parameter

      • url indicates the service address.
      • header indicates the request header information.
      • content indicates the message body.
      • type indicates the MIME type.

      Returns

      Response body.

    • public String callFormPost(String url, String header, String/Map param)

      Invoke the HTTP or HTTPS service in the formdata format.

      Input Parameter

      • url indicates the service address.
      • header indicates the request header information.
      • param indicates the parameter information.

      Returns

      Response body.

    • public Response callFormPost(String url, String header, String param, FormDataMultiPart form)

      Invoke the HTTP or HTTPS service in the formdata format.

      Input Parameter

      • url indicates the service address.
      • header indicates the request header information.
      • param indicates the parameter information.
      • form indicates the body parameter.

      Returns

      Response body.

    • public String callDelAPI(String url, String header, String content, String type)

      Use the delete method to invoke the HTTP or HTTPS service.

      Input Parameter

      • url indicates the service address.
      • header indicates the request header information.
      • content indicates the message body.
      • type indicates the MIME type.

      Returns

      Response body.

    • public String callPUTAPI(String url, String header, String content, String type)

      Use the put method to invoke the HTTP or HTTPS service.

      Input Parameter

      • url indicates the service address.
      • header indicates the request header information.
      • content indicates the message body.
      • type indicates the MIME type.

      Returns

      Response body.

    • public String callPatchAPI(String url, String header, String content, String type)

      Use the patch method to invoke the HTTP or HTTPS service.

      Input Parameter

      • url indicates the service address.
      • header indicates the request header information.
      • content indicates the message body.
      • type indicates the MIME type.

      Returns

      Response body.

    • public Response put(String url, String header, String content, String type)

      Use the put method to invoke the HTTP or HTTPS service.

      Input Parameter

      • url indicates the service address.
      • header indicates the request header information.
      • content indicates the message body.
      • type indicates the MIME type.

      Returns

      Response body.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback