如何检查服务器上的Jboss实例的行为是否与本地的同一实例不同?

时间:2019-02-06 10:30:10

标签: java soap jboss

我有一个遵循标准架构的Java SOAP Web服务:

enter image description here

SOAP客户端联系在Jboss实例上运行的WebService(无论它是本地运行还是远程运行),WebService调用(在RMI中)远程应用程序,该应用程序以一些数据作为响应并将其返回给请求者。

我的问题大致如下:

  • 在Jboss本地实例上,响应正确返回给SOAP客户端,如下所示:

    <soap:Envelope>
        <soap:Body>
            <myResponse>
                [ELEMENTS OF MY RESPONSE]
            </myResponse>
        </soap:Body>
    </soap:Envelope>
    
  • 在Jboss远程实例上,rhe响应被返回给SOAP客户端,即使在服务器端和Jboss实例上均未引发任何错误:

    <soap:Envelope>
        <soap:Body>
            <myResponse>
                EMPTY IN HERE
            </myResponse>
        </soap:Body>
    </soap:Envelope>
    

由于它可以在本地实例上运行,因此我对如何解决此问题的想法不多。到目前为止,这是我尝试过的:

  • 我试图完全重新编译部署在远程实例上的.war -与本地实例中使用的完全相同。
  • 我尝试在远程实例中反编译.war并检查为请求和响应定义的wsdl / xsd文件:它们是正确的(并且等于在本地实例中,无论如何都重要)。
  • 我还尝试在Application Server上附加一个远程调试器,以检查由远程Jboss实例调用时响应是否正确准备:响应在服务器端正确。
  • 我还试图在远程Jboss服务器上运行另一个请求(不同于所讨论的请求),并且正确返回了响应。
  • 我尝试比较本地实例和远程实例的standalone-full.xml(配置文件),我唯一看到的区别是用于远程版本的套接字绑定,而我没有在本地版本中:

    <socket-binding name="remoting" port="1013"/>
    
  • 最后,我将远程调试器附加到了我的Jboss远程实例上,并检查了WebService本身发生了什么。输入和输出准备充分:

    @WebMethod
    @WebResult(name = "ProductEvaluation")
    public ProductEvaluations myAPIRequest(@WebParam(name = "XmlProducts") final XmlProducts xmlProducts,
        @WebParam(name = "ConnectedToRealtime") final boolean connectedToRealtime,
        @WebParam(name = "Timeout") final Timeout timeout) throws ProductEvaluationFault, TimeoutFault, ProductConfigurationFault, SecurityFault {
        try {
            // some stuff here...
            return result; //result contains what I want
        } catch (SecurityException e) {
            throw new SecurityFault(e.getMessage());
        }
    }
    

    堆栈中的所有内容都是通用的:

    NativeMethodAccessorImpl.invoke(Object, Object[]) line: 62  
    DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43  
    Method.invoke(Object, Object...) line: 498  
    ManagedReferenceMethodInterceptor.processInvocation(InterceptorContext) line: 52    
    InterceptorContext.proceed() line: 340  
    ConcurrentContextInterceptor.processInvocation(InterceptorContext) line: 45 
    InterceptorContext.proceed() line: 340  
    InitialInterceptor.processInvocation(InterceptorContext) line: 21   
    InterceptorContext.proceed() line: 340  
    ChainedInterceptor.processInvocation(InterceptorContext) line: 61   
    ComponentDispatcherInterceptor.processInvocation(InterceptorContext) line: 52   
    InterceptorContext.proceed() line: 340  
    WSComponentInstanceAssociationInterceptor.processInvocation(InterceptorContext) line: 56    
    InterceptorContext.proceed() line: 340  
    InterceptorContext.run() line: 356  
    WildFlySecurityManager.doChecked(PrivilegedExceptionAction<T>) line: 636    
    AccessCheckingInterceptor.processInvocation(InterceptorContext) line: 61    
    InterceptorContext.proceed() line: 340  
    InterceptorContext.run() line: 356  
    PrivilegedWithCombinerInterceptor.processInvocation(InterceptorContext) line: 80    
    InterceptorContext.proceed() line: 340  
    ChainedInterceptor.processInvocation(InterceptorContext) line: 61   
    ViewService$View.invoke(InterceptorContext) line: 195   
    InvocationHandlerJAXWS(AbstractInvocationHandler).invoke(Endpoint, Invocation) line: 137    
    JBossWSInvoker.performInvocation(Exchange, Object, Method, Object[]) line: 169  
    JBossWSInvoker(AbstractInvoker).invoke(Exchange, Object, Method, List<Object>) line: 96 
    JBossWSInvoker(AbstractJAXWSMethodInvoker).invoke(Exchange, Object, Method, List<Object>) line: 232 
    JBossWSInvoker(JAXWSMethodInvoker).invoke(Exchange, Object, Method, List<Object>) line: 85  
    JBossWSInvoker.invoke(Exchange, Object) line: 145   
    ServiceInvokerInterceptor$1.run() line: 59  
    Executors$RunnableAdapter<T>.call() line: 511   
    ServiceInvokerInterceptor$2(FutureTask<V>).run() line: 266  
    ServiceInvokerInterceptor$2.run() line: 126 
    SynchronousExecutor.execute(Runnable) line: 37  
    ServiceInvokerInterceptor.handleMessage(Message) line: 131  
    PhaseInterceptorChain.doIntercept(Message) line: 308    
    ChainInitiationObserver.onMessage(Message) line: 121    
    ServletDestination(AbstractHTTPDestination).invoke(ServletConfig, ServletContext, HttpServletRequest, HttpServletResponse) line: 251    
    RequestHandlerImpl.handleHttpRequest(Endpoint, HttpServletRequest, HttpServletResponse, ServletContext) line: 108   
    ServletHelper.callRequestHandler(HttpServletRequest, HttpServletResponse, ServletContext, Bus, Endpoint) line: 134  
    CXFServletExt.invoke(HttpServletRequest, HttpServletResponse) line: 88  
    CXFServletExt(AbstractHTTPServlet).handleRequest(HttpServletRequest, HttpServletResponse) line: 293 
    CXFServletExt(AbstractHTTPServlet).doPost(HttpServletRequest, HttpServletResponse) line: 212    
    CXFServletExt(HttpServlet).service(HttpServletRequest, HttpServletResponse) line: 707   
    CXFServletExt.service(HttpServletRequest, HttpServletResponse, ServletContext) line: 136    
    WSFServlet.service(HttpServletRequest, HttpServletResponse) line: 140   
    WSFServlet(HttpServlet).service(ServletRequest, ServletResponse) line: 790  
    ServletHandler.handleRequest(HttpServerExchange) line: 85   
    ServletSecurityRoleHandler.handleRequest(HttpServerExchange) line: 62   
    ServletDispatchingHandler.handleRequest(HttpServerExchange) line: 36    
    SecurityContextAssociationHandler.handleRequest(HttpServerExchange) line: 78    
    PredicateHandler.handleRequest(HttpServerExchange) line: 43 
    SSLInformationAssociationHandler.handleRequest(HttpServerExchange) line: 131    
    ServletAuthenticationCallHandler.handleRequest(HttpServerExchange) line: 57 
    PredicateHandler.handleRequest(HttpServerExchange) line: 43 
    ServletConfidentialityConstraintHandler(AbstractConfidentialityHandler).handleRequest(HttpServerExchange) line: 46  
    ServletConfidentialityConstraintHandler.handleRequest(HttpServerExchange) line: 64  
    AuthenticationMechanismsHandler.handleRequest(HttpServerExchange) line: 60  
    CachedAuthenticatedSessionHandler.handleRequest(HttpServerExchange) line: 77    
    NotificationReceiverHandler.handleRequest(HttpServerExchange) line: 50  
    SecurityInitialHandler(AbstractSecurityContextAssociationHandler).handleRequest(HttpServerExchange) line: 43    
    PredicateHandler.handleRequest(HttpServerExchange) line: 43 
    JACCContextIdHandler.handleRequest(HttpServerExchange) line: 61 
    PredicateHandler.handleRequest(HttpServerExchange) line: 43 
    PredicateHandler.handleRequest(HttpServerExchange) line: 43 
    ServletInitialHandler.handleFirstRequest(HttpServerExchange, ServletChain, ServletRequestContext, ServletRequest, ServletResponse) line: 285    
    ServletInitialHandler.dispatchRequest(HttpServerExchange, ServletRequestContext, ServletChain, DispatcherType) line: 264    
    ServletInitialHandler.access$000(ServletInitialHandler, HttpServerExchange, ServletRequestContext, ServletChain, DispatcherType) line: 81   
    ServletInitialHandler$1.handleRequest(HttpServerExchange) line: 175 
    Connectors.executeRootHandler(HttpHandler, HttpServerExchange) line: 202    
    HttpServerExchange$1.run() line: 792    
    XnioWorker$TaskPool(ThreadPoolExecutor).runWorker(ThreadPoolExecutor$Worker) line: 1142 
    ThreadPoolExecutor$Worker.run() line: 617   
    Thread.run() line: 748  
    

有人对我如何调试此类问题有任何想法吗?我忘记检查任何配置文件吗?

1 个答案:

答案 0 :(得分:0)

经过几个小时的挣扎,我终于弄清楚自己出了什么问题。

尽管它看起来像是一个简单的错字,但它使我浪费了很多时间,并显示了Jboss的远程实例与本地实例之间的有趣行为差异,因此,我发布了一个答案,以为陷入困境的人节省一些时间同样的错误。

我开发的新@WebMethod是这个:

@WebMethod
@WebResult(name = "ProductEvaluation")
public ProductEvaluations myAPIRequest(@WebParam(name = "XmlProducts") final XmlProducts xmlProducts,
    @WebParam(name = "ConnectedToRealtime") final boolean connectedToRealtime,
    @WebParam(name = "Timeout") final Timeout timeout) throws ProductEvaluationFault, TimeoutFault, ProductConfigurationFault, SecurityFault {
    try {
        // some stuff here...
        return result; //result contains what I want
    } catch (SecurityException e) {
        throw new SecurityFault(e.getMessage());
    }
}

您可能会注意到(我实际上花了4个小时来注意到它,所以也许它并不那么明显):

  • 该函数的返回类型为ProductEvaluations(表示ProductEvaluation的列表),这也是wsdlxsd中指定的内容
  • 但是,我忘记了s上方注解中的@WebResult(name="ProductEvaluation")

因此,根据我的经验,我注意到:

  • 当Jboss在本地运行时,注释@WebResult将被忽略,并且无论如何都将返回结果。
  • 但是,当Jboss远程运行时,此映射就完成了。因此,由于我返回的是ProductEvaluations(带有s),但是我说@WebResultProductEvaluation(没有s),所以远程服务器是没有映射任何东西,响应就空了。