Я получаю сообщение об ошибке в Wiremock при попытке отправить запрос через почтальона - PullRequest
0 голосов
/ 06 марта 2020

Я пытаюсь отправить запрос в фиктивный пост, который я настроил в Wiremock. Это запрос в intellij ниже:

 {
    "request": {
      "method": "POST",
      "url": "/egateway/simphonyposapiweb.asmx",
      "headers": {
        "SOAPAction": {
          "equalTo": "\"http://micros-hosting.com/EGateway/CalculateTransactionTotalsEx\""
        }
      }
    },
        "response": {
          "status": 200,
          "headers": {
            "Content-Type": "text/xml"
          },
          "bodyFileName": "CalculateTransactionTotalsExResponse.xml"
        }
      }

Я отправляю запрос в почтальоне. См. Ниже:

http://localhost: 8089 / internal / v1 / totalals

Я вижу из своей консоли, что мой запрос действительно достигает позиции. Я вижу сообщение

2020-03-06 13: 53: 38,550 ИНФОРМАЦИЯ [http-nio-8089-exe c -2] ApiRequestInterceptor: [POST] / internal / v1 / totals успешно аутентифицирован.

В моем терминале, когда я запускаю tail -f wiremock.log

Matched response definition:
{
  "status" : 200,
  "bodyFileName" : "CalculateTransactionTotalsExResponse.xml",
  "headers" : {
    "Content-Type" : "text/xml"
  }
}

Response:
HTTP/1.1 200
Content-Type: [text/xml]
Matched-Stub-Id: [734e39bb-98dd-4488-bf57-f9b8b5cca7a2]


2020-03-06 13:53:38.856 Outgoing bytes: HTTP/1.1 200 OK
Content-Type: text/xml
Matched-Stub-Id: 734e39bb-98dd-4488-bf57-f9b8b5cca7a2
Content-Encoding: gzip
Vary: Accept-Encoding, User-Agent
Transfer-Encoding: chunked
Server: Jetty(9.2.z-SNAPSHOT)

, но у меня появляется сообщение об исключении

A

2020-03-06 13:53:38.857 Problem decoding network traffic
java.nio.charset.MalformedInputException: Input length = 1
    at java.nio.charset.CoderResult.throwException(CoderResult.java:281)
    at java.nio.charset.CharsetDecoder.decode(CharsetDecoder.java:816)
    at com.github.tomakehurst.wiremock.http.trafficlistener.ConsoleNotifyingWiremockNetworkTrafficListener.outgoing(ConsoleNotifyingWiremockNetworkTrafficListener.java:49)
    at com.github.tomakehurst.wiremock.jetty9.JettyHttpServer$NetworkTrafficListenerAdapter.outgoing(JettyHttpServer.java:471)
    at wiremock.org.eclipse.jetty.io.NetworkTrafficSelectChannelEndPoint.notifyOutgoing(NetworkTrafficSelectChannelEndPoint.java:144)
    at wiremock.org.eclipse.jetty.io.NetworkTrafficSelectChannelEndPoint.flush(NetworkTrafficSelectChannelEndPoint.java:65)
    at wiremock.org.eclipse.jetty.io.WriteFlusher.flush(WriteFlusher.java:408)
    at wiremock.org.eclipse.jetty.io.WriteFlusher.write(WriteFlusher.java:302)
    at wiremock.org.eclipse.jetty.io.AbstractEndPoint.write(AbstractEndPoint.java:129)
    at wiremock.org.eclipse.jetty.server.HttpConnection$SendCallback.process(HttpConnection.java:721)
    at wiremock.org.eclipse.jetty.util.IteratingCallback.processing(IteratingCallback.java:246)
    at wiremock.org.eclipse.jetty.util.IteratingCallback.iterate(IteratingCallback.java:208)
    at wiremock.org.eclipse.jetty.server.HttpConnection.send(HttpConnection.java:472)
    at wiremock.org.eclipse.jetty.server.HttpChannel.sendResponse(HttpChannel.java:756)
    at wiremock.org.eclipse.jetty.server.HttpChannel.write(HttpChannel.java:794)
    at wiremock.org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:155)
    at wiremock.org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:148)
    at wiremock.org.eclipse.jetty.server.HttpOutput.flush(HttpOutput.java:250)
    at java.util.zip.DeflaterOutputStream.flush(DeflaterOutputStream.java:282)
    at wiremock.org.eclipse.jetty.servlets.gzip.AbstractCompressedStream.flush(AbstractCompressedStream.java:129)
    at com.github.tomakehurst.wiremock.servlet.WireMockHandlerDispatchingServlet.writeAndTranslateExceptions(WireMockHandlerDispatchingServlet.java:234)
    at com.github.tomakehurst.wiremock.servlet.WireMockHandlerDispatchingServlet.applyResponse(WireMockHandlerDispatchingServlet.java:223)
    at com.github.tomakehurst.wiremock.servlet.WireMockHandlerDispatchingServlet$ServletHttpResponder.respondTo(WireMockHandlerDispatchingServlet.java:183)
    at com.github.tomakehurst.wiremock.servlet.WireMockHandlerDispatchingServlet$ServletHttpResponder.respondSync(WireMockHandlerDispatchingServlet.java:150)
    at com.github.tomakehurst.wiremock.servlet.WireMockHandlerDispatchingServlet$ServletHttpResponder.respond(WireMockHandlerDispatchingServlet.java:144)
    at com.github.tomakehurst.wiremock.http.AbstractRequestHandler.handle(AbstractRequestHandler.java:90)
    at com.github.tomakehurst.wiremock.servlet.WireMockHandlerDispatchingServlet.service(WireMockHandlerDispatchingServlet.java:120)
    at wiremock.javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at wiremock.org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
    at wiremock.org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
    at wiremock.org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
    at wiremock.org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
    at wiremock.org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
    at wiremock.org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at wiremock.org.eclipse.jetty.servlets.gzip.GzipHandler.handle(GzipHandler.java:479)
    at wiremock.org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
    at wiremock.org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at wiremock.org.eclipse.jetty.server.Server.handle(Server.java:499)
    at wiremock.org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
    at wiremock.org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:258)
    at wiremock.org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
    at wiremock.org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
    at wiremock.org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
    at java.lang.Thread.run(Thread.java:748)
2020-03-06 13:53:38.863 Outgoing bytes: 
292

Я запутался, мой запрос работает или нет? и почему я получаю эту ошибку?

Спасибо за вашу помощь!

...