从web服务项目调用EJB方法



我有一个web服务项目(WebServiceProject2),我想在EJB项目(BelsizeEJB)中调用一个方法。

我做了以下工作:Right-click WebServiceProject2 -> Build Path -> Configure Build Path -> Projects tab -> Add -> BelsizeEJB -> OK

Login.java in BelsizeEJB project

package com.belsize.module;
public class Login {
    public boolean loginuser(String User, String Password) {
        String LOC = "Login: loginUser";
        System.out.println(LOC);
        return true;
    }
}

authentication .java in 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);
    }
}

完成上述操作后,我创建了一个新的web服务,并生成如下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响应信封:

  <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>

非常感谢您的回复。谢谢。

错误信息如下:

返回错误的JAX-WS服务器端SOAPHandler获取"内部错误";在WebSphere v8上

根据IBM:

当webservices. unity .faults设置为"true"时,运行时异常由应用程序抛出的代码是统一的,并且客户端会接收到一个SOAP错误消息,指示"内部错误"。

这个APAR的修复是当前包含在修复包中的目标7.0.0.25和8.0.0.4。有关交付信息,请参阅"推荐更新"页面:http://www.ibm.com/support/docview.wss?rs=180& uid = swg27004980

也许您可以将WebSphere的版本至少更新到8.0.0.4?

相关内容

  • 没有找到相关文章

最新更新