2016-11-29 4 views
0

J'ai créé un service de savon au printemps-démarrage en utilisant le blog suivant https://www.javacodegeeks.com/2016/07/writing-consuming-soap-webservice-spring.htmlObtenir Tiehandler erreur nulle et faultcode S: Service de serveur Java SOAP

Le point final Publier Url

@Override 
public void run(String... arg0) throws Exception { 
    // TODO Auto-generated method stub  Endpoint.p 
    Endpoint.publish("http://localhost:9000" +"/service/serve", new ServeWeb()); 

} 

La classe WebService est comme suit

@WebService 
public class ServeWeb { 

    @Autowired 
    XyzService xyzService; 


    @WebMethod(operationName="LOGIN") 
    public List<String> userLogin(
      @WebParam(name = "uid")String uid, 
      @WebParam(name = "pwd")String pwd){ 

      System.out.println("uid == "+uid+"::::: pwd == "+pwd); 
      List<String> userDetaillist =xyzService.userLogin(uid, pwd); 
     return userDetaillist; 
    } 
} 

J'obtiens l'erreur suivante sur la console

30/11/2016 00:00:24 [pool-3-fil-2] erreur

c.s.x.i.ws.server.sei.TieHandler - null 
java.lang.NullPointerException: null 
    at com.user.userLogin(ServeWeb.java:45) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:483) 
    at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:483) 
    at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:483) 
    at com.sun.xml.internal.ws.api.server.MethodUtil.invoke(MethodUtil.java:68) 
    at com.sun.xml.internal.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:235) 
    at com.sun.xml.internal.ws.server.InvokerTube$2.invoke(InvokerTube.java:134) 
    at com.sun.xml.internal.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:73) 
    at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:1121) 
    at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:1035) 
    at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:1004) 
    at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:862) 
    at com.sun.xml.internal.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:404) 
    at com.sun.xml.internal.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:706) 
    at com.sun.xml.internal.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:260) 
    at com.sun.xml.internal.ws.transport.http.server.WSHttpHandler.handleExchange(WSHttpHandler.java:98) 
    at com.sun.xml.internal.ws.transport.http.server.WSHttpHandler.handle(WSHttpHandler.java:82) 
    at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79) 
    at sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:83) 
    at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:82) 
    at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:675) 
    at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79) 
    at sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:647) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
    at java.lang.Thread.run(Thread.java:745) 

J'utilise SoapUI pour tester ici est demande

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://web.abhimanyu.com/"> 
    <soapenv:Header/> 
    <soapenv:Body> 
     <web:LOGIN> 
     <!--Optional:--> 
     <uid>admin123</uid> 
     <!--Optional:--> 
     <pwd>admin123</pwd> 
     </web:LOGIN> 
    </soapenv:Body> 
</soapenv:Envelope> 

Et la réponse correspondante est

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> 
    <S:Body> 
     <S:Fault xmlns:ns4="http://www.w3.org/2003/05/soap-envelope"> 
     <faultcode>S:Server</faultcode> 
     <faultstring>java.lang.NullPointerException</faultstring> 
     </S:Fault> 
    </S:Body> 
</S:Envelope> 

Répondre

0

J'ai la figure dehors printemps autowiring ne fonctionnait pas. J'ai annoté ServeWeb avec @Service et ça marche bien après ça