如何从现有的restful Web服务向wso2 esb添加代理服务?

时间:2017-08-14 06:09:27

标签: c# rest proxy wso2 wso2esb

我在C#中开发了这个现有的Web服务 (https://www.myCompanyDomain.com.ph/ProjectName/lfsapi/loanapplication)它返回Get和Post的json格式。

这是我的控制器代码:

    public class LoanApplicationController : ApiController
    {
        // GET: api/LoanApplication
        //public IEnumerable<string> Get()
        //{
        //    return new string[] { "value1", "value2" };
        //}

        // GET: api/LoanApplication/5
        public ArrayList Get()
        {
            LoanApplicationDAO appDAO = new LoanApplicationDAO();
            ArrayList arrObj = new ArrayList();
            arrObj = appDAO.LoanApplicationFields();
            if (arrObj == null)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound));
            }

            return arrObj;
        }

        // POST: api/LoanApplication
        public LFSResponse Post([FromBody]LoanApplication value)
        {
            LoanApplicationDAO appDAO = new LoanApplicationDAO();
            LFSResponse response = new LFSResponse();
            //string res = "";

            ...some code here, to make code shorter

            return response;
        }
}

在我的WSO2 ESB管理控制台中,我创建了代理服务,然后通过服务,请参阅附图。

Proxy Service Configuration

当服务创建时,它会返回错误

请从链接中看到图片

i.stack.imgur.com/XEF3O.png

我怎样才能解决这个问题?我错过了什么吗?

任何帮助都可以,谢谢!

1 个答案:

答案 0 :(得分:0)

由于这不是SOAP服务而且它是REST服务,因此您应该使用HTTPEndpoint

<endpoint>
    <http uri-template="URI Template" method="GET" />
</endpoint>