Skip to main content

javax.xml.ws.WebServiceException: No Content-type in the header!

5 replies [Last post]
evan38109
Offline
Joined: 2003-06-14

I am trying to run a basic Metro web service based off of the basic AddNumbers example (going through the web service servlet) on a Jetty (6.1.9) instance with a basic client and keep getting the following error. I also seem to get a similar issue if I try to invoke the endpoint with another client, such as Web Service Studio. I can browse to the WSDL and service description just fine. Any idea what this means or why it is happening?

at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:163)
at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:86)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:595)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:554)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:539)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:436)
at com.sun.xml.ws.client.Stub.process(Stub.java:248)
at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:135)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:109)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:89)
at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:118)
at $Proxy29.add(Unknown Source)
at org.ejc.ws.client.impl.Main.main(Main.java:32)

Service class:
@WebService
public class AddNumbersImpl {

@WebMethod
public int add(int first, int second) {
return first + second;
}
}

Client:
public static void main(String[] args) {
try {
URL wsdlLocation = new URL("http://localhost:8080/ws-service/add");
QName serviceName = new QName("http://ws.ejc.org/", "AddNumbersImplService");
AddNumbersImplService addService = new AddNumbersImplService(wsdlLocation, serviceName);
AddNumbersImpl adder = addService.getAddNumbersImplPort();
int result = adder.add(2, 4);
System.out.println(result);
} catch (MalformedURLException ex) {
ex.printStackTrace();
}
}

sun-jaxws.xml:

web.xml:

Archetype Created Web Application

com.sun.xml.ws.transport.http.servlet.WSServletContextListener

add
com.sun.xml.ws.transport.http.servlet.WSServlet
1

add
/add

60

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
evan38109
Offline
Joined: 2003-06-14

After a long night, I've been able to get around this issue by switching to the libraries published by Metro 1.1 (https://metro.dev.java.net/) instead of the JAX-WS RI 2.1.3 (https://jax-ws.dev.java.net/). (I had gotten the impression that they were one and the same until recently.) I still have no idea what was causing the problem, especially since I could view the published WSDL on localhost just fine, but I'm satisfied that it works.

aaaa0441
Offline
Joined: 2006-07-07

Hi evan38109,

Could you please give me some hint on where to locate the libraries published by Metro 1.1 as you pointed out?

Currently I am experiencing the same issue. I tested the https://svn.java.net/svn/jax-ws-commons~svn/trunk/jaxws-maven-plugin/src... and https://svn.java.net/svn/jax-ws-commons~svn/trunk/jaxws-maven-plugin/src... sample projects.

The wsgen project can be successfully compiled and "mvn jetty:run". I could even access the http://localhost:9090/helloworld?wsdl page correctly and use the wsimport project to generate client stub code. However, when I tried to test with a really simple web method call, the server side returned HTTP 500 error and threw the following exception.

Jan 11, 2012 11:55:57 PM com.sun.xml.ws.transport.http.servlet.WSServletDelegate doGet

SEVERE: caught throwable

java.lang.LinkageError: loader constraint violation: when resolving overridden method "com.sun.xml.ws.message.AttachmentUnmarshallerImpl.getAttachmentAsDataHandler(Ljava/lang/String;)Ljavax/activation/DataHandler;" the class loader (instance of org/mortbay/jetty/webapp/WebAppClassLoader) of the current class, com/sun/xml/ws/message/AttachmentUnmarshallerImpl, and its superclass loader (instance of <bootloader>), have different Class objects for the type javax/activation/DataHandler used in the signature

......

...

The following is my simple web method call code.

public class TestClientStub {

public static void main(String[] args) {

HelloWorldService service = new HelloWorldService();

String result = service.getHelloWorldPort().helloWorld("Yeah!");

System.out.println(result);

}

}

Could you please give me some guidance on this issue?

Thanks a lot!

Glen Mazza

