使用Axis 2的Conent类型JSON端点

时间:2019-02-07 08:26:48

标签: json web-services tomcat axis2

我需要部署一个接受JSON响应的终结点。 https://192.168.1.247/nyx/services/Temperature/getTemperature 是我当前部署的端点。但是,当我尝试使用内容类型= application / JSON访问它时,出现以下错误。实际上,我最终需要端点来与此请求和响应匹配

enter image description here

错误

CATA 02/07/19 08:16:34 SCHWERWIEGEND [org.apache.catalina.core.StandardWrapperValve invoke] Servlet.service() for servlet [AxisServlet] in context with path [/nyx] threw exception 
INFO   | jvm 1    | 2019/02/07 09:16:34 | org.apache.axiom.om.OMException: java.net.MalformedURLException
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at org.apache.axiom.om.impl.common.factory.AbstractOMMetaFactory.createXMLStreamReader(AbstractOMMetaFactory.java:144)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at org.apache.axiom.om.impl.common.factory.AbstractOMMetaFactory.createOMBuilder(AbstractOMMetaFactory.java:167)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at org.apache.axiom.om.OMXMLBuilderFactory.createOMBuilder(OMXMLBuilderFactory.java:161)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at org.apache.axis2.builder.BuilderUtil.createPOXBuilder(BuilderUtil.java:292)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at org.apache.axis2.transport.TransportUtils.createDefaultDocumentElement(TransportUtils.java:219)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:207)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:144)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at org.apache.axis2.transport.http.util.RESTUtil.processURLRequest(RESTUtil.java:161)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at org.apache.axis2.transport.http.AxisServlet$RestRequestProcessor.processURLRequest(AxisServlet.java:869)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:290)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at nl.planon.tomcat.ForgotPasswordFilter.doFilter(ForgotPasswordFilter.java:78)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at nl.planon.owasp.valve.WhitelistHTTPMethodsValve.invoke(WhitelistHTTPMethodsValve.java:72)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at nl.planon.tomcat.AddHeaderValve.invoke(AddHeaderValve.java:117)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at nl.planon.tomcat.PreventRedirectForAJAXRequestValve.invoke(PreventRedirectForAJAXRequestValve.java:57)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:240)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at nl.planon.owasp.valve.WhitelistHTTPMethodsValve.invoke(WhitelistHTTPMethodsValve.java:72)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at nl.planon.owasp.valve.XSSProtectionHeaderValve.invoke(XSSProtectionHeaderValve.java:175)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at nl.planon.tomcat.AddHeaderValve.invoke(AddHeaderValve.java:117)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at nl.planon.tomcat.ClickjackHostValve.invoke(ClickjackHostValve.java:107)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at java.lang.Thread.run(Thread.java:748)
INFO   | jvm 1    | 2019/02/07 09:16:34 | Caused by: java.net.MalformedURLException
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at java.net.URL.<init>(URL.java:627)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at java.net.URL.<init>(URL.java:490)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at java.net.URL.<init>(URL.java:439)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   at org.apache.axiom.om.impl.common.factory.AbstractOMMetaFactory.createXMLStreamReader(AbstractOMMetaFactory.java:130)
INFO   | jvm 1    | 2019/02/07 09:16:34 |   ... 44 more
INFO   | jvm 1    | 2019/02/07 09:16:34 | Caused by: java.lang.NullPointerException

我的代码

public static String getTemperature()
{
    System.out.println("success ");
    return "success";
}

Services.xml

<service name="Temperature" scope="request">
    <description>This is the Planon session service definition.</description>
    <messageReceivers>
        <messageReceiver mep="http://www.w3.org/ns/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
        <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out" class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
    </messageReceivers>
    <parameter name="ServiceClass">ch.aia.lpn.tuino.ws.iot.temperature.RESTClient</parameter>
</service>

0 个答案:

没有答案