You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@xml.apache.org by Galen Kim Davis <ga...@kinecta.com> on 2001/02/21 00:14:30 UTC

Error with content type

While trying to upgrade to Apache-Soap 2.1, I keep encountering the following error when trying to deploy the RPC router.  Any help would be greatly appreciated.

org.apache.soap.server.ServiceManagerClient http://localhost:8100/xml-soap/servlet/rpcrouter  deploy ..\soapserver\Excha
ngeSoapDeployment.xml
Exception in thread "main" [SOAPException: faultCode=SOAP-ENV:Protocol; msg=Unsupported response content type "text/html
", must be: "text/xml". Response was:
<head><title>JRun Servlet Error</title></head><h1>400 Bad Request</h1><body>
Content type must be: 'text/xml'.</body>
]
        at org.apache.soap.rpc.Call.getEnvelopeString(Call.java:173)
        at org.apache.soap.rpc.Call.invoke(Call.java:210)
        at org.apache.soap.server.ServiceManagerClient.invokeMethod(ServiceManagerClient.java:127)
        at org.apache.soap.server.ServiceManagerClient.deploy(ServiceManagerClient.java:140)
        at org.apache.soap.server.ServiceManagerClient.main(ServiceManagerClient.java:228)

We can't find anywhere where the content type is being set.  Is there a default we can override somewhere?

regards,

galen davis

Re: Error with content type

Posted by Rainer Faller <ra...@innovations.de>.
I received the same errormessage. I think I know the problem, but no solution. It might help you a step further.

I hope somebody can explain how to fix this and explain what is going on in the SOAP 2.1 API.

- I use Tomcat 3.2.1 and Soap 2.1

- I use the following commandline call to list all the deployed services.
    java org.apache.soap.server.ServiceManagerClient http://localhost:6060/soap/servlet/rpcrouter list
- This invokes the SOAP Message below (see [1])
- My errormessage is similar/the same (I used the TCP Tunnel/Monitor included with the SOAP API to check)

The problem is the call does not receive the servlet, but is already rejected by the webservice before. So the webservice answers this call with "HTTP/1.0 400 Bad
Request" (see [3]). Because you get an error 400 from the webservice, the webservice answers your request as Type "text/html", not SOAP answers. I looked at how this
"list"-call is invoked with SOAP 2.0, and I found the difference is the HTTP-Header:
SOAP 2.0 uses: Content-Type: text/xml
SOAP 2.1 uses: Content-Type: text/xml; charset=utf-8

My TestClient now opens a socket an sends the SOAP Message itself directly with the "second Content-Type" (see [2]), it works. The SOAP call in [2] seems to have a
proper HTTP Header and I get a proper response from the servlet.

