2013-06-04 2 views
5

У меня есть проект webservice (WebServiceProject2), и я хочу назвать метод в проекте EJB (BelsizeEJB).Вызов метода EJB из проекта веб-служб

Я сделал следующее: Right-click WebServiceProject2 -> Build Path -> Configure Build Path -> Projects tab -> Add -> BelsizeEJB -> OK

Login.java в проекте BelsizeEJB

package com.belsize.module; 

public class Login { 

    public boolean loginuser(String User, String Password) { 
     String LOC = "Login: loginUser"; 
     System.out.println(LOC); 

     return true; 
    } 

} 

Authenticate.java в WebServiceProject2

package com.myeclipseide.ws; 

import com.belsize.module.Login; 

public class Authenticate { 

    public boolean doLogin_loginAction(String User, String Password) { 

     System.out.println("Testing Start"); 
     Login _l = new Login(); 
     System.out.println("Login Method Result: " + _l.loginuser(User, Password)); 
     System.out.println("Testing End"); 
     return _l.loginuser(User, Password); 

    } 
} 

После сделано указанное выше, Я создал новый веб-сервис и создал WSDL как следует:

Authenticate.wsdl

<wsdl:message name="doLogin_loginActionResponse"> 
    <wsdl:part element="impl:doLogin_loginActionResponse" name="parameters"> 
    </wsdl:part> 

    </wsdl:message> 

    <wsdl:message name="doLogin_loginActionRequest"> 
    <wsdl:part element="impl:doLogin_loginAction" name="parameters"> 
    </wsdl:part> 

    </wsdl:message> 

    <wsdl:message name="loginRequest"> 
    <wsdl:part element="impl:login" name="parameters"> 
    </wsdl:part> 

    </wsdl:message> 

    <wsdl:message name="loginResponse"> 
    <wsdl:part element="impl:loginResponse" name="parameters"> 
    </wsdl:part> 

    </wsdl:message> 

    <wsdl:portType name="Authenticate_SEI"> 
    <wsdl:operation name="login"> 
     <wsdl:input message="impl:loginRequest" name="loginRequest"> 
    </wsdl:input> 

     <wsdl:output message="impl:loginResponse" name="loginResponse"> 
    </wsdl:output> 

    </wsdl:operation> 

    <wsdl:operation name="doLogin_loginAction"> 
     <wsdl:input message="impl:doLogin_loginActionRequest" name="doLogin_loginActionRequest"> 
    </wsdl:input> 

     <wsdl:output message="impl:doLogin_loginActionResponse" name="doLogin_loginActionResponse"> 
    </wsdl:output> 

    </wsdl:operation> 

    </wsdl:portType> 

    <wsdl:binding name="AuthenticateSoapBinding" type="impl:Authenticate_SEI"> 
<wsaw:UsingAddressing xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" wsdl:required="false"/> 

    <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> 

    <wsdl:operation name="login"> 
     <wsdlsoap:operation soapAction=""/> 

     <wsdl:input name="loginRequest"> 
     <wsdlsoap:body use="literal"/> 

     </wsdl:input> 

     <wsdl:output name="loginResponse"> 
     <wsdlsoap:body use="literal"/> 

     </wsdl:output> 

    </wsdl:operation> 

    <wsdl:operation name="doLogin_loginAction"> 
     <wsdlsoap:operation soapAction=""/> 

     <wsdl:input name="doLogin_loginActionRequest"> 
     <wsdlsoap:body use="literal"/> 

     </wsdl:input> 

     <wsdl:output name="doLogin_loginActionResponse"> 
     <wsdlsoap:body use="literal"/> 

     </wsdl:output> 

    </wsdl:operation> 

    </wsdl:binding> 

    <wsdl:service name="AuthenticateService"> 
    <wsdl:port binding="impl:AuthenticateSoapBinding" name="Authenticate"> 
     <wsdlsoap:address location="http://localhost:9081/WebServiceProject2/services/Authenticate"/> 

    </wsdl:port> 

    </wsdl:service> 

</wsdl:definitions> 

Однако, когда я пытаюсь вызвать операцию WSDL, я столкнулся следующее сообщение об ошибке:

[6/4/13 15:54:36:006 SGT] 000000b7 SystemOut  O Testing Start 
[6/4/13 15:54:36:010 SGT] 000000b7 WebServicesSe E com.ibm.ws.webservices.engine.transport.http.WebServicesServlet doPost WSWS3227E: Error: Exception: 
           WebServicesFault 
faultCode: Server 
faultString: Internal Error 
faultActor: null 
faultDetail: 

Internal Error 
    at com.ibm.ws.webservices.engine.PivotHandlerWrapper.bindExceptionToResponse(PivotHandlerWrapper.java:531) 
    at com.ibm.ws.webservices.engine.PivotHandlerWrapper.invoke(PivotHandlerWrapper.java:353) 
    at com.ibm.ws.webservices.engine.handlers.jaxrpc.JAXRPCHandler.invoke(JAXRPCHandler.java:153) 
    at com.ibm.ws.webservices.engine.handlers.WrappedHandler.invoke(WrappedHandler.java:64) 
    at com.ibm.ws.webservices.engine.PivotHandlerWrapper.invoke(PivotHandlerWrapper.java:264) 
    at com.ibm.ws.webservices.engine.PivotHandlerWrapper.invoke(PivotHandlerWrapper.java:264) 
    at com.ibm.ws.webservices.engine.WebServicesEngine.invoke(WebServicesEngine.java:336) 
    at com.ibm.ws.webservices.engine.transport.http.WebServicesServlet.doPost(WebServicesServlet.java:1153) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:595) 
    at com.ibm.ws.webservices.engine.transport.http.WebServicesServletBase.service(WebServicesServletBase.java:344) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:668) 
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1225) 
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:775) 
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:457) 
    at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178) 
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1032) 
    at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87) 
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:908) 
    at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662) 
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195) 
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:453) 
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:515) 
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:306) 
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:277) 
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214) 
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113) 
    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:166) 
    at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) 
    at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) 
    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138) 
    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204) 
    at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775) 
    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905) 
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1691) 

SOAP Response E nvelope:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <soapenv:Body> 
    <soapenv:Fault> 
    <faultcode>Server</faultcode> 
    <faultstring>Internal Error</faultstring> 
    </soapenv:Fault> 
    </soapenv:Body> 
    </soapenv:Envelope> 

Ценю за ответ. Спасибо.

ответ

0

сообщение об ошибке кажется похожее на это:

JAX-WS server-side SOAPHandler that returns fault gets "Internal Error" on WebSphere v8

Согласно IBM:

When webservices.unify.faults is set to "true", the runtime exception thrown by the application code is unified, and the client will receive a SOAP fault message indicating "Internal Error".

The fix for this APAR is currently targeted for inclusion in fix packs 7.0.0.25 and 8.0.0.4. Please refer to the Recommended Updates page for delivery information: http://www.ibm.com/support/docview.wss?rs=180&uid=swg27004980

Может быть, вы могли бы обновить версию WebSphere, по крайней мере 8.0.0.4?

+1

У меня такая же проблема. Я использую WAS 8.5. – vivekpansara

+0

Я бегу WAS 8.5.5.4, и я получаю эту проблему - тот же код работает в WAS 7. – Deian

Смежные вопросы