0

我不太喜欢WSO2 ESB,我有以下疑问。

我已经在我的 Carbon 服务器上部署了一些 API,效果很好。

这些 API 使用HTTP作为协议。出于某种原因,我必须将其更改为HTTPS

我的疑问是:我是否只需将(资源标签的)协议属性值从http更改为https

<?xml version="1.0" encoding="UTF-8"?>
<api context="/meteo_forecast_weekly_v2/location" name="meteo_forecast_weekly_v2" xmlns="http://ws.apache.org/ns/synapse">
    <resource methods="GET" protocol="http" uri-template="/{localizationId}">
        ...............................................................
        ...............................................................
        ...............................................................

或者我还需要在我的 Carbon 服务器中配置证书吗?

EDIT-1:我尝试按照 BHA 的建议进行操作,但是当我以这种方式进行调用时,我得到了这个未知的协议错误:

$ curl -k https://XXX.YYY.ZZZ.WWW:8280/meteo_forecast_weekly_v2/location/1
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (35) error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol

进入 WSO2 堆栈跟踪,我得到这个错误日志:

TID: [-1] [] [2017-11-14 14:46:00,107] ERROR {org.apache.synapse.transport.passthru.SourceHandler} -  HttpException occurred  {org.apache.synapse.transport.passthru.SourceHandler}
org.apache.http.ProtocolException: Invalid request line: ü8Ò�;Cá©h0ß©�ø_¹i°eõ»Ê.,q5© À0À,À(À$ÀÀ
        at org.apache.http.impl.nio.codecs.AbstractMessageParser.parse(AbstractMessageParser.java:208)
        at org.apache.synapse.transport.http.conn.LoggingNHttpServerConnection$LoggingNHttpMessageParser.parse(LoggingNHttpServerConnection.java:407)
        at org.apache.synapse.transport.http.conn.LoggingNHttpServerConnection$LoggingNHttpMessageParser.parse(LoggingNHttpServerConnection.java:381)
        at org.apache.http.impl.nio.DefaultNHttpServerConnection.consumeInput(DefaultNHttpServerConnection.java:265)
        at org.apache.synapse.transport.http.conn.LoggingNHttpServerConnection.consumeInput(LoggingNHttpServerConnection.java:114)
        at org.apache.synapse.transport.passthru.ServerIODispatch.onInputReady(ServerIODispatch.java:82)
        at org.apache.synapse.transport.passthru.ServerIODispatch.onInputReady(ServerIODispatch.java:39)
        at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:113)
        at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:159)
        at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:338)
        at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:316)
        at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:277)
        at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:105)
        at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:586)
        at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.http.ParseException: Invalid request line: ü8Ò�;Cá©h0ß©�ø_¹i°eõ»Ê.,q5© À0À,À(À$ÀÀ
        at org.apache.http.message.BasicLineParser.parseRequestLine(BasicLineParser.java:287)
        at org.apache.http.impl.nio.codecs.DefaultHttpRequestParser.createMessage(DefaultHttpRequestParser.java:119)
        at org.apache.http.impl.nio.codecs.DefaultHttpRequestParser.createMessage(DefaultHttpRequestParser.java:51)
        at org.apache.http.impl.nio.codecs.AbstractMessageParser.parseHeadLine(AbstractMessageParser.java:156)
        at org.apache.http.impl.nio.codecs.AbstractMessageParser.parse(AbstractMessageParser.java:206)
        ... 14 more
TID: [-1] [] [2017-11-14 14:46:00,113]  INFO {org.apache.synapse.transport.passthru.SourceHandler} -  Writer null when calling informWriterError {org.apache.synapse.transport.passthru.SourceHandler}

为什么?问题是什么?

4

1 回答 1

2

是的,你只需要改变protocol价值。默认情况下,ESB 使用它的默认密钥库,它位于<ESB_HOME>/repository/reources/security/wso2carbon.jks. 当您在生产中时,建议更改默认密钥库

于 2017-11-14T13:25:30.303 回答