I guess the problem is only the header, but why does SOAP 2.1 API produce a false header? Or am I missing something (I don't know much about HTTP Protocols)?

Hope this helps a little bit. But I still don't get a solution.

Rainer

------------------------
[1]:
POST /soap/servlet/rpcrouter HTTP/1.0
Host: localhost:6060
Content-Type: text/xml; charset=utf-8
Content-Length: 418
SOAPAction: ""

<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
lns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body>
<ns1:list xmlns:ns1="urn:xml-soap-service-management-service" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
</ns1:list>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
------------------------
[2]
POST /soap/servlet/rpcrouter HTTP/1.0
Host: localhost:6060
Content-Type: text/xml
Content-length: 729
SOAPAction: ""

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body>
<ns1:list xmlns:ns1="urn:xml-soap-service-management-service" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
</ns1:list>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
------------------------
[3]
HTTP/1.0 400 Bad Request
Content-Type: text/html
Set-Cookie2: JSESSIONID=c27mji1e61;Version=1;Discard;Path="/soap"
Set-Cookie: JSESSIONID=c27mji1e61;Path=/soap
Servlet-Engine: Tomcat Web Server/3.2.1 (JSP 1.1; Servlet 2.2; Java 1.3.0; Windows NT 4.0 x86; java.vendor=Sun Microsystems Inc.)

<head><title>Error: 400</title></head>
<h1>Error: 400</h1>
<h2>Location: /soap/servlet/rpcrouter</h2><b>Content type must be: 'text/xml'.</b><br></body>
------------------------


Galen Kim Davis schrieb:

> While trying to upgrade to Apache-Soap 2.1, I keep encountering the following error when trying to deploy the RPC router.  Any help would be greatly appreciated.
>
> org.apache.soap.server.ServiceManagerClient http://localhost:8100/xml-soap/servlet/rpcrouter  deploy ..\soapserver\Excha
> ngeSoapDeployment.xml
> Exception in thread "main" [SOAPException: faultCode=SOAP-ENV:Protocol; msg=Unsupported response content type "text/html
> ", must be: "text/xml". Response was:
> <head><title>JRun Servlet Error</title></head><h1>400 Bad Request</h1><body>
> Content type must be: 'text/xml'.</body>
> ]
>         at org.apache.soap.rpc.Call.getEnvelopeString(Call.java:173)
>         at org.apache.soap.rpc.Call.invoke(Call.java:210)
>         at org.apache.soap.server.ServiceManagerClient.invokeMethod(ServiceManagerClient.java:127)
>         at org.apache.soap.server.ServiceManagerClient.deploy(ServiceManagerClient.java:140)
>         at org.apache.soap.server.ServiceManagerClient.main(ServiceManagerClient.java:228)
>
> We can't find anywhere where the content type is being set.  Is there a default we can override somewhere?
>
> regards,
>
> galen davis

Re: Error with content type

Posted by Rainer Faller <ra...@innovations.de>.
I received the same errormessage. I think I know the problem, but no solution. It might help you a step further.

I hope somebody can explain how to fix this and explain what is going on in the SOAP 2.1 API.

- I use Tomcat 3.2.1 and Soap 2.1

- I use the following commandline call to list all the deployed services.
    java org.apache.soap.server.ServiceManagerClient http://localhost:6060/soap/servlet/rpcrouter list
- This invokes the SOAP Message below (see [1])
- My errormessage is similar/the same (I used the TCP Tunnel/Monitor included with the SOAP API to check)

The problem is the call does not receive the servlet, but is already rejected by the webservice before. So the webservice answers this call with "HTTP/1.0 400 Bad
Request" (see [3]). Because you get an error 400 from the webservice, the webservice answers your request as Type "text/html", not SOAP answers. I looked at how this
"list"-call is invoked with SOAP 2.0, and I found the difference is the HTTP-Header:
SOAP 2.0 uses: Content-Type: text/xml
SOAP 2.1 uses: Content-Type: text/xml; charset=utf-8

My TestClient now opens a socket an sends the SOAP Message itself directly with the "second Content-Type" (see [2]), it works. The SOAP call in [2] seems to have a
proper HTTP Header and I get a proper response from the servlet.

I guess the problem is only the header, but why does SOAP 2.1 API produce a false header? Or am I missing something (I don't know much about HTTP Protocols)?

Hope this helps a little bit. But I still don't get a solution.

Rainer

------------------------
[1]:
POST /soap/servlet/rpcrouter HTTP/1.0
Host: localhost:6060
Content-Type: text/xml; charset=utf-8
Content-Length: 418
SOAPAction: ""

<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
lns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body>
<ns1:list xmlns:ns1="urn:xml-soap-service-management-service" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
</ns1:list>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
------------------------
[2]
POST /soap/servlet/rpcrouter HTTP/1.0
Host: localhost:6060
Content-Type: text/xml
Content-length: 729
SOAPAction: ""

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body>
<ns1:list xmlns:ns1="urn:xml-soap-service-management-service" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
</ns1:list>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
------------------------
[3]
HTTP/1.0 400 Bad Request
Content-Type: text/html
Set-Cookie2: JSESSIONID=c27mji1e61;Version=1;Discard;Path="/soap"
Set-Cookie: JSESSIONID=c27mji1e61;Path=/soap
Servlet-Engine: Tomcat Web Server/3.2.1 (JSP 1.1; Servlet 2.2; Java 1.3.0; Windows NT 4.0 x86; java.vendor=Sun Microsystems Inc.)

<head><title>Error: 400</title></head>
<h1>Error: 400</h1>
<h2>Location: /soap/servlet/rpcrouter</h2><b>Content type must be: 'text/xml'.</b><br></body>
------------------------


Galen Kim Davis schrieb:

> While trying to upgrade to Apache-Soap 2.1, I keep encountering the following error when trying to deploy the RPC router.  Any help would be greatly appreciated.
>
> org.apache.soap.server.ServiceManagerClient http://localhost:8100/xml-soap/servlet/rpcrouter  deploy ..\soapserver\Excha
> ngeSoapDeployment.xml
> Exception in thread "main" [SOAPException: faultCode=SOAP-ENV:Protocol; msg=Unsupported response content type "text/html
> ", must be: "text/xml". Response was:
> <head><title>JRun Servlet Error</title></head><h1>400 Bad Request</h1><body>
> Content type must be: 'text/xml'.</body>
> ]
>         at org.apache.soap.rpc.Call.getEnvelopeString(Call.java:173)
>         at org.apache.soap.rpc.Call.invoke(Call.java:210)
>         at org.apache.soap.server.ServiceManagerClient.invokeMethod(ServiceManagerClient.java:127)
>         at org.apache.soap.server.ServiceManagerClient.deploy(ServiceManagerClient.java:140)
>         at org.apache.soap.server.ServiceManagerClient.main(ServiceManagerClient.java:228)
>
> We can't find anywhere where the content type is being set.  Is there a default we can override somewhere?
>
> regards,
>
> galen davis