This project uses the CSM framework to publish LabVIEW applications as Web Services, enabling remote monitoring and control through a G-Web front-end in the browser. By exposing just one CSM-RunScript endpoint, all functionality of every CSM module in the back end becomes accessible — no need to write a separate Web Service VI for each feature.
Ideal for NI cRIO/PXI and other RT targets — users access the device over the local network directly from a browser with no client software required.
Full documentation: CSM-Wiki - G-Web Application Development
graph TB
Browser["Browser (Client)"]
subgraph LabVIEW EXE/RT Target
subgraph "NI Web Server (Host PC or RT)"
GW["G-Web Application<br/>(HTML/CSS/JS Front-end)"]
RS["CSM-RunScript API (POST)<br/>Web Service Back-end"]
end
subgraph "LabVIEW Application"
Bus[CSM Invisible Bus]
M1[CSM Module A]
M2[CSM Module B]
MN[CSM Module N]
end
end
Browser -->|"① Load Web Page"| GW
GW -.->|"HTML/CSS/JS"| Browser
Browser -->|"② HTTP POST CSM Script"| RS
RS -->|Send CSM Script| Bus
Bus <-->|CSM Message| M1
Bus <-->|CSM Message| M2
Bus <-->|CSM Message| MN
RS -->|Return Result| Browser
style RS fill:#e1f5ff
style Bus fill:#fff4e6,stroke-dasharray:5 5
style GW fill:#e8f5e9
style Browser fill:#f5e6ff
- Single endpoint, full functionality: Expose only one
CSM-RunScriptendpoint to access all features of every CSM module in the back end. - Modular development: Message-driven architecture based on the CSM framework — loosely coupled modules that are easy to extend and maintain.
- No client required: Users access the application directly from a browser with no client software installation needed.
- Rapid web enablement: Quickly convert an existing LabVIEW application into a web application without writing a separate Web Service for each feature.
- Embedded deployment friendly: Especially suited for deployment on cRIO, PXI, and other RT targets for remote monitoring and control.
G-Web-Development-with-CSM/
├── LabVIEW Project with Web Serivces/ # LabVIEW back-end project
│ ├── LabVIEW Project with Web Serivces.lvproj
│ ├── Test WebService.vi # Web Service test VI
│ └── WebService/
│ ├── CSM WebService.lvlib # Web Service library
│ ├── Startup Main.vi # Application entry point
│ ├── Methods/
│ │ └── CSM-RunScript.vi # The single Web Service endpoint
│ ├── CSM/
│ │ └── CSM.vi # CSM application main module
│ └── Support/ # Support VIs
└── G-Web Application/ # G-Web front-end project (NI LabVIEW NXG Web Module)
└── Web Application/ # Deployable web application (.gwebproject)
| Item | Description |
|---|---|
| Method | POST |
| URL | http://<host>:<port>/CSMWebService/CSM-RunScript |
| Request body | CSM script string (plain text) |
| Response | Execution result string (plain text) |
# Synchronous call — waits for the result
API: Read >> channel0 -@ SomeModule
# Asynchronous call — does not wait for the result
API: Start ->| SomeModule
- Build your CSM application: Implement your business-logic modules in LabVIEW using the CSM framework.
- Open the back-end project: Open
LabVIEW Project with Web Serivces/LabVIEW Project with Web Serivces.lvprojin LabVIEW and add or modify business modules insideWebService/CSM/CSM.vi. - Open the front-end project: Open
G-Web Application/Web Application/Web Application.gwebprojectin NI LabVIEW NXG Web Module and configure the HTTP node to point to theCSM-RunScriptendpoint. - Deploy and run: Right-click the Web Service → Deploy, or run
WebService/Startup Main.vidirectly; build the G-Web application and publish it to the NI Web Server. - Access from browser:
http://<device-IP>:<port>/CSMWebService/