Jboss Web Services
rathinaganesh Oct 12, 2009 8:00 PMGreetings,
I have created and deployed two web applications(say webapp1, webapp2) that generates SOAP message to access a remote web service. We are using Jboss 5.0.0.GA.
Both these applications run fine, if I run then individually. That is, when I start the jboss server and access webapp1 first. Then, I do not have any trouble with webapp1. Now, when I access webapp2, I get the error message listed below.
I get the same error message, when I start the jboss server and access webapp2 for the first and try to access webapp1 second.
So, if I am testing webapp1 and want to test webapp2, I have to restart the jboss server and access webapp2 as soon as the server starts up.
This is the code I have in webapp1
******************* Code on webapp1 ***************
QName serviceQName = new QName(namespace, serviceName); Service service = Service.create(serviceQName); QName portQName = new QName(namespace, portName); service.addPort(portQName, SOAPBinding.SOAP11HTTP_BINDING, endpointAddress); Dispatch<SOAPMessage> dispatch = service.createDispatch(portQName, SOAPMessage.class, Service.Mode.MESSAGE); final String operationName = props.getProperty(svc + ".operationName"); MessageFactory factory = MessageFactory.newInstance(); SOAPMessage soapRequest = factory.createMessage(); soapRequest.setProperty("WRITE_XML_DECLARATION ", false); SOAPBody body = soapRequest.getSOAPBody(); QName payloadName = new QName(namespace, operationName, "ns1"); SOAPBodyElement payload = body.addBodyElement(payloadName); SOAPElement message = payload.addChildElement("arg0"); message.addTextNode(userName); message = payload.addChildElement("arg1"); message.addTextNode(""); soapRequest.writeTo(System.out); SOAPMessage soapResponse = null; soapResponse = dispatch.invoke(soapRequest); soapResponse.writeTo(System.out);
This is the code I have in webapp2
//First create the connection SOAPConnectionFactory soapConnFactory = SOAPConnectionFactory.newInstance(); connection = soapConnFactory.createConnection(); //Next, create the actual message MessageFactory messageFactory = MessageFactory.newInstance(); SOAPMessage message = messageFactory.createMessage(); //Create objects for the message parts SOAPPart soapPart = message.getSOAPPart(); SOAPEnvelope envelope = soapPart.getEnvelope(); SOAPBody body = envelope.getBody(); //Populate the body //Create the main element and namespace SOAPElement bodyElement = body.addChildElement(envelope.createName(operationName,"ns0",namespace)); //Add content bodyElement.addChildElement("parameter").addTextNode(param); //Save the message message.saveChanges(); message.writeTo(System.out); //Set the destination URL destination = new URL(wsdlURL); //Send the message and get a reply SOAPMessage reply = connection.call(message, destination); System.out.println("\nRESPONSE:\n"); reply.writeTo(System.out);
******************* Error Message **********************
16:37:17,000 INFO [STDOUT] Exception occurred::java.io.IOException: Could not transmit message 16:37:17,000 ERROR [STDERR] javax.xml.soap.SOAPException: java.io.IOException: Could not transmit message 16:37:17,000 ERROR [STDERR] at org.jboss.ws.core.soap.SOAPConnectionImpl.callInternal(SOAPConnectionImpl.java:152) 16:37:17,000 ERROR [STDERR] at org.jboss.ws.core.soap.SOAPConnectionImpl.call(SOAPConnectionImpl.java:64) 16:37:17,000 ERROR [STDERR] at com.adaranet.ldaptest.businessobjects.SoapEngineBO.invokeCall(SoapEngineBO.java:177) 16:37:17,000 ERROR [STDERR] at com.adaranet.ldaptest.businessobjects.SoapEngineBO.process(SoapEngineBO.java:51) 16:37:17,000 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 16:37:17,000 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 16:37:17,000 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 16:37:17,000 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585) 16:37:17,000 ERROR [STDERR] at org.directwebremoting.impl.ExecuteAjaxFilter.doFilter(ExecuteAjaxFilter.java:34) 16:37:17,000 ERROR [STDERR] at org.directwebremoting.impl.DefaultRemoter$1.doFilter(DefaultRemoter.java:428) 16:37:17,000 ERROR [STDERR] at org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:431) 16:37:17,000 ERROR [STDERR] at org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:283) 16:37:17,000 ERROR [STDERR] at org.directwebremoting.servlet.PlainCallHandler.handle(PlainCallHandler.java:52) 16:37:17,000 ERROR [STDERR] at org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:101) 16:37:17,000 ERROR [STDERR] at org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:146) 16:37:17,000 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) 16:37:17,000 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) 16:37:17,000 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) 16:37:17,000 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 16:37:17,000 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) 16:37:17,000 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 16:37:17,000 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 16:37:17,000 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235) 16:37:17,000 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) 16:37:17,000 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190) 16:37:17,000 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92) 16:37:17,000 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126) 16:37:17,000 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70) 16:37:17,000 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) 16:37:17,000 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 16:37:17,000 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) 16:37:17,000 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 16:37:17,000 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330) 16:37:17,000 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828) 16:37:17,000 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601) 16:37:17,000 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) 16:37:17,000 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595) 16:37:17,000 ERROR [STDERR] Caused by: java.io.IOException: Could not transmit message 16:37:17,000 ERROR [STDERR] at org.jboss.ws.core.client.HTTPRemotingConnection.invoke(HTTPRemotingConnection.java:264) 16:37:17,000 ERROR [STDERR] at org.jboss.ws.core.client.SOAPProtocolConnectionHTTP.invoke(SOAPProtocolConnectionHTTP.java:71) 16:37:17,000 ERROR [STDERR] at org.jboss.ws.core.soap.SOAPConnectionImpl.callInternal(SOAPConnectionImpl.java:143) 16:37:17,000 ERROR [STDERR] ... 36 more 16:37:17,000 ERROR [STDERR] Caused by: org.jboss.remoting.CannotConnectException: Can not connect http client invoker after 1 attempt(s) 16:37:17,000 ERROR [STDERR] at org.jboss.remoting.transport.http.HTTPClientInvoker.makeInvocation(HTTPClientInvoker.java:246) 16:37:17,000 ERROR [STDERR] at org.jboss.remoting.transport.http.HTTPClientInvoker.transport(HTTPClientInvoker.java:158) 16:37:17,000 ERROR [STDERR] at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:160) 16:37:17,000 ERROR [STDERR] at org.jboss.remoting.Client.invoke(Client.java:1708) 16:37:17,000 ERROR [STDERR] at org.jboss.remoting.Client.invoke(Client.java:612) 16:37:17,000 ERROR [STDERR] at org.jboss.ws.core.client.HTTPRemotingConnection.invoke(HTTPRemotingConnection.java:242) 16:37:17,000 ERROR [STDERR] ... 38 more 16:37:17,000 ERROR [STDERR] Caused by: java.lang.ClassCastException: org.jboss.ws.core.soap.SOAPElementImpl 16:37:17,000 ERROR [STDERR] at org.jboss.ws.core.soap.SOAPEnvelopeImpl.<init>(SOAPEnvelopeImpl.java:57) 16:37:17,000 ERROR [STDERR] at org.jboss.ws.core.soap.EnvelopeBuilderDOM.build(EnvelopeBuilderDOM.java:136) 16:37:17,000 ERROR [STDERR] at org.jboss.ws.core.soap.EnvelopeBuilderDOM.build(EnvelopeBuilderDOM.java:96) 16:37:17,000 ERROR [STDERR] at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:283) 16:37:17,000 ERROR [STDERR] at org.jboss.ws.core.soap.SOAPMessageUnMarshallerHTTP.read(SOAPMessageUnMarshallerHTTP.java:82) 16:37:17,000 ERROR [STDERR] at org.jboss.remoting.transport.http.HTTPClientInvoker.readResponse(HTTPClientInvoker.java:567) 16:37:17,000 ERROR [STDERR] at org.jboss.remoting.transport.http.HTTPClientInvoker.useHttpURLConnection(HTTPClientInvoker.java:366) 16:37:17,000 ERROR [STDERR] at org.jboss.remoting.transport.http.HTTPClientInvoker.makeInvocation(HTTPClientInvoker.java:228) 16:37:17,000 ERROR [STDERR] ... 43 more
Thanks in advance.
Thanks,
Ganesh.