Webservice

0 respostas
H

e ai galera usei uma classe para consumir webservice da nfe de um colega do forum

public static void main(String[] args) {
		String cert =   "C:\\e-cnpj_conexao.pfx";
		String keystore = "C:\\certificado1.keystore";
		String senhaCert = "123456";
		String nfeDadosMsg = "<nfeDadosMsg>xml</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() );
		}
		}

esta retornando seguinte erro :

2SP_NFE_PL_006h411Rejeição: Campo versaoDados inexistente no elemento nfeCabecMsg do SOAP Header35

alguem tem sugestão? valew!

Criado 2 de setembro de 2011
Respostas 0
Participantes 1