Common PostgreSQL, SOAP, and Linux Administration Commands

Loading CSV Data into PostgreSQL

To import a flat file into a specific table using the PostgreSQL interactive terminal, utilize the \copy meta-command. It is recommended to provide the full absolute path to the file to avoid permission or path resolution issues.

\copy pm_faultcontent from '/mnt/postgresdata/inst/data/pm_faultcontent.csv' with csv

Note: While environment variables for postgres_data might allow relative paths in specific configurations, sticking to absolute paths ensures reliability. Options like header or delimiter may require specific syntax adjustments depending on the file format.

Consuming SOAP Web Services via cURL and Postman

When interacting with legacy SOAP endpoints, you can test requests using Postman or execute them directly via the command line.

Postman Configuration

  1. URL: Typically points to the WSDL definition, e.g., http://localhost:8080/webservice/DownLoadInfoService?wsdl.
  2. Headers: The SOAPAction header is often optional depending on the server implementation.
  3. Body: Define the XML namespace (e.g., xmlns:qf). The prefix (qf) can be customized but must match the wrapper tags. Ensure the namespace URL matches the package path defined in the backend code. String parameters are passed as text content without quotes.

XML Payload Example

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:qf="http://*/">
  <soapenv:Header/>
  <soapenv:Body>
    <qf:getTbDeliverStatus>
      <carReqSeq>00a</carReqSeq>
      <vehicleId>30</vehicleId>
      <companyId>1</companyId>
    </qf:getTbDeliverStatus>
  </soapenv:Body>
</soapenv:Envelope>

cURL Equivalent

To replicate the Postman request in the terminal, use the following command. Note the Content-Type is set to text/xml.

sudo curl --location --request POST 'http://localhost:8080/webservice/webservice指定name?wsdl' \
--header 'access_key: *' \
--header 'Content-Type: text/xml' \
--header 'Cookie: JSESSIONID=6928A68FB2AC38FBA52D24DA24A4861A' \
--data-raw '
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:qf="http://*/">
  <soapenv:Header/>
  <soapenv:Body>
    <qf:getTbDeliverStatus>
      <carReqSeq>00a</carReqSeq>
      <vehicleId>30</vehicleId>
      <companyId>1</companyId>
    </qf:getTbDeliverStatus>
  </soapenv:Body>
</soapenv:Envelope>'

Basic File Inspection

Quick commands to inspect file contents and line counts in a Linux environment:

# Count total lines in a file
wc -l target_file.log

# Display the first 10 lines
head -n 10 target_file.log

# Display the last 10 lines
tail -n 10 target_file.log

Managing Firewalld Service

Commands to control the firewalld daemon on a CentOS/RHEL system:

# Check current status
systemctl status firewalld.service

# Stop the firewall temporarily
systemctl stop firewalld.service

# Start the firewall temporarily
systemctl start firewalld.service

# Enable firewall on boot (persistent)
systemctl enable firewalld.service

# Disable firewall on boot (persistent)
systemctl disable firewalld.service

Tags: PostgreSQL SOAP curl Linux firewalld

Posted on Tue, 03 Nov 2026 16:25:58 +0000 by lc21