users@saaj.java.net

Res: [SAAJ-USR] Problems with getSOAPBody from SAAJ

From: Luiz Ricardo <lrbsantos_at_yahoo.com.br>
Date: Wed, 26 Sep 2007 07:13:06 -0700 (PDT)

Hi, thanks for the answer! We are using SAAJ 1.3 (SOAP 1.2) + Tomcat 6.0.10 + JDK 1.5.0. We are sending to you the "Reproducable Testcase" where the client sends a request with nearly 400 kb and the server will hang when the getSOAPBody() is invoked. To execute the client use the following command: java -jar testcaseclient.jar http://localhost/testcase/TestCase Regards, Luiz Ricardo Belém Santos and NF-e Team Sun Certified Programmer for the Java 2 Platform ----- Mensagem original ---- De: V B Kumar Jayanti <Vbkumar.Jayanti@Sun.COM> Para: users@saaj.dev.java.net Enviadas: Quarta-feira, 26 de Setembro de 2007 4:02:54 Assunto: Re: [SAAJ-USR] Problems with getSOAPBody from SAAJ Hi, Which version of SAAJ are you using. Why not try using JAXWS for doing this kind of things. I also see that you are doing some kind of SOAP Message security, for that you can make use of WSIT. If you think the problem is occuring with the latest version of SAAJ then can you send us a Reproducable Testcase that i can run. Thanks. Luiz Ricardo wrote: Hi everyone, I'm from Aracaju - SE, Brazil. I'm with problems invoking the getSOAPBody() method. It was developed a web service using the SAAJ API and subclassing SAAJServlet and now when a client sends a request with length nearly 400 kb my servlets hangs just at this point, that is, invoking the getSOAPBody() method. Follow below the piece of code: ... @Override public SOAPMessage onMessage(SOAPMessage message, HttpServletRequest request) { try { String response = null; // it hangs here!!!! :((( SOAPBody body = message.getSOAPBody(); // recupera a URI do namespace do serviço String namespaceUri = getNamespaceUri(); // recupera o conteúdo XML da área de cabeçalho da mensagem String nfeCabecMsg = body.getElementsByTagNameNS(namespaceUri, "nfeCabecMsg").item(0).getTextContent(); // recupera o conteúdo XML da área de dados da mensagem String nfeDadosMsg = body.getElementsByTagNameNS(namespaceUri, "nfeDadosMsg").item(0).getTextContent(); // recupera o nome do método do web service que está sendo invocado pelo cliente String metodo = body.getFirstChild().getNodeName(); // testa se o nome do método invocado coincide com o nome do serviço if (!metodo.equals(getNomeMetodoServico())) { String msg = "Chamada ao método " + metodo + " quando o esperado era " + getNomeMetodoServico() + "."; logger.error(msg); throw new IllegalArgumentException(msg); } X509Certificate[] cert = (X509Certificate[]) request.getAttribute("javax.servlet.request.X509Certificate"); TORequisicaoCliente rc = new TORequisicaoCliente(); rc.setXmlCabec(nfeCabecMsg); rc.setXmlDados(nfeDadosMsg); rc.setX509Cert(cert[0]); response = validacaoInicial(rc, WS_NFE_RECEPCAO.equals(getServletName())); return montarMensagemSOAP(response); } catch (DOMException dome) { logger.error("Erro ao tentar recuperar partes do corpo da mensagem SOAP.", dome); } catch (SOAPException soape) { logger.error("Erro ao tentar recuperar/criar mensagem SOAP.", soape); } catch (Exception e) { logger.error("Erro inesperado.", e); } return null; } ... Please, help us! Me and my team are waiting to resolve this problem! Any help is welcome! Regards, Luiz Ricardo Belém Santos Sun Certified Programmer for the Java 2 Platform Flickr agora em português. Você clica, todo mundo vê. Saiba mais. Flickr agora em português. Você clica, todo mundo vê. http://www.flickr.com.br/