tags:

views:

94

answers:

3

I'm using WCF to call a method on a Java web service (using basicHttp with <security mode="Transport">). The service returns some HTML back instead of a SOAPFault. WCF seems to implement some odd truncating of the content returned in the exception, so I can't see the entire error.

Is there a way to get the entire response? Perhaps some configuration I can change to pull back more then 660 bytes? I tried turning on service tracing, but it doesn't seem to capture the entire response. I'm unable to use Fiddler or Charles, because the service is using two-way SSL and it's on a secure network. Here's the exception:

The content type text/html of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 660 bytes of the response were: '<html><head><title>Server - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </he

A: 

It seems that an exception occurred on the server side. When exception occurs with httpBinding, HTTP status becomes 404 - NotFound.

It might be as a result of:

  1. Incorrect signature of calling method and actual method, or order of parameters

  2. Failure to serialize or deserialize the result

  3. Some failure with SSL configuration/keys
  4. Internal exception within WCF

In order to eliminate all the above try connecting to it using plain .NET client without SSL. Then add a level of complexity each time.

Hope this helped

Boris Modylevsky
A: 

Have you set IncludeExceptionDetailInFaults = True in ServiceDebugBehavior? That might help.

Peladao
I'm not hosting a WCF Service... just using WCF has the client to connect to a Java Service.
Langdon
I see. But why not just try to solve the problem by using the correct binding as the exception suggests, instead of trying to get the rest of the response?
Peladao
Just because before you know how to set correct binding you have to know what mistake you did in current configuration. Such information can be in that resposne.
Ladislav Mrnka
Seems to me that in this particular case the relevant information is already at the start of the response.
Peladao
A: 

You can try to capture outgoing SOAP request and send that request through HttpWebRequest class. This should allow you capturing whole response.

Best regards, Ladislav

Ladislav Mrnka