[Ajuda] Erro ao consumir WS da prefeitura SP (NFe)

7 respostas
I

eu modifiquei o programa para apresentar meu problema e contar com a ajuda da comunidade

P FAVOR, VEJA MINHA QUESTÃO MAIS ABAIXO.

vlw

7 Respostas

M

Boa tarde,

Porque voce nao utiliza um CACERT usando o pfx é muito mais pratico. Voce precisa dizer para o sistema que o ws é confiavel e ai sim tentar.
O erro nao é la no WS e sim na saida. Se fosse la teria dado no minimo forbiden.

File file = this.getFileCacerts(); // Aqui voce tem que pegar o cacert
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", "PKCS12");
System.setProperty("javax.net.ssl.keyStore", pathCert);
System.setProperty("javax.net.ssl.keyStorePassword", passCert);
System.setProperty("javax.net.ssl.trustStoreType", "JKS");
System.setProperty("javax.net.ssl.trustStore", file.getAbsolutePath());

Procura sobre Cacerts.

I

obrigado pela resposta!

eu resolvi fazer um projeto java teste simples para conexao:

public static void main(String[] args) {
		
		 Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
	        
	        System.setProperty("com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump", "true"); 
	        System.setProperty("com.sun.xml.ws.transport.http.HttpAdapter.dump", "true"); 
	        
	        System.setProperty("javax.net.debug", "ssl");
		
			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.keyStoreProvider","SunMSCAPI");
			System.setProperty("javax.net.ssl.keyStoreType", "Windows-MY" );
			System.setProperty("javax.net.ssl.keyStore", "C:\\wwNFe\\funfa\\nfeCliente.jks");
			System.setProperty("javax.net.ssl.keyStorePassword", "senhaDoJKS");
			
			System.setProperty("javax.net.ssl.trustStoreType", "JKS");
			System.setProperty("javax.net.ssl.trustStore","C:\\wwNFe\\funfa\\jssecacerts");;
	        System.setProperty("javax.net.ssl.trustStorePassword", "changeit"); 

			// Endereço, local onde encontra-se o Web Service
			String local = "https://nfe.fazenda.sp.gov.br/nfeweb/services/nfestatusservico.asmx";

			// Criando e configurando o serviço
			Call call;
			try {
				call = (Call) new Service().createCall();

				// Configurando o endereço.
				call.setTargetEndpointAddress(local);

				// Marcando o método a ser chamado.
				call.setOperationName("consultaServ");

				String nfeCabecMsg ="<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
						"<cabecMsg xmlns=\"http://www.portalfiscal.inf.br/nfe\" versao=\"1.02\">" +
						"	<versaoDados>1.07</versaoDados>" +
						"</cabecMsg>";
				
				String nfeDadosMsg = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
						"<consStatServ versao=\"1.07\" xmlns=\"http://www.portalfiscal.inf.br/nfe\">" +
						"	<tpAmb>1</tpAmb>" +
						"	<cUF>42</cUF>" +
						"	<xServ>STATUS</xServ>" +
						"</consStatServ>";

				// Set Parâmetros de envio
				Object[] param = new Object[] { nfeCabecMsg, nfeDadosMsg };

				try {
					// Retorno
					System.out.println("Retorno webservice: " + call.invoke(param));
				} catch (RemoteException e) {
					e.printStackTrace();
					// System.out.println("Problemas ao conectar com webservice " + local
						//	+ "\n" + e.getMessage());
				} catch (Exception e) {
					// e.printStackTrace();
					System.out.println("Problemas ao conectar com webservice " + local
							+ "\n" + e.getMessage());
				}
			
			} catch (ServiceException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}		
		

	}

Quando eu rodo, o sistema abre uma janela para digitar a senha PIN do token A3. Quando eu digito, o sistema apresenta varias informacoes

[2]: ObjectId: 2.5.29.31 Criticality=false
CRLDistributionPoints [
  [DistributionPoint:
     [URIName: http://acraiz.icpbrasil.gov.br/LCRacraizv1.crl]
]]

[3]: ObjectId: 2.5.29.15 Criticality=true
KeyUsage [
  Key_CertSign
  Crl_Sign
]

[4]: ObjectId: 2.5.29.32 Criticality=false
CertificatePolicies [
  [CertificatePolicyId: [2.16.76.1.1.0]
[PolicyQualifierInfo: [
  qualifierID: 1.3.6.1.5.5.7.2.1
  qualifier: 0000: 16 2C 68 74 74 70 3A 2F   2F 61 63 72 61 69 7A 2E  .,http://acraiz.
0010: 69 63 70 62 72 61 73 69   6C 2E 67 6F 76 2E 62 72  icpbrasil.gov.br
0020: 2F 44 50 43 61 63 72 61   69 7A 2E 70 64 66        /DPCacraiz.pdf

]]  ]
]

[5]: ObjectId: 2.5.29.19 Criticality=true
BasicConstraints:[
  CA:true
  PathLen:[telefone removido]
]

]
  Algorithm: [SHA1withRSA]
  Signature:
0000: 59 6C 8A 76 E9 19 71 57   83 FE A7 F4 7A 0F 9E 81  Yl.v..qW....z...
0010: D0 CF 07 1C 0C 23 E9 24   0D 51 CB 33 E8 2A 09 C3  .....#.$.Q.3.*..
0020: 7A FF 0E A3 80 86 60 C1   70 97 E0 C0 0A 55 DD A4  z.....`.p....U..
0030: 65 4C 8F A7 47 B0 57 B7   F3 AB C4 C3 19 E3 98 EC  eL..G.W.........
0040: 0D B0 1B 51 91 C9 D9 09   D6 E9 6A B3 E7 0C B0 B2  ...Q......j.....
0050: 92 87 FB 8E 4D 15 EC 12   14 19 78 0C 62 EA 14 39  ....M.....x.b..9
0060: 18 0A C5 55 DB 53 85 DC   7B 28 FA 15 71 A3 CA 74  ...U.S...(..q..t
0070: 25 82 0F 67 27 34 D7 AE   52 13 02 FB C5 EF 9A 80  %..g'4..R.......
0080: 25 A5 52 9E 39 0E ED 3A   F4 78 07 5F D5 28 7A 0A  %.R.9..:.x._.(z.
0090: 4A F5 D0 C3 67 F7 8C 58   17 6F 0A 00 A3 26 10 B4  J...g..X.o...&..
00A0: 60 22 3A 4A 48 A5 DA E0   A9 84 DE 43 DB 9F 43 A7  `":JH......C..C.
00B0: 3F 28 04 47 92 2F F7 E7   64 75 21 D2 4F 81 CE AA  ?(.G./..du!.O...
00C0: 3E 64 0E E3 0E AD 55 9A   7E 94 9B 34 C1 D0 AE 69  >d....U....4...i
00D0: 4E 1E A3 D9 B3 87 57 DA   70 C2 5A 7D 87 CD F9 BF  N.....W.p.Z.....
00E0: 37 DE ED 56 35 F7 B7 22   0E 4F 92 B8 3F 08 DF 9C  7..V5..".O..?...
00F0: 9E 98 5E F2 6F B9 FA 9B   2C F8 CD 45 D8 72 B2 20  ..^.o...,..E.r. 

]
***
*** ClientKeyExchange, RSA PreMasterSecret, TLSv1
main, WRITE: TLSv1 Handshake, length = 5364
SESSION KEYGEN:
PreMaster Secret:
0000: 03 01 C2 E6 A5 E7 7D 2F   19 C1 60 4C A2 36 0A FC  ......./..`L.6..
0010: 48 35 2A A3 BC 41 15 06   5D ED B5 6E 60 BB FB BF  H5*..A..]..n`...
0020: 15 73 A3 BE 28 5F 30 3D   85 9A FA B2 C2 3E F1 F0  .s..(_0=.....>..
CONNECTION KEYGEN:
Client Nonce:
0000: 4C 65 78 CA 87 52 C0 D9   46 D5 4F 3B 09 AF 7F 14  Lex..R..F.O;....
0010: 3F 08 0E 14 57 B0 4F AC   77 7A EF 1C FE A4 EC 60  ?...W.O.wz.....`
Server Nonce:
0000: 4C 65 78 8E 6C 28 9E 51   FE E2 C0 D7 BE CF B3 BB  Lex.l(.Q........
0010: 20 04 BF 00 83 5E 20 D3   A7 43 24 A4 AE C0 FB 40   ....^ ..C$....@
Master Secret:
0000: 11 4D 00 0C 0F 61 CB EE   1C 9A 83 85 DD 8F 4D 11  .M...a........M.
0010: 47 4D 5A 5D BB B6 13 70   78 FB F1 48 6D 3E 57 8E  GMZ]...px..Hm>W.
0020: 91 94 29 7C 7B C8 48 BD   C1 3C 14 83 00 16 9E 45  ..)...H..<.....E
Client MAC write Secret:
0000: A6 D5 75 14 C7 B1 18 12   15 6B B1 B7 14 4B D3 AE  ..u......k...K..
Server MAC write Secret:
0000: 54 9B A7 2B 24 AF 14 E0   AD E6 3E C1 77 E3 4B A4  T..+$.....>.w.K.
Client write key:
0000: 71 21 45 91 A2 AB 79 39   43 D3 59 BD 32 21 A7 3E  q!E...y9C.Y.2!.>
Server write key:
0000: 38 CB C2 93 A5 A7 7A 94   36 EB 04 BE D8 23 37 65  8.....z.6....#7e
... no IV used for this cipher
*** CertificateVerify
main, WRITE: TLSv1 Handshake, length = 150
main, WRITE: TLSv1 Change Cipher Spec, length = 17
*** Finished
verify_data:  { 139, 17, 234, 8, 89, 187, 255, 12, 105, 146, 170, 28 }
***
main, WRITE: TLSv1 Handshake, length = 32
main, received EOFException: ignored
main, called closeInternal(false)
main, SEND TLSv1 ALERT:  warning, description = close_notify
main, WRITE: TLSv1 Alert, length = 18
main, called close()
main, called closeInternal(true)
main, called close()
main, called closeInternal(true)
main, called close()
main, called closeInternal(true)
13/08/2010 13:54:34 org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
INFO: I/O exception (org.apache.commons.httpclient.NoHttpResponseException) caught when processing request: The server nfe.fazenda.sp.gov.br failed to respond
13/08/2010 13:54:34 org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
INFO: Retrying request
main, setSoTimeout(600000) called
main, setSoTimeout(600000) called
%% Client cached [Session-1, SSL_RSA_WITH_RC4_128_MD5]
%% Try resuming [Session-1, SSL_RSA_WITH_RC4_128_MD5] from port 1161
*** ClientHello, TLSv1
RandomCookie:  GMT: [telefone removido] bytes = { 236, 70, 67, 145, 232, 19, 127, 76, 73, 227, 46, 148, 152, 133, 236, 153, 175, 156, 225, 157, 238, 231, 157, 64, 18, 88, 195, 19 }
Session ID:  {70, 15, 0, 0, 75, 102, 46, 245, 4, 184, 1, 78, 23, 204, 79, 170, 216, 129, 125, 193, 78, 193, 237, 124, 79, 146, 89, 17, 43, 58, 152, 27}
Cipher Suites: [SSL_RSA_WITH_RC4_128_MD5, SSL_RSA_WITH_RC4_128_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA, SSL_RSA_WITH_DES_CBC_SHA, SSL_DHE_RSA_WITH_DES_CBC_SHA, SSL_DHE_DSS_WITH_DES_CBC_SHA, SSL_RSA_EXPORT_WITH_RC4_40_MD5, SSL_RSA_EXPORT_WITH_DES40_CBC_SHA, SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA, SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA]
Compression Methods:  { 0 }
***
main, WRITE: TLSv1 Handshake, length = 105
main, READ: TLSv1 Handshake, length = 74
*** ServerHello, TLSv1
RandomCookie:  GMT: [telefone removido] bytes = { 71, 137, 14, 192, 228, 118, 9, 124, 153, 238, 201, 248, 155, 192, 135, 255, 165, 249, 116, 208, 225, 160, 89, 84, 6, 102, 32, 172 }
Session ID:  {70, 15, 0, 0, 75, 102, 46, 245, 4, 184, 1, 78, 23, 204, 79, 170, 216, 129, 125, 193, 78, 193, 237, 124, 79, 146, 89, 17, 43, 58, 152, 27}
Cipher Suite: SSL_RSA_WITH_RC4_128_MD5
Compression Method: 0
***
CONNECTION KEYGEN:
Client Nonce:
0000: 4C 65 78 CA EC 46 43 91   E8 13 7F 4C 49 E3 2E 94  Lex..FC....LI...
0010: 98 85 EC 99 AF 9C E1 9D   EE E7 9D 40 12 58 C3 13  ...........@.X..
Server Nonce:
0000: 4C 65 78 8E 47 89 0E C0   E4 76 09 7C 99 EE C9 F8  Lex.G....v......
0010: 9B C0 87 FF A5 F9 74 D0   E1 A0 59 54 06 66 20 AC  ......t...YT.f .
Master Secret:
0000: C9 B1 93 58 A6 99 73 05   DD 7F 44 CF AD B5 93 DE  ...X..s...D.....
0010: 84 FF 2D E0 20 11 40 34   AD 59 A3 2A 54 98 5F 4A  ..-. .@4.Y.*T._J
0020: A9 23 D8 AA EC 5B 32 31   A8 DA 39 74 1F 3E CB 1E  .#...[21..9t.>..
Client MAC write Secret:
0000: B6 72 82 F4 2A 26 9D B1   2D D9 14 92 88 ED A0 88  .r..*&..-.......
Server MAC write Secret:
0000: 60 C5 8A A8 0D E8 0A A5   D0 37 B6 DB 01 8F 85 AC  `........7......
Client write key:
0000: 71 96 FB 05 2E 95 02 AB   A2 30 73 29 D2 FF 11 C4  q........0s)....
Server write key:
0000: 8D 77 FD B1 FC 67 24 25   36 75 01 58 5B 21 5C 83  .w...g$%6u.X[!\.
... no IV used for this cipher
%% Server resumed [Session-1, SSL_RSA_WITH_RC4_128_MD5]
main, READ: TLSv1 Change Cipher Spec, length = 1
main, READ: TLSv1 Handshake, length = 32
*** Finished
verify_data:  { 181, 13, 142, 159, 98, 33, 65, 172, 125, 24, 238, 198 }
***
main, WRITE: TLSv1 Change Cipher Spec, length = 1
*** Finished
verify_data:  { 228, 31, 147, 8, 158, 128, 249, 215, 223, 19, 74, 143 }
***
main, WRITE: TLSv1 Handshake, length = 32
main, WRITE: TLSv1 Application Data, length = 1257
main, READ: TLSv1 Handshake, length = 20
*** HelloRequest (empty)
%% Client cached [Session-1, SSL_RSA_WITH_RC4_128_MD5]
%% Try resuming [Session-1, SSL_RSA_WITH_RC4_128_MD5] from port 1161
*** ClientHello, TLSv1
RandomCookie:  GMT: [telefone removido] bytes = { 138, 181, 41, 5, 48, 28, 244, 21, 5, 36, 125, 30, 68, 84, 223, 198, 156, 99, 56, 213, 249, 172, 164, 139, 72, 113, 44, 82 }
Session ID:  {70, 15, 0, 0, 75, 102, 46, 245, 4, 184, 1, 78, 23, 204, 79, 170, 216, 129, 125, 193, 78, 193, 237, 124, 79, 146, 89, 17, 43, 58, 152, 27}
Cipher Suites: [SSL_RSA_WITH_RC4_128_MD5, SSL_RSA_WITH_RC4_128_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA, SSL_RSA_WITH_DES_CBC_SHA, SSL_DHE_RSA_WITH_DES_CBC_SHA, SSL_DHE_DSS_WITH_DES_CBC_SHA, SSL_RSA_EXPORT_WITH_RC4_40_MD5, SSL_RSA_EXPORT_WITH_DES40_CBC_SHA, SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA, SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA]
Compression Methods:  { 0 }
***
main, WRITE: TLSv1 Handshake, length = 121
main, READ: TLSv1 Handshake, length = 8096
*** ServerHello, TLSv1
RandomCookie:  GMT: [telefone removido] bytes = { 174, 100, 99, 33, 125, 89, 192, 79, 243, 176, 130, 134, 98, 123, 180, 170, 91, 80, 59, 241, 54, 46, 200, 249, 94, 234, 246, 91 }
Session ID:  {171, 37, 0, 0, 160, 136, 177, 107, 14, 36, 172, 211, 227, 192, 147, 114, 192, 0, 97, 219, 149, 130, 200, 200, 238, 239, 231, 24, 66, 161, 79, 168}
Cipher Suite: SSL_RSA_WITH_RC4_128_MD5
Compression Method: 0
***
%% Created:  [Session-4, SSL_RSA_WITH_RC4_128_MD5]
** SSL_RSA_WITH_RC4_128_MD5
*** Certificate chain

... e muitas outras informacoes

e aparece o erro abaixo:

... informacoes

***
main, WRITE: TLSv1 Handshake, length = 32
main, received EOFException: ignored
main, called closeInternal(false)
main, SEND TLSv1 ALERT:  warning, description = close_notify
main, WRITE: TLSv1 Alert, length = 18
main, called close()
main, called closeInternal(true)
main, called close()
main, called closeInternal(true)
main, called close()
main, called closeInternal(true)
AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode: 
 faultString: org.apache.commons.httpclient.NoHttpResponseException: The server nfe.fazenda.sp.gov.br failed to respond
 faultActor: 
 faultNode: 
 faultDetail: 
	{http://xml.apache.org/axis/}stackTrace:org.apache.commons.httpclient.NoHttpResponseException: The server nfe.fazenda.sp.gov.br failed to respond
	at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1835)
	at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1590)
	at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:995)
	at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
	at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
	at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
	at org.apache.axis.transport.http.CommonsHTTPSender.invoke(CommonsHTTPSender.java:196)
	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 projeto.TesteWebService.main(TesteWebService.java:68)

	{http://xml.apache.org/axis/}hostname:wwerke03

org.apache.commons.httpclient.NoHttpResponseException: The server nfe.fazenda.sp.gov.br failed to respond
	at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
	at org.apache.axis.transport.http.CommonsHTTPSender.invoke(CommonsHTTPSender.java:301)
	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 projeto.TesteWebService.main(TesteWebService.java:68)
Caused by: org.apache.commons.httpclient.NoHttpResponseException: The server nfe.fazenda.sp.gov.br failed to respond
	at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1835)
	at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1590)
	at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:995)
	at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
	at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
	at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
	at org.apache.axis.transport.http.CommonsHTTPSender.invoke(CommonsHTTPSender.java:196)
	... 10 more

Será q alguém pode me ajudar?

I

alguém?

L

Estou com o mesmo problema seu! Exatamente o mesmo erro:

AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode: 
 faultString: org.apache.commons.httpclient.NoHttpResponseException: The server nfe.fazenda.sp.gov.br failed to respond
 faultActor: 
 faultNode: 
 faultDetail: 
	{http://xml.apache.org/axis/}stackTrace:org.apache.commons.httpclient.NoHttpResponseException: The server nfe.fazenda.sp.gov.br failed to respond
	at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1972)
	at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1727)
	at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1090)
	at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
	at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
	at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
	at org.apache.axis.transport.http.CommonsHTTPSender.invoke(CommonsHTTPSender.java:196)
	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.com.insidecode.nfe.ws.status.NfeStatusServicoSoapStub.nfeStatusServicoNF(NfeStatusServicoSoapStub.java:135)
	at br.com.insidecode.nfe.NFeWebServices.statusServico(NFeWebServices.java:276)
	at br.com.insidecode.nfe.NFeWebServices.servico(NFeWebServices.java:98)
	at br.com.insidecode.nfe.NFeWebServices.main(NFeWebServices.java:462)

	{http://xml.apache.org/axis/}hostname:escritorio

org.apache.commons.httpclient.NoHttpResponseException: The server nfe.fazenda.sp.gov.br failed to respond
	at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
	at org.apache.axis.transport.http.CommonsHTTPSender.invoke(CommonsHTTPSender.java:301)
	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.com.insidecode.nfe.ws.status.NfeStatusServicoSoapStub.nfeStatusServicoNF(NfeStatusServicoSoapStub.java:135)
	at br.com.insidecode.nfe.NFeWebServices.statusServico(NFeWebServices.java:276)
	at br.com.insidecode.nfe.NFeWebServices.servico(NFeWebServices.java:98)
	at br.com.insidecode.nfe.NFeWebServices.main(NFeWebServices.java:462)
Caused by: org.apache.commons.httpclient.NoHttpResponseException: The server nfe.fazenda.sp.gov.br failed to respond
	at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1972)
	at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1727)
	at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1090)
	at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
	at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
	at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
	at org.apache.axis.transport.http.CommonsHTTPSender.invoke(CommonsHTTPSender.java:196)
	... 13 more

Já vasculhei a internet a procura de solução e nada! Alguém mais está passando ou passou por isso?

Obrigado,

Leonardo

L

Consegui resolver aqui usando o provider SunPKCS11 ao invés SunMSCAPI.

No meu caso, meu cliente usa uma leitura Serasa Experian e cartão NF-e.

  1. O primeiro passo é localizar a DLL dessa leitora: no meu caso: C:\WINDOWS\system32\aetpkss1.dll

  2. Localizado a DLL, crie o arquivo de configuração do token: (arquivo token.cfg):

name=Safesig   
library =  C:\WINDOWS\system32\aetpkss1.dll
  1. Agora é código Java. Para ler o certificado:
Provider pkcs11Provider = new SunPKCS11("c:/token.cfg");
		
Security.addProvider(pkcs11Provider);

KeyStore keyStore = KeyStore.getInstance("PKCS11");
keyStore.load(null, "senha do token".toCharArray());

String alias = "";

for (Enumeration e = keyStore.aliases(); e.hasMoreElements();) {
	alias = (String) e.nextElement();
}

PrivateKey privateKey = (PrivateKey) keyStore.getKey(alias, null);
X509Certificate certificate = (X509Certificate) keyStore	.getCertificate(alias);
G

Boa tarde

estou com o mesmo problema num certificado A3 do serasa para o estado RS, alguem conseguiu alguma coisa?
obrigada

G

percebi que no meu caso a dll que foi instalada foi a cmP11…

Criado 13 de agosto de 2010
Ultima resposta 30 de mai. de 2011
Respostas 7
Participantes 4