gpt4 book ai didi

web-services - 从 Web 服务项目调用 EJB 方法

转载 作者:行者123 更新时间:2023-12-03 17:52:43 27 4
gpt4 key购买 nike

我有一个 webservice 项目( WebServiceProject2 ),我想调用 EJB 项目( BelsizeEJB )中的一个方法。

我做了以下事情:Right-click WebServiceProject2 -> Build Path -> Configure Build Path -> Projects tab -> Add -> BelsizeEJB -> OK
BelsizeEJB 项目中的 Login.java

package com.belsize.module;

public class Login {

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

return true;
}

}

WebServiceProject2 中的 Authenticate.java
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 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 ?

关于web-services - 从 Web 服务项目调用 EJB 方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16912826/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com