This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Web Services and the fly likes Unsupported response content type Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Unsupported response content type "text/html", must be: "text/xml"." Watch "Unsupported response content type "text/html", must be: "text/xml"." New topic
Author

Unsupported response content type "text/html", must be: "text/xml".

Naveen Sharma
Ranch Hand

Joined: Mar 23, 2001
Posts: 65
Hi All...I m using Apache soap 2.2 on Tomcat and deployed a RPC service over there ... although service is deployed successfully...but when i connect a client i got the reponse [SOAPException: faultCode=SOAP-ENV rotocol; msg=Unsupported response content type "text/html", must be: "text/xml". Response was:
<h1>Error: 500</h1>
<h2>Location: /soap/servlet/rpcrouter</h2><b>Internal Servlet Error:</b><br>
<pre>
javax.servlet.ServletException: Error building response envelope: java.lang.Null
PointerException..
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In my client i used
c.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
and then invoke the rpcrouter....
I m sure that all the classes are in classpath...and soap is installed on Tomcat properly...but couldnt get where the things are wrong....
Thanks in Advance
Naveen
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
Does the service show up correctly on the deployed service listings when you direct a browser to the Apache SOAP Admin page? Check that the names of the methods and the provider class are what you expect.
Bill
Naveen Sharma
Ranch Hand

Joined: Mar 23, 2001
Posts: 65
Hi William
thanks for your time.....
yes, the Apache soap admin section shows the deployed service...basically i have followed the Soap Example on Sun Site
There are two ways of deploying a service on Apache soap...first by using Admin Section of Apache Soap and other by writing your own Deployment Descriptor and then deploy it using
org.apache.soap.server.ServiceManagerClient class.....I have used both and in both case i get the deployed service in the listing of apache admin section .....but error is diffrent in the two cases...in first case when i deploy using admin section a fault Error Occurred showing : Fault Code = SOAP-ENV:Server.BadTargetObjectURI Fault String = Unable to resolve target object: Greeter .... (Greeter is the name of class(service)...and i m sure it is in the classpath)
....In second case when i use ServiceManagerClient class to deploy a service i got the previous mentioned error....Unsupported response content type "text/html", must : "text/xml".
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
why i m getting two diffrent types of errors on deploying the same service but in diffrent manner..
Pls Help
Thanks
Naveen
[ February 25, 2002: Message edited by: Naveen Sharma ]
Greg Brouelette
Ranch Hand

Joined: Jan 23, 2002
Posts: 144
I'm having exactly the same error when attempting to run the example programs included with Apache SOAP from WebSPhere 3.5
Deploying the addressbook service...
Exception in thread "main" [SOAPException: faultCode=SOAP-ENV rotocol; msg=Unsupported re
sponse content type "text/html; charset=iso-8859-1", must be: "text/xml&quo
t;. Response was:
]
at org.apache.soap.rpc.Call.getEnvelopeString(Call.java:208)
at org.apache.soap.rpc.Call.invoke(Call.java:255)
at org.apache.soap.server.ServiceManagerClient.invokeMethod(ServiceManagerClient.j
ava:129)
at org.apache.soap.server.ServiceManagerClient.deploy(ServiceManagerClient.java:14
2)
at org.apache.soap.server.ServiceManagerClient.main(ServiceManagerClient.java:230)
Were you able to find a solution? Thank you.


For a good Prime, call:<br />29819592777931214269172453467810429868925511217482600306406141434158089
Greg Brouelette
Ranch Hand

Joined: Jan 23, 2002
Posts: 144
I found the solution (in my case), so I thought I'd share it with the group.
This error really doesn't have anything to do with the content type. It actually means that the rpcrouter servlet isn't accessable. In my case I had to add servlet/rpcrouter to my servlet web path.
Navi Singh
Ranch Hand

Joined: Jul 24, 2002
Posts: 80
Originally posted by Greg Brouelette:
I found the solution (in my case), so I thought I'd share it with the group.
This error really doesn't have anything to do with the content type. It actually means that the rpcrouter servlet isn't accessable. In my case I had to add servlet/rpcrouter to my servlet web path.

Hi Greg,
i am having the same problem,but when i have the servlet on the same machine/locally, i don't get this problem.
Also when the servlet is on another machine i get 30% empty responses(that is the problem)
Does this mean that 30% of the time the servlet/rpcrouter is not accessible??
If so, do have any remedy ?
Thanks in advance,
Navi
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
If you see this error from your SOAP client
Unsupported response content type "text/html", must be: "text/xml".

it means the reply came in html format because of some error in addressing the server. Unfortunately, SOAP clients blort out that very unhelpful message instead of showing the html error message.
If the request gets through to the SOAP server you should be getting XML back even if it is an error.
In writing my SOAP book I found it helpful to spy on the exact content of the request and response. You can download the utility for this from my site - pick the SOAP book page and look at the bottom. for the download.
Bill
Navi Singh
Ranch Hand

Joined: Jul 24, 2002
Posts: 80
Hi William,
Thanks for the quick response and specially for offering the use of Snoop.
But my problem is a little diff.
True as u mentioned that the error is .
But that does not occur all the time,It's erratic like 30% of the time.
I understand it's difficult to gauge from ur Window,but
could there be a server related resource issue which is creating this "Empty Response"??.
I have three other Applications running simultaneously on the same server.
Thanks,
Navi
[ September 17, 2003: Message edited by: Navi S ]
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
"Navi S",
Unfortunately your display name does not comply with our naming policy so I'll have to ask you to change it.
Thanks.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
That 30% blank is really puzzling
If the rpcrouter is not available you should get an HTML error message.
If the SOAP service has a problem you should get a SOAP error.
It just occurred to me that I'm not sure what you mean by an empty response - do you mean an empty SOAP envelope or what?
Bill
Navi Singh
Ranch Hand

Joined: Jul 24, 2002
Posts: 80
Originally posted by William Brogden:
That 30% blank is really puzzling
If the rpcrouter is not available you should get an HTML error message.
If the SOAP service has a problem you should get a SOAP error.
It just occurred to me that I'm not sure what you mean by an empty response - do you mean an empty SOAP envelope or what?
Bill


Right On William,
I am attaching the error below.
So from ur statement ,it means the rpcrouter is not available when we r having the error.right?? please correct me ..
Abt the Empty response...that was a resource issue,which has been resolved..
have to make sure/confirm whether the inference (rpcrouter unavailable)above is correct or not..
***************
[SOAPException: faultCode=SOAP-ENV rotocol; msg=Unsupported response content type "text/html; charset=iso-8859-1", must be: "text/xml". Response was:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>500 Internal Server Error</TITLE>
</HEAD><BODY>
<H1>Internal Server Error</H1>
The server encountered an internal error or
misconfiguration and was unable to complete
your request.<P>
***************
Appreciate ur responses,
N
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
That 500 error is pretty general, but it looks like the request is never getting to the SOAP servlet.
Surely the server is recording the cause of that error in a log somewhere?
Bill
[ September 19, 2003: Message edited by: William Brogden ]
Navi Singh
Ranch Hand

Joined: Jul 24, 2002
Posts: 80
Hi William,
The problem was with the Websphere resources.Added IBM fix-packs,seems to run Ok Now.
Thanks for assisting,
N
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
So was WebSphere refusing the request because it was out of some resource?
Navi Singh
Ranch Hand

Joined: Jul 24, 2002
Posts: 80
From what i have understood,
The web-sphere wasn't refusing ,
It kept the tcp/ip connection alive/in stack,
which overflowed and hence the Empty-responses.
Thanks,
Navi
Jonathan Ben-Hamou
Greenhorn

Joined: Feb 19, 2004
Posts: 1
Originally posted by Greg Brouelette:
I found the solution (in my case), so I thought I'd share it with the group.
This error really doesn't have anything to do with the content type. It actually means that the rpcrouter servlet isn't accessable. In my case I had to add servlet/rpcrouter to my servlet web path.

Hi,
I know this has been a while since you looked at this.
I am having the same problem.
-----------------------------------------
Would you be kind enough to share how one goes about adding the servlet/rcprouter to the servelt web path?
---------------------------------------------------
Thanks in advance,
Jon
Ranjit Kolli
Greenhorn

Joined: Oct 07, 2004
Posts: 1
I have the same problem. We are using .NET as client Apache just to route the request to WebSphere V5.0.

When a request is sent to Web Services, we get this error sometimes. Not always though.

************************************************************************************
Client found response content type of 'text/html; charset=iso-8859-1', but expected 'text/xml'.
The request failed with the error message:
--
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>500 Internal Server Error</TITLE>
</HEAD><BODY>
<H1>Internal Server Error</H1>
The server encountered an internal error or
misconfiguration and was unable to complete
your request.<P>
Please contact the server administrator,
admin@ubs.com and inform them of the time the error occurred,
and anything you might have done that may have
caused the error.<P>
More information about this error may be available
in the server error log.<P>
<HR>
<ADDRESS>Apache/1.3.27 Server at xstm1906dap.stm.swissbank.com Port 80</ADDRESS>
</BODY></HTML>


This error is not consistent for a particular web service. It comes at random. Our web Services use rpcrouter.

Can someone please help about this.

Thanks
Ranjit
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
Wow from the depths of time (feb 2002) Frankenthread has returned.
I would certainly try to get a look at the contents of the entire SOAP message being sent. The answer may jump right out at you.
I actually wrote a utility to spy on SOAP messages way back for my SOAP book - I suspect there are better ones around now, but if you like you can download it from this page - down at the bottom.
Basically the idea with this sort of utility is that you direct the client connection through the utility which passes it on to the ultimate server destination while keeping a copy of the content sent and received.
Bill
reem hubail
Greenhorn

Joined: Feb 23, 2006
Posts: 5
I know it's been a while

but I'm having this problem and I have to solve it as soon as possible

I'm using soap2.2 with tomcat4.1.31

can anyone plz help me??
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
That error can mean a lot of things. The most popular one is documented in the Apache SOAP FAQ

4.5 Help! I try to run my SOAP client I get this message: "Unsupported response content type "text/html", must be: "text/xml". Response was: HTTP Error 405 - Method Not Allowed".
Check that your client is connecting to port 8080 (i.e. http://localhost:8080/ rather than http://localhost/). You might accidentally be connecting to a web server (e.g. Apache or IIS) instead of your SOAP/Tomcat server.


Other than that sift through similar reports on Google (an refine the search parameter to your particular situation):
http://www.google.com/search?hl=en&lr=&q=Unsupported+response+content+type+%22text%2Fhtml%22%2C+must+be%3A+%22text%2Fxml%22
[ February 23, 2006: Message edited by: Peer Reynders ]
reem hubail
Greenhorn

Joined: Feb 23, 2006
Posts: 5
Originally posted by Peer Reynders:
Check that your client is connecting to port 8080 (i.e. http://localhost:8080/ rather than http://localhost/). You might accidentally be connecting to a web server (e.g. Apache or IIS) instead of your SOAP/Tomcat server.



I'm already connecting to the port 8080 but how can I know if I'm connected to a web server other than my SOAP/TOMCAT server


Thanks
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
Originally posted by reem hubail:
I'm already connecting to the port 8080 but how can I know if I'm connected to a web server other than my SOAP/TOMCAT server
Thanks


Shutdown Tomcat and try again. If you can't connect nothing else is interfering.

However the client might be connecting to Tomcat but not with your SOAP application.
You haven�t given any information about the exact circumstances of your error. In the case of the original post from 4 years ago (Feb 2002) the information returned from the server indicated that the proper connection was made but somehow the rpcrouter servlet failed. You have provided no such information.

So Google is still you best option.
reem hubail
Greenhorn

Joined: Feb 23, 2006
Posts: 5
I've made it on the simulation server
but now I'm trying it on a real MMC but it's telling me another error
the only thing I changed depending on the document I have is the MMC URL and the username and the password of the VAS application

I'm getting : SOAPException SOAP-ENV:faultCode=Client msg=error opening socket; connection refused

Do I have to change anything else in my packges files

Lots of Thanks
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
Originally posted by reem hubail:
the username and the password of the VAS application.

I'm getting : SOAPException SOAP-ENV:faultCode=Client msg=error opening socket; connection refused"


I'd guess that the necessary/valid credentials are not being sent with the SOAP message.
reem hubail
Greenhorn

Joined: Feb 23, 2006
Posts: 5
Thanks for replying

How can I be sure that the username and the password are sent with the soap message ??
Is there a way that I can see the sending soap message or trace it ??

Thanks again
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
Axis comes with a standalone tool tcpmon (it doesn't have to be used with Axis) that could be helpful - though I doubt you could use it on a SSL/TLS connection.

Depending on the type of authentication you are using, your credentials may be carried in the HTTP request - not in the SOAP message - so there would be no point to look at the SOAP message itself. For example, BASIC authentication carries the username and password within the HTTP request.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unsupported response content type "text/html", must be: "text/xml".