WebService acessado através de um componente EJB

4 respostas
drcosta

Pessoal,

Estou com problema com certificado digital. Quando tento acessar um webservice através de uma aplicação que esteja rodando no JBoss (EJB) está dando o erro abaixo. Se eu rodar o mesmo código (WebService Client) como Java Application funciona corretamente.

Erro:

AxisFault

faultCode: {<a href="http://xml.apache.org/axis/">http://xml.apache.org/axis/</a>}HTTP

faultSubcode:

faultString: (403)Forbidden

faultActor:

faultNode:

faultDetail:

{}:return code:  403

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "<a href="http://www.w3.org/TR/html4/strict.dtd">http://www.w3.org/TR/html4/strict.dtd</a>">

<HTML><HEAD><TITLE>The page requires a client certificate</TITLE>

<META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252">

<STYLE type="text/css">

BODY { font: 8pt/12pt verdana }

H1 { font: 13pt/15pt verdana }

H2 { font: 8pt/12pt verdana }

A:link { color: red }

A:visited { color: maroon }

</STYLE>

</HEAD><BODY><TABLE width=500 border=0 cellspacing=10><TR><TD>
<h1>The page requires a client certificate</h1>

The page you are attempting to access requires your browser to have a Secure Sockets Layer (SSL) client certificate that the Web server will recognize. The client certificate is used for identifying you as a valid user of the resource.

<hr>

<p>Please try the following:</p>

<ul>

<li>Contact the Web site administrator if you believe you should be able to view this directory or page without a client certificate, or to obtain a client certificate.</li>

<li>If you already have a client certificate, use your Web browser’s security features to ensure that your client certificate is installed properly. (Some Web browsers refer

to client certificates as browser or personal certificates.)</li>

</ul>

<h2>HTTP Error 403.7 - Forbidden: SSL client certificate is required.<br>Internet Information Services (IIS)</h2>

<hr>

<p>Technical Information (for support personnel)</p>

<ul>

<li>Go to <a href=“<a href="http://go.microsoft.com/fwlink/?linkid=8180">http://go.microsoft.com/fwlink/?linkid=8180</a>”>Microsoft Product Support Services</a> and perform a title search for the words <b>HTTP</b> and <b>403</b>.</li>

<li>Open <b>IIS Help</b>, which is accessible in IIS Manager (inetmgr),

and search for topics titled <b>About Certificates</b>, <b>Using Certificate Trust Lists</b>, <b>Enabling Client Certificates</b>, and <b>About Custom Error Messages</b>.</li>

</ul>

</TD></TR></TABLE></BODY></HTML>

{http://xml.apache.org/axis/}HttpErrorCode:403
(403)Forbidden

at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:744)

at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)

at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)

at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)

at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)

at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)

at org.apache.axis.client.Call.invokeEngine(Call.java:2784)

at org.apache.axis.client.Call.invoke(Call.java:2767)

at org.apache.axis.client.Call.invoke(Call.java:2443)

at org.apache.axis.client.Call.invoke(Call.java:2366)

at org.apache.axis.client.Call.invoke(Call.java:1812)

at br.inf.portalfiscal.www.nfe.wsdl.NfeRecepcao.NfeRecepcaoSoapStub.nfeRecepcaoLote(NfeRecepcaoSoapStub.java:110)

at webService.WsNFe.solicitarAutorizacao(WsNFe.java:193)

at nfe.ejb.NFeBean.solicitarAutorizacao(NFeBean.java:180)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:122)

at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111)

at org.jboss.ejb3.EJBContainerInvocationWrapper.invokeNext(EJBContainerInvocationWrapper.java:69)

at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.invoke(InterceptorSequencer.java:73)

at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.aroundInvoke(InterceptorSequencer.java:59)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.jboss.aop.advice.PerJoinpointAdvice.invoke(PerJoinpointAdvice.java:174)

at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.fillMethod(InvocationContextInterceptor.java:72)

at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_fillMethod_20281290.invoke(InvocationContextInterceptor_z_fillMethod_20281290.java)

at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.setup(InvocationContextInterceptor.java:88)

at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_setup_20281290.invoke(InvocationContextInterceptor_z_setup_20281290.java)

at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

at org.jboss.ejb3.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:62)

at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:56)

at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)

at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)

at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:68)

at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)

at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:190)

at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)

at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)

at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186)

at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)

at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)

at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)

at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:306)

at org.jboss.ejb3.stateless.StatelessContainer.invokeEndpoint(StatelessContainer.java:662)

at org.jboss.wsf.container.jboss50.invocation.InvocationHandlerEJB3.invoke(InvocationHandlerEJB3.java:96)

at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:222)

at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:474)

at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:295)

at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:205)

at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:131)

at org.jboss.wsf.common.servlet.AbstractEndpointServlet.service(AbstractEndpointServlet.java:85)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)

at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)

at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)

at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)

at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)

at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

at java.lang.Thread.run(Unknown Source)

Antes de chamar o WebService eu seto as seguintes configurações:

System.getProperties().setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol"); 
  Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); 
	
 System.getProperties().setProperty("javax.net.debug", "ssl");
 System.getProperties().setProperty("javax.net.ssl.trustStoreType", "JKS");
 System.getProperties().setProperty("javax.net.ssl.trustStore", "F:\\Uelson\\Rzk\\certificados\\keystore.jks");
 System.getProperties().setProperty("javax.net.ssl.trustStorePassword", "certificado");
    
    
 System.getProperties().setProperty("javax.net.ssl.keyStoreType", "PKCS12");
 System.getProperties().setProperty("javax.net.ssl.keyStore", "F:\\Uelson\\Rzk\\certificados\\rzk.pfx");
 System.getProperties().setProperty("javax.net.ssl.keyStorePassword", "certificado");

Alguém já passou por isso? Ajuda por favor!!!

4 Respostas

G

Boa noite amigo,

Não sei muito bem como explicar e nem como fazer isso no JBoss, mas procura como instalar esse certificate e essa keystore no seu JBoss que é pra resolver.

Espero ter ajudado.

Abraço,
Gustavo.

drcosta

Obrigado pela atenção Gustavo… eu já tentei de tudo, mas até agora nada resolveu.

Alguma boa alma me ajuda please!!!

drcosta

Galera… algum dos mestres do JAVA pode me ajudar?

albama

Bom dia, gostaria de saber se conseguiu resolver esse problema.

Estou com uma situação semelhante.

Criado 15 de agosto de 2009
Ultima resposta 12 de jul. de 2012
Respostas 4
Participantes 3