如何在windows cmd中调用ballerina服务

如何在windows cmd中调用ballerina服务,cmd,command-prompt,ballerina,Cmd,Command Prompt,Ballerina,我在ballerina composer中运行服务,然后使用Windows cmd使用curl调用服务,但是cmd抱怨curl不是可识别的命令 如何在cmd中执行此操作 请提供帮助。您不需要使用cURL来调用Ballerina HTTP服务。您可以使用通常使用的HTTP客户端(例如)。如果确实需要,也可以在Windows中安装cURL: 创建您的服务文件,这里是hello\u service.bal 4. 芭蕾舞演员跑步main.bal。 5.您可以看到结果为helloworld现在在cm

我在ballerina composer中运行服务,然后使用Windows cmd使用
curl
调用服务,但是
cmd
抱怨
curl
不是可识别的命令

如何在
cmd
中执行此操作


请提供帮助。

您不需要使用cURL来调用Ballerina HTTP服务。您可以使用通常使用的HTTP客户端(例如)。如果确实需要,也可以在Windows中安装cURL:

  • 创建您的服务文件,这里是
    hello\u service.bal


  • 4. <代码>芭蕾舞演员跑步main.bal。
    5.您可以看到结果为
    helloworld现在在cmd上



    如果你想学芭蕾舞,这将是一个理想的方法!。通过编写自己的客户端。您是否尝试使用ballerina composer中集成的“try it”工具调用服务?
    import ballerina/http;
    
    endpoint http:Listener listener {
        port:9090
    };
    
    service<http:Service> hello bind listener {
        sayHello (endpoint caller, http:Request request) {
    
            http:Response response = new;
    
            response.setTextPayload("Hello World!\n");
    
            _ = caller -> respond(response);
        }
    }
    
    import ballerina/http;
    import ballerina/log;
    import ballerina/io;
    
    endpoint http:Client clientEndpoint {
        url: "http://localhost:9090"
    };
    
    function main(string... args) {
        // Send a GET request to the Hello World service endpoint.
        var response = clientEndpoint->get("/hello/sayHello");
    
        match response {
            http:Response resp => {
                io:println(resp.getTextPayload());
            }
            error err => {
                log:printError(err.message, err = err);
            }
        }
    }