Help with WS - No Content-type in the header!
rodosa Dec 12, 2008 5:29 AMHello!!
I'm new in web services world. I don't get to work a simply one. At client server this is the exception thrown:
javax.xml.ws.WebServiceException: No Content-type in the header! at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:143) at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:74) at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:559) at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:518) at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:503) at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:400) at com.sun.xml.ws.client.Stub.process(Stub.java:235) at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:120) at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:230) at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:210) at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:103) at $Proxy25.hola(Unknown Source) at PruebaTest.testMain(PruebaTest.java:209) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at junit.framework.TestCase.runTest(TestCase.java:164) at junit.framework.TestCase.runBare(TestCase.java:130) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:120) at junit.framework.TestSuite.runTest(TestSuite.java:230) at junit.framework.TestSuite.run(TestSuite.java:225) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
And at server side this:
11:17:29,937 ERROR [[JbpmWS]] Servlet.service() for servlet JbpmWS threw exception java.lang.NoClassDefFoundError: Could not initialize class org.jboss.ws.soap.MessageFactoryImpl at org.jboss.ws.server.ServiceEndpoint.handleRequest(ServiceEndpoint.java:211) at org.jboss.ws.server.ServiceEndpointServlet.doPost(ServiceEndpointServlet.java:120) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112) at java.lang.Thread.run(Thread.java:619)
The client code is:
JbpmWS_Service service = new JbpmWS_Service(); System.out.println("Retrieving the port from the following service: " + service); JbpmWS port = (JbpmWS)service.getJbpmWSPort(); System.out.println("Invoking the sayHello operation on the port."); String response = port.hola("Peter"); System.out.println(response);
and the web service:
package com.modules.cmmi.jbpm.requirements.ws; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebResult; import javax.jws.WebService; import javax.jws.soap.SOAPBinding; import javax.xml.ws.ResponseWrapper; import org.jboss.ws.soap.MessageFactoryImpl; @WebService( name = "JbpmWS", targetNamespace = "http://ws.requirements.jbpm.cmmi.modules.com", serviceName="JbpmWS" ) @SOAPBinding ( style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED ) public class JbpmWS { @WebMethod @WebResult(name="return") @ResponseWrapper(localName = "holaResponse", targetNamespace = "http://ws/requirements/jbpm/cmmi/modules/com/", className = "jbpmws.ws.requirements.jbpm.cmmi.modules.com.HolaResponse") public String hola( @WebParam(name = "name")String name ) { return "Hello en el reeeemotooooo" + name; } }
I've generated wsdl file, I could access to it from the jbossws and I modified web.xml adding :
<display-name>JbpmWS</display-name> <servlet> <servlet-name>JbpmWS</servlet-name> <servlet-class>com.modules.cmmi.jbpm.requirements.ws.JbpmWS</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>JbpmWS</servlet-name> <url-pattern>/JbpmWS</url-pattern> </servlet-mapping>
Could someone help me???
Thanks