0

我得到以下关于使用 C# 使用 ORDS Oracle RESTful 数据服务的响应。

{ StatusCode: 405, ReasonPhrase: 'Method Not Allowed', 版本: 1.1, Content: System.Net.Http.StreamContent, Headers: { Content-Length: 11402 Content-Type: text/html } }

public void test()
{
    string item_code;

    using(var client = new HttpClient())
    {
        Item items = new Item
        {
            segment1 = "049002932",
            description = "Fine Liner Dollar Pointer Softliner Metal Jacket F 0.3 Black 10's Box",
            short_description = " Pointer F Black 10's Box", service_item = "No", primary_uom_code = "10", inventory_item_status_code = "Inactive"
        };

        client.BaseAddress = new Uri("http://10.132.1.40:8090/");

        var response = client.PutAsJsonAsync("ords/ebsvis1/raz_inv/raz_item/Update/", items).Result;

        if (response.IsSuccessStatusCode)
            Console.Write("Success");
        else
            Console.Write("Error");
    }
}

这是我的 RESTful 服务定义:

在此处输入图像描述

4

1 回答 1

0

对于基于 ORDS 的 RESTful 服务,是否为 raz_inv 模块和 .../Update/ 模板定义了 PUT 处理程序?

根据您的屏幕截图,这是 PUT Hander URI:

/raz_inv/raz_item/update/{item_code}

但是,你正在做一个 PUT on

/raz_inv/raz_item/Update/

您需要在 URI 的末尾包含项目代码,因此请执行

var response client.PutAsJsonAsync("ords/ebsvis1/raz_inv/raz_item/Update/049002932",  items).Result;

只是猜测 049002932 位......

于 2019-01-16T12:57:06.653 回答