pedruhenrik 28 de mar. de 2011
bronx, se ajudar metade do que o seu post sobre controle de acesso com vraptor me ajudou acho q meu m² esta garantido no céu,
hahahha
att,
pedruhenrik 28 de mar. de 2011
Mano, tô devendo um novo post…
Preciso fazer uma página explicando tudo certinho, pq já fiz 23423423 melhorias (mentira, umas 5.hehe), e não coloquei em lugar nenhum! =S
q bom! só p/ fechar a thread secundária: to faturando rios de dinheiro com aquele controle! uauauhhua
att,
leofaka 21 de abr. de 2011
Bem que poderia ter um botão curtir no post !
Muito bom o tópico, eu mesmo que ja havia desistido à tempos de implementar a nf-e consegui implementar.
Então, parabéns !
helton.a.marinho 2 de set. de 2011
Caro amigo agradeço pela dica que deixou no forum ajudou muito. gostaria de saber se pode me ajudar estou tendo problema com web service
public static void main ( String [] args ) {
String cert = "C:\\e-cnpj_conexao.pfx" ;
String keystore = "C:\\certificado1.keystore" ;
String senhaCert = "1234546" ;
String nfeDadosMsg = "<nfeDadosMsg><NFe xmlns=\"http://www.portalfiscal.inf.br/nfe\</NFe></nfeDadosMsg>" ;
String http = "https://homologacao.nfe.fazenda.sp.gov.br/nfeweb/services/NfeRetRecepcao2.asmx" ;
new ConfigurarSSL (). configurarSSL ( cert , keystore , senhaCert );
try {
NfeRetRecepcao2Stub . NfeCabecMsg nfecabec = new NfeCabecMsg ();
nfecabec . setCUF ( "35" );
nfecabec . setVersaoDados ( "2.00" );
NfeRetRecepcao2Stub . NfeCabecMsgE cabE = new NfeCabecMsgE ();
cabE . setNfeCabecMsg ( nfecabec );
ByteArrayInputStream baisDados = new ByteArrayInputStream ( nfeDadosMsg . getBytes ());
XMLInputFactory xmlInputFactory = XMLInputFactory . newInstance ();
xmlInputFactory . setProperty ( XMLInputFactory . IS_NAMESPACE_AWARE , Boolean . FALSE );
XMLStreamReader xmlReader = xmlInputFactory . createXMLStreamReader ( baisDados );
NfeRetRecepcao2Stub . NfeDadosMsg dado = NfeRetRecepcao2Stub . NfeDadosMsg . Factory . parse ( xmlReader );
NfeRetRecepcao2Result result = new NfeRetRecepcao2Stub ( http ). nfeRetRecepcao2 ( dado , cabE );
System . out . println ( result . getExtraElement ());
} catch ( Exception e ) {
throw new RuntimeException ( "Message:" + e . getMessage () + " Cause: " + e . getCause () );
}
}
}
returna seguinte erro:
2SP_NFE_PL_006h411Rejeição: Campo versaoDados inexistente no elemento nfeCabecMsg do SOAP Header35
estou esquecendo de algo?
pedruhenrik 2 de set. de 2011
helton.a.marinho 2 de set. de 2011
entao cara utilizei sua classe NfeRecepcao2Stub como exemplo para montar a de NfeRetRecepcao2Stub so alteriei nomes da classe e dos metodos sera que tem que passar mais alguma coisa.
helton.a.marinho 2 de set. de 2011
nao achei nada cara queria pedir + favor como vc monta a parte da soap acho q isso q esta faltando no meu codigo.
tiagokihara 23 de abr. de 2012
Galera, to com um probleminha para acessar o WS da NFS-e, seguem código e erro.
ServiceGinfesImplPortClient service = new ServiceGinfesImplPortClient ();
ServletContext ctx = ServletActionContext . getServletContext ();
System . setProperty ( "sun.security.ssl.allowUnsafeRenegotiation" , "true" );
System . setProperty ( "java.protocol.handler.pkgs" , "com.sun.net.ssl.internal.www.protocol" );
Security . addProvider ( new com . sun . net . ssl . internal . ssl . Provider ());
System . setProperty ( "javax.net.ssl.keyStoreType" , ks . getType ());
System . setProperty ( "javax.net.ssl.keyStore" , "NONE" );
System . setProperty ( "javax.net.ssl.keyStoreAlias" , ks . getCertificateAlias ( cert ));
System . setProperty ( "javax.net.ssl.keyStorePassword" , "" );
System . setProperty ( "javax.net.ssl.trustStoreType" , "JKS" );
System . setProperty ( "javax.net.ssl.trustStore" , ctx . getRealPath ( "certificado/nfse.keystore" ));
String resposta = service . consultarLoteRpsV3 ( sb . toString (), "" );
23 / 04 / 2012 14 : 41 : 50 oracle . j2ee . ws . client . ClientMessages warningCannotCallEndpoint
WARNING : Não é possível conectar ao URL : https : // homologacao . ginfes . com . br // ServiceGinfesImpl devido a java . security . PrivilegedActionException : javax . xml . soap . SOAPException : Message send failed : Connection timed out : connect
12 / 04 / 23 14 : 41 : 50 java . rmi . RemoteException : ; nested exception is :
HTTP transport error : javax . xml . soap . SOAPException : java . security . PrivilegedActionException : javax . xml . soap . SOAPException : Message send failed : Connection timed out : connect
12 / 04 / 23 14 : 41 : 50 at br . com . empro . faturamento . proxy . runtime . ServiceGinfesImplBinding_Stub . consultarLoteRpsV3 ( ServiceGinfesImplBinding_Stub . java : 670 )
12 / 04 / 23 14 : 41 : 50 at br . com . empro . faturamento . proxy . ServiceGinfesImplPortClient . consultarLoteRpsV3 ( ServiceGinfesImplPortClient . java : 52 )
12 / 04 / 23 14 : 41 : 50 at br . com . empro . faturamento . actions . NfseAction . enviarRpsWs ( NfseAction . java : 927 )
12 / 04 / 23 14 : 41 : 50 at br . com . empro . faturamento . actions . NfseAction . obterCertificado ( NfseAction . java : 877 )
12 / 04 / 23 14 : 41 : 50 at br . com . empro . faturamento . actions . NfseAction . gerarXml ( NfseAction . java : 580 )
12 / 04 / 23 14 : 41 : 50 at br . com . empro . faturamento . actions . NfseAction . enviarRps ( NfseAction . java : 537 )
12 / 04 / 23 14 : 41 : 50 at sun . reflect . NativeMethodAccessorImpl . invoke0 ( Native Method )
12 / 04 / 23 14 : 41 : 50 at sun . reflect . NativeMethodAccessorImpl . invoke ( NativeMethodAccessorImpl . java : 39 )
12 / 04 / 23 14 : 41 : 50 at sun . reflect . DelegatingMethodAccessorImpl . invoke ( DelegatingMethodAccessorImpl . java : 25 )
12 / 04 / 23 14 : 41 : 50 at java . lang . reflect . Method . invoke ( Method . java : 597 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . DefaultActionInvocation . invokeAction ( DefaultActionInvocation . java : 452 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . DefaultActionInvocation . invokeActionOnly ( DefaultActionInvocation . java : 291 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . DefaultActionInvocation . invoke ( DefaultActionInvocation . java : 254 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . interceptor . DefaultWorkflowInterceptor . doIntercept ( DefaultWorkflowInterceptor . java : 176 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . interceptor . MethodFilterInterceptor . intercept ( MethodFilterInterceptor . java : 98 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . DefaultActionInvocation . invoke ( DefaultActionInvocation . java : 248 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . validator . ValidationInterceptor . doIntercept ( ValidationInterceptor . java : 263 )
12 / 04 / 23 14 : 41 : 50 at org . apache . struts2 . interceptor . validation . AnnotationValidationInterceptor . doIntercept ( AnnotationValidationInterceptor . java : 68 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . interceptor . MethodFilterInterceptor . intercept ( MethodFilterInterceptor . java : 98 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . DefaultActionInvocation . invoke ( DefaultActionInvocation . java : 248 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . interceptor . ConversionErrorInterceptor . intercept ( ConversionErrorInterceptor . java : 133 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . DefaultActionInvocation . invoke ( DefaultActionInvocation . java : 248 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . interceptor . ParametersInterceptor . doIntercept ( ParametersInterceptor . java : 207 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . interceptor . MethodFilterInterceptor . intercept ( MethodFilterInterceptor . java : 98 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . DefaultActionInvocation . invoke ( DefaultActionInvocation . java : 248 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . interceptor . ParametersInterceptor . doIntercept ( ParametersInterceptor . java : 207 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . interceptor . MethodFilterInterceptor . intercept ( MethodFilterInterceptor . java : 98 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . DefaultActionInvocation . invoke ( DefaultActionInvocation . java : 248 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . interceptor . StaticParametersInterceptor . intercept ( StaticParametersInterceptor . java : 190 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . DefaultActionInvocation . invoke ( DefaultActionInvocation . java : 248 )
12 / 04 / 23 14 : 41 : 50 at org . apache . struts2 . interceptor . MultiselectInterceptor . intercept ( MultiselectInterceptor . java : 75 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . DefaultActionInvocation . invoke ( DefaultActionInvocation . java : 248 )
12 / 04 / 23 14 : 41 : 50 at org . apache . struts2 . interceptor . CheckboxInterceptor . intercept ( CheckboxInterceptor . java : 94 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . DefaultActionInvocation . invoke ( DefaultActionInvocation . java : 248 )
12 / 04 / 23 14 : 41 : 50 at org . apache . struts2 . interceptor . FileUploadInterceptor . intercept ( FileUploadInterceptor . java : 243 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . DefaultActionInvocation . invoke ( DefaultActionInvocation . java : 248 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . interceptor . ModelDrivenInterceptor . intercept ( ModelDrivenInterceptor . java : 100 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . DefaultActionInvocation . invoke ( DefaultActionInvocation . java : 248 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . interceptor . ScopedModelDrivenInterceptor . intercept ( ScopedModelDrivenInterceptor . java : 141 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . DefaultActionInvocation . invoke ( DefaultActionInvocation . java : 248 )
12 / 04 / 23 14 : 41 : 50 at org . apache . struts2 . interceptor . debugging . DebuggingInterceptor . intercept ( DebuggingInterceptor . java : 267 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . DefaultActionInvocation . invoke ( DefaultActionInvocation . java : 248 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . interceptor . ChainingInterceptor . intercept ( ChainingInterceptor . java : 142 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . DefaultActionInvocation . invoke ( DefaultActionInvocation . java : 248 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . interceptor . PrepareInterceptor . doIntercept ( PrepareInterceptor . java : 166 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . interceptor . MethodFilterInterceptor . intercept ( MethodFilterInterceptor . java : 98 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . DefaultActionInvocation . invoke ( DefaultActionInvocation . java : 248 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . interceptor . I18nInterceptor . intercept ( I18nInterceptor . java : 176 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . DefaultActionInvocation . invoke ( DefaultActionInvocation . java : 248 )
12 / 04 / 23 14 : 41 : 50 at org . apache . struts2 . interceptor . ServletConfigInterceptor . intercept ( ServletConfigInterceptor . java : 164 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . DefaultActionInvocation . invoke ( DefaultActionInvocation . java : 248 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . interceptor . AliasInterceptor . intercept ( AliasInterceptor . java : 190 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . DefaultActionInvocation . invoke ( DefaultActionInvocation . java : 248 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . interceptor . ExceptionMappingInterceptor . intercept ( ExceptionMappingInterceptor . java : 187 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . DefaultActionInvocation . invoke ( DefaultActionInvocation . java : 248 )
12 / 04 / 23 14 : 41 : 50 at br . com . empro . faturamento . interceptor . LoginInterceptor . intercept ( LoginInterceptor . java : 51 )
12 / 04 / 23 14 : 41 : 50 at com . opensymphony . xwork2 . DefaultActionInvocation . invoke ( DefaultActionInvocation . java : 248 )
12 / 04 / 23 14 : 41 : 50 at org . apache . struts2 . impl . StrutsActionProxy . execute ( StrutsActionProxy . java : 52 )
12 / 04 / 23 14 : 41 : 50 at org . apache . struts2 . dispatcher . Dispatcher . serviceAction ( Dispatcher . java : 485 )
12 / 04 / 23 14 : 41 : 50 at org . apache . struts2 . dispatcher . FilterDispatcher . doFilter ( FilterDispatcher . java : 395 )
12 / 04 / 23 14 : 41 : 50 at com . evermind . server . http . ServletRequestDispatcher . invoke ( ServletRequestDispatcher . java : 623 )
12 / 04 / 23 14 : 41 : 50 at com . evermind . server . http . ServletRequestDispatcher . forwardInternal ( ServletRequestDispatcher . java : 370 )
12 / 04 / 23 14 : 41 : 50 at com . evermind . server . http . HttpRequestHandler . handleNotFound ( HttpRequestHandler . java : 1042 )
12 / 04 / 23 14 : 41 : 50 at com . evermind . server . http . HttpRequestHandler . doProcessRequest ( HttpRequestHandler . java : 911 )
12 / 04 / 23 14 : 41 : 50 at com . evermind . server . http . HttpRequestHandler . processRequest ( HttpRequestHandler . java : 453 )
12 / 04 / 23 14 : 41 : 50 at com . evermind . server . http . HttpRequestHandler . serveOneRequest ( HttpRequestHandler . java : 221 )
12 / 04 / 23 14 : 41 : 50 at com . evermind . server . http . HttpRequestHandler . run ( HttpRequestHandler . java : 122 )
12 / 04 / 23 14 : 41 : 50 at com . evermind . server . http . HttpRequestHandler . run ( HttpRequestHandler . java : 111 )
12 / 04 / 23 14 : 41 : 50 at oracle . oc4j . network . ServerSocketReadHandler $ SafeRunnable . run ( ServerSocketReadHandler . java : 260 )
12 / 04 / 23 14 : 41 : 50 at oracle . oc4j . network . ServerSocketAcceptHandler . procClientSocket ( ServerSocketAcceptHandler . java : 234 )
12 / 04 / 23 14 : 41 : 50 at oracle . oc4j . network . ServerSocketAcceptHandler . access $ 700 ( ServerSocketAcceptHandler . java : 29 )
12 / 04 / 23 14 : 41 : 50 at oracle . oc4j . network . ServerSocketAcceptHandler $ AcceptHandlerHorse . run ( ServerSocketAcceptHandler . java : 879 )
12 / 04 / 23 14 : 41 : 50 at com . evermind . util . ReleasableResourcePooledExecutor $ MyWorker . run ( ReleasableResourcePooledExecutor . java : 303 )
12 / 04 / 23 14 : 41 : 50 at java . lang . Thread . run ( Thread . java : 619 )
12 / 04 / 23 14 : 41 : 50 Caused by : HTTP transport error : javax . xml . soap . SOAPException : java . security . PrivilegedActionException : javax . xml . soap . SOAPException : Message send failed : Connection timed out : connect
12 / 04 / 23 14 : 41 : 50 at oracle . j2ee . ws . client . http . HttpClientTransport . invokeImpl ( HttpClientTransport . java : 174 )
12 / 04 / 23 14 : 41 : 50 at oracle . j2ee . ws . client . http . HttpClientTransport . invoke ( HttpClientTransport . java : 150 )
12 / 04 / 23 14 : 41 : 50 at oracle . j2ee . ws . client . StreamingSender . _sendImpl ( StreamingSender . java : 176 )
12 / 04 / 23 14 : 41 : 50 at oracle . j2ee . ws . client . StreamingSender . _send ( StreamingSender . java : 113 )
12 / 04 / 23 14 : 41 : 50 at br . com . empro . faturamento . proxy . runtime . ServiceGinfesImplBinding_Stub . consultarLoteRpsV3 ( ServiceGinfesImplBinding_Stub . java : 653 )
12 / 04 / 23 14 : 41 : 50 ... 73 more
Não estou setando o KeyStore, uso certificado A3 do tipo Token, não sei ao certo como fazer…
Se alguém puder me ajudar, eu agradeço.
Abraços
diegoColli 24 de abr. de 2012
Post antigo, mas ainda util no meu caso hehe… Parece que o 4shared não esta querendo me deixar baixar esse arquivo lá (talvez nem exista mais) então teria como passar por email, ou sei lá upar denovo o pdf ou alguma coisa assim? Muito obrigado vlw…
pedruhenrik 25 de abr. de 2012
tiagokihara a maneira como vc carrega o token esta diferente da q eu conheço. vc ñ precisa d 1 jks p/ a3.
veja se a ajuda: http://www.guj.com.br/java/206895-resolvido-sunmscapi-x-sunpkcs11—identificar-e-carregar-token-certificado-a3
diegoColli baixei os arquivos normalmente através do 4shared.
testa em outra rede, se ñ conseguir avisa ae.
att,
tiagokihara 26 de abr. de 2012
Não entendi bem o que vc quis dizer…
Eu preciso setar o trustStore e o keyStore correto?
usando o código que vc criou fiz…
KeyStore ks = KeyStore . getInstance ( "Windows-MY" , "SunMSCAPI" );
ks . load ( null , null );
KeyStore . PrivateKeyEntry keyEntry = null ;
X509Certificate cert = null ;
Enumeration < String > aliasEnum = ks . aliases ();
while ( aliasEnum . hasMoreElements ()) {
String aliasKey = ( String ) aliasEnum . nextElement ();
if ( ks . isKeyEntry ( aliasKey )) {
keyEntry = ( KeyStore . PrivateKeyEntry ) ks . getEntry ( aliasKey , new KeyStore . PasswordProtection ( "" . toCharArray ()));
cert = ( X509Certificate ) keyEntry . getCertificate ();
}
}
mas como eu seto o keystore nas propriedades do sistema?
o que eu coloco no trustStore?
Vi em um artigo que posso usar “NONE” para keyStore e trustStore quando o certificado estiver em hardware, e no Type coloco “pkcs11”, mas coloco isso e não acontece nada…
Ta dando um trabalhão isso ai…^^
meu token é um gemalto e-seal.
Atte.
rafaelshock 10 de abr. de 2013
galera estou tendo problemas no 5° Passo ? Montando o Keystore
na parte de colocar o comando no Prompt de Comando:
o pedruhenrik tem me ajudado muito, creio que é algo que eu esteja fazendo errado…
sempre que faço o comando tem o seguinte retorno
A sintaxe do nome do arquivo, do nome do diretório ou do rótulo do volume está incorreta.
Alguém pode me ajudar?