У меня есть случай, когда мое приложение получило ответ JWT от другой внешней конечной точки, но я столкнулся с проблемой, которую wso2 не может передать и получить ответ JWT, и я получил это сообщение об ошибке: «Error while building Passthrough stream org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'e' (code 101) in prolog; expected '<'
»
Как я могу решить эту проблему?
Я проверил файл axis2 на наличие построителя сообщений и средства форматирования сообщений:
<messageBuilders>
<messageBuilder contentType = "application/xml"
class = "org.apache.axis2.builder.ApplicationXMLBuilder"/>
<messageBuilder contentType = "application/x-www-form-urlencoded"
class = "org.apache.synapse.commons.builders.XFormURLEncodedBuilder"/>
<messageBuilder contentType = "multipart/form-data"
class = "org.apache.axis2.builder.MultipartFormDataBuilder"/>
<messageBuilder contentType = "application/json"
class = "org.wso2.micro.integrator.core.json.JsonStreamBuilder"/>
<messageBuilder contentType = "application/json/badgerfish"
class = "org.apache.axis2.json.JSONBadgerfishOMBuilder"/>
<messageBuilder contentType = "text/javascript"
class = "org.apache.axis2.json.JSONBuilder"/>
<messageBuilder contentType = "text/plain"
class = "org.apache.axis2.format.PlainTextBuilder"/>
<messageBuilder contentType = "application/octet-stream"
class = "org.wso2.carbon.relay.BinaryRelayBuilder"/>
<messageBuilder contentType = "application/binary"
class = "org.apache.axis2.format.BinaryBuilder"/>
</messageBuilders>
<messageFormatters>
<messageFormatter contentType = "application/x-www-form-urlencoded"
class = "org.apache.synapse.commons.formatters.XFormURLEncodedFormatter"/>
<messageFormatter contentType = "multipart/form-data"
class = "org.apache.axis2.transport.http.MultipartFormDataFormatter"/>
<messageFormatter contentType = "application/xml"
class = "org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
<messageFormatter contentType = "text/xml"
class = "org.apache.axis2.transport.http.SOAPMessageFormatter"/>
<messageFormatter contentType = "application/soap+xml"
class = "org.apache.axis2.transport.http.SOAPMessageFormatter"/>
<messageFormatter contentType = "text/plain"
class = "org.apache.axis2.format.PlainTextFormatter"/>
<messageFormatter contentType = "application/json"
class = "org.wso2.micro.integrator.core.json.JsonStreamFormatter"/>
<messageFormatter contentType = "application/json/badgerfish"
class = "org.apache.axis2.json.JSONBadgerfishMessageFormatter"/>
<messageFormatter contentType = "text/javascript"
class = "org.apache.axis2.json.JSONMessageFormatter"/>
<messageFormatter contentType = "application/octet-stream"
class = "org.wso2.carbon.relay.ExpandingMessageFormatter"/>
<messageFormatter contentType = "application/binary"
class = "org.apache.axis2.format.BinaryFormatter"/>
</messageFormatters>
фактический ответ, который я получил, это "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKx wRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c", а тип заголовка ответа — Content-Type: application/jwt
Кажется, вы используете MI, если да, добавьте следующий построитель сообщений в deployment.toml
, который позволит вам использовать закодированное сообщение JWT как обычный текст.
[[custom_message_builders]]
class = "org.apache.axis2.format.PlainTextBuilder"
content_type = "application/jwt"
Какой ответ вы получаете? И что установлено в качестве заголовка Content-Type ответа?