metro-3 wrote:
>
> After a long night, I've been able to get around this issue by switching
> to the libraries published by Metro 1.1 (https://metro.dev.java.net/)
> instead of the JAX-WS RI 2.1.3 (https://jax-ws.dev.java.net/). (I had
> gotten the impression that they were one and the same until recently.) I
> still have no idea what was causing the problem, especially since I could
> view the published WSDL on localhost just fine, but I'm satisfied that it
> works.
> [Message sent by forum member 'evan38109' (evan38109)]
>

I'm just including a response here to help future googlers, as I stumbled
across this problem too.

If you set this logging statement in your Java code as given on the logging
page that Jitu linked to:
com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump=true;

On the console window you'll see this error message that better points to
the problem:

Aug 31, 2008 1:28:05 AM
com.sun.xml.ws.transport.http.servlet.WSServletDelegate doGet
SEVERE: caught throwable
java.lang.LinkageError: loader constraint violation: when resolving
overridden method
"com.sun.xml.ws.message.AttachmentUnmarshallerImpl.getAttachmentAsDataHandler(Ljava/lang/String;)Ljavax/activation/DataHandler;"
the class loader (instance of org/mortbay/jetty/webapp/WebAppClassLoader) of
the current class, com/sun/xml/ws/message/AttachmentUnmarshallerImpl, and
its superclass loader (instance of ), have different Class
objects for the type javax/activation/DataHandler used in the signature
at
com.sun.xml.ws.server.sei.EndpointArgumentsBuilder$DocLit.readRequest(EndpointArgumentsBuilder.java:517)
at
com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:244)
at
com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:93)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:598)

The problem (that occurs with both Metro and CXF) is apparently a
classloader issue--the default classloader used by Jetty doesn't like the
activation.jar that is normally included directly or indirectly in the
WEB-INF/lib folder of your WAR. The solution I found when using embedded
Jetty, is to add the setClassLoader() command as shown below--this
apparently resolves the issue with the duplicate activation.jars (or perhaps
other conflicting JAR issues):

WebAppContext wactx = new WebAppContext();
wactx.setClassLoader(ClassLoader.getSystemClassLoader());
wactx.setContextPath("/doubleit");
wactx.setWar("...path to war file...");

Glen

--
View this message in context: http://www.nabble.com/javax.xml.ws.WebServiceException%3A-No-Content-typ...
Sent from the Metro - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@metro.dev.java.net
For additional commands, e-mail: users-help@metro.dev.java.net

Jitendra Kotamraju

metro@javadesktop.org wrote:
> I am trying to run a basic Metro web service based off of the basic AddNumbers example (going through the web service servlet) on a Jetty (6.1.9) instance with a basic client and keep getting the following error. I also seem to get a similar issue if I try to invoke the endpoint with another client, such as Web Service Studio. I can browse to the WSDL and service description just fine. Any idea what this means or why it is happening?
>
Do you see any errors on the jetty side ? So you could access the WSDL
URL from browser

http://localhost:8080/ws-service/add?wsdl

The other thing is to see what's going on the wire. Enable server side tracing to see why server is not sending Content-Type header.
https://jax-ws.dev.java.net/guide/Logging.html

Jitu

> at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:163)
> at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:86)
> at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:595)
> at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:554)
> at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:539)
> at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:436)
> at com.sun.xml.ws.client.Stub.process(Stub.java:248)
> at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:135)
> at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:109)
> at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:89)
> at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:118)
> at $Proxy29.add(Unknown Source)
> at org.ejc.ws.client.impl.Main.main(Main.java:32)
>
>
> [u]Service class:[/u]
> @WebService
> public class AddNumbersImpl {
>
> @WebMethod
> public int add(int first, int second) {
> return first + second;
> }
> }
>
> [u]Client:[/u]
> public static void main(String[] args) {
> try {
> URL wsdlLocation = new URL("http://localhost:8080/ws-service/add");
> QName serviceName = new QName("http://ws.ejc.org/", "AddNumbersImplService");
> AddNumbersImplService addService = new AddNumbersImplService(wsdlLocation, serviceName);
> AddNumbersImpl adder = addService.getAddNumbersImplPort();
> int result = adder.add(2, 4);
> System.out.println(result);
> } catch (MalformedURLException ex) {
> ex.printStackTrace();
> }
> }
>
> [u]sun-jaxws.xml:[/u]
>
> > name='add'
> implementation='org.ejc.ws.AddNumbersImpl'
> url-pattern='/add'/>
>

>
> [u]web.xml:[/u]
>
>
> Archetype Created Web Application
>
>
com.sun.xml.ws.transport.http.servlet.WSServletContextListener >
>
> add
> com.sun.xml.ws.transport.http.servlet.WSServlet
> 1
>

>
> add
> /add
>

>
> 60
>

>

> [Message sent by forum member 'evan38109' (evan38109)]
>
> http://forums.java.net/jive/thread.jspa?messageID=267415
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@metro.dev.java.net
> For additional commands, e-mail: users-help@metro.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@metro.dev.java.net
For additional commands, e-mail: users-help@metro.dev.java.net

Carlitosd
Offline
Joined: 2012-04-12

Jitendra Kotamraju wrote:
metro@javadesktop.org wrote:
> I am trying to run a basic Metro web service based off of the basic AddNumbers example (going through the web service servlet) on a Jetty (6.1.9) instance with a basic client and keep getting the following error. I also seem to get a similar issue if I try to invoke the endpoint with another client, such as Web Service Studio. I can browse to the WSDL and service description just fine. Any idea what this means or why it is happening?
>
Do you see any errors on the jetty side ? So you could access the WSDL
URL from browser

http://localhost:8080/ws-service/add?wsdl

The other thing is to see what's going on the wire. Enable server side tracing to see why server is not sending Content-Type header.
https://jax-ws.dev.java.net/guide/Logging.html

Jitu

> at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:163)
> at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:86)
> at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:595)
> at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:554)
> at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:539)
> at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:436)
> at com.sun.xml.ws.client.Stub.process(Stub.java:248)
> at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:135)
> at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:109)
> at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:89)
> at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:118)
> at $Proxy29.add(Unknown Source)
> at org.ejc.ws.client.impl.Main.main(Main.java:32)
>
>
> Service class:
> @WebService
> public class AddNumbersImpl {
>
> @WebMethod
> public int add(int first, int second) {
> return first + second;
> }
> }
>
> Client:
> public static void main(String[] args) {
> try {
> URL wsdlLocation = new URL("http://localhost:8080/ws-service/add");
> QName serviceName = new QName("http://ws.ejc.org/", "AddNumbersImplService");
> AddNumbersImplService addService = new AddNumbersImplService(wsdlLocation, serviceName);
> AddNumbersImpl adder = addService.getAddNumbersImplPort();
> int result = adder.add(2, 4);
> System.out.println(result);
> } catch (MalformedURLException ex) {
> ex.printStackTrace();
> }
> }
>
> Generally across the world, folks will search for the best way to move their things from one position to an additional location. It looks like few of the persons we analyzed were against the concept of shipping and delivery. That is why the printing market is so well-liked right now. Finally, we understand that a http://discountprintingcodes.com/psprint-gift-code-free-shipping psprint gift codes with free shipping is quite possibly the simplest way to diminish shipping costs. We assumed this became fairly funny.
>
> sun-jaxws.xml:
>
> > name='add'
> implementation='org.ejc.ws.AddNumbersImpl'
> url-pattern='/add'/>
>

>
> web.xml:
>
>
> Archetype Created Web Application
>
>
com.sun.xml.ws.transport.http.servlet.WSServletContextListener >
>
> add
> com.sun.xml.ws.transport.http.servlet.WSServlet
> 1
>

>
> add
> /add
>

>
> 60
>

>

> [Message sent by forum member 'evan38109' (evan38109)]
>
> http://forums.java.net/jive/thread.jspa?messageID=267415
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@metro.dev.java.net
> For additional commands, e-mail: users-help@metro.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@metro.dev.java.net
For additional commands, e-mail: