Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > WSE 2 SP3 error: Client found response content type of '', but expected 'text/xml'.

Reply
Thread Tools

WSE 2 SP3 error: Client found response content type of '', but expected 'text/xml'.

 
 
j.edwards
Guest
Posts: n/a
 
      11-23-2005
Hi,

I've been using WSE 2 SP3 to build a website that has a web service back
end, and asp.net front end. Up till this point I haven't had any problem
deploying, but on one of my client's sites I'm getting this sort of error:

-----------------------------------------
Client found response content type of '', but expected 'text/xml'.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Client found response
content type of '', but expected 'text/xml'.
-----------------------------------------

The stack trace just points to the call of the web service, i.e.
Webservice.GetProject().

This error is triggered on calling a web service - even a simple one that
just returns a string. I've put trace.Write() in to make sure the web
service code was performing correctly which it is. The error is happening
somewhere between the end of the web method code and the result getting
returned to the calling webpage. I can call the web service from the html
interface and it works correctly. I've tested calling the webservice from a
vb.net app instead of asp.net project and it has the same error.

From the web searches I've done it seems that this is a generic error that
is really a front for some other error - i.e. an error message is getting
returned instead of the expected data in xml format. However, I can't debug
because I've only got limited vpn access and the client site is overseas.

The only way I can get everything working correctly is to remove all
references to WSE 2 SP3 - then it all works happily. I'm using impersonate
with integrated security but have tested the correct user credentials with
appropriate permissions is being used - and when WSE was removed the site
worked correctly with the impersonate stuff all being unchanged.

Does anyone have suggestions on what could fix this? Is it a bug with WSE?

-----------------------------------------

I have WSE set up to use a policy document - just so it expects a standard
UsernameToken.

<?xml version="1.0" encoding="utf-8" ?>
<policyDocument xmlns="http://schemas.microsoft.com/wse/2003/06/Policy">
<mappings xmlns:wse="http://schemas.microsoft.com/wse/2003/06/Policy">
<defaultEndpoint>
<defaultOperation>
<request policy="" />
<response policy="" />
<fault policy="" />
</defaultOperation>
</endpoint>
</mappings>
<policies
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:wse="http://schemas.microsoft.com/wse/2003/06/Policy"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"
xmlns:wssp="http://schemas.xmlsoap.org/ws/2002/12/secext"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy"
xmlns:wssc="http://schemas.xmlsoap.org/ws/2004/04/sc"
xmlns:rp="http://schemas.xmlsoap.org/rp">
<wspolicy wsu:Id="signed-body-username">
<wssp:Integrity wsp:Usage="wsp:Required">
<wssp:TokenInfo>
<wssp:SecurityToken>
<wssp:TokenType>http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken</wssp:TokenType>
</wssp:SecurityToken>
</wssp:TokenInfo>
<wssp:MessageParts xmlns:rp="http://schemas.xmlsoap.org/rp"
Dialect="http://schemas.xmlsoap.org/2002/12/wsse#part">wsp:Body()
wse:Timestamp() wse:Addressing()</wssp:MessageParts>
</wssp:Integrity>
</wspolicy>
</policies>
</policyDocument>

-----------------------------------------

Here is my code for calling the web service ...

Public Shared Function GetDataWebservice() As WSProxy.DataWebServiceWse
Dim Result As New WSProxy.DataWebServiceWse

Dim httpContext As HttpContext = httpContext.Current
Dim config As Sage.Web.Config =
CType(httpContext.Items.Item("Config"), Sage.Web.Config)

'specifically state what the web service url will be on
'this is because it's "hardcoded" to be on "localhost" when in
development
'and it provides flexibility to run in various deployment situations
(such as developing from home)
'if this is done...
Dim sRootPath As String =
config.Environments.Active.Properties.Item("RootPa th").ToString()
Result.Url = "http://" + httpContext.Request.Url.Host + sRootPath +
"/Webservice/DataWebservice.asmx"

'extend the webservice timeout so it can cope with longer things
like when community dir item added (which re-indexes full text catalogue on
insert new item)
Result.Timeout = 5 * (60 * 1000) '5 minutes

'get soap context
Dim soapContext As SoapContext = Result.RequestSoapContext
'create token for user login details
Dim iUserID As Integer
Try
'is a connection available to use?
Dim p As BasePage
p = CType(httpContext.Handler, BasePage)
If Not IsNothing(p.Conn) Then
iUserID = config.SessionManager.UserID
Else
iUserID = 0
End If
Catch ex As Exception
iUserID = 0
End Try
Dim t As New UsernameToken(iUserID.ToString(), iUserID.ToString(),
Microsoft.Web.Services2.Security.Tokens.PasswordOp tion.SendNone)
soapContext.Security.Tokens.Add(t)

Result.PreAuthenticate = True
Result.Credentials = System.Net.CredentialCache.DefaultCredentials

Return Result
End Function


 
Reply With Quote
 
 
 
 
Kenny M.
Guest
Posts: n/a
 
      02-13-2006
Wow, My app is located in a hosting company, It have been working very well
for a year and today it is not working any more showing me the same message:

"Client found response content type of... " but My app does not use even the
WSE, so I think this is something that the hosting company made, when I know
anything I'll tell you


--
Kenny M.


"j.edwards" wrote:

> Hi,
>
> I've been using WSE 2 SP3 to build a website that has a web service back
> end, and asp.net front end. Up till this point I haven't had any problem
> deploying, but on one of my client's sites I'm getting this sort of error:
>
> -----------------------------------------
> Client found response content type of '', but expected 'text/xml'.
> Description: An unhandled exception occurred during the execution of the
> current web request. Please review the stack trace for more information
> about the error and where it originated in the code.
>
> Exception Details: System.InvalidOperationException: Client found response
> content type of '', but expected 'text/xml'.
> -----------------------------------------
>
> The stack trace just points to the call of the web service, i.e.
> Webservice.GetProject().
>
> This error is triggered on calling a web service - even a simple one that
> just returns a string. I've put trace.Write() in to make sure the web
> service code was performing correctly which it is. The error is happening
> somewhere between the end of the web method code and the result getting
> returned to the calling webpage. I can call the web service from the html
> interface and it works correctly. I've tested calling the webservice from a
> vb.net app instead of asp.net project and it has the same error.
>
> From the web searches I've done it seems that this is a generic error that
> is really a front for some other error - i.e. an error message is getting
> returned instead of the expected data in xml format. However, I can't debug
> because I've only got limited vpn access and the client site is overseas.
>
> The only way I can get everything working correctly is to remove all
> references to WSE 2 SP3 - then it all works happily. I'm using impersonate
> with integrated security but have tested the correct user credentials with
> appropriate permissions is being used - and when WSE was removed the site
> worked correctly with the impersonate stuff all being unchanged.
>
> Does anyone have suggestions on what could fix this? Is it a bug with WSE?
>
> -----------------------------------------
>
> I have WSE set up to use a policy document - just so it expects a standard
> UsernameToken.
>
> <?xml version="1.0" encoding="utf-8" ?>
> <policyDocument xmlns="http://schemas.microsoft.com/wse/2003/06/Policy">
> <mappings xmlns:wse="http://schemas.microsoft.com/wse/2003/06/Policy">
> <defaultEndpoint>
> <defaultOperation>
> <request policy="" />
> <response policy="" />
> <fault policy="" />
> </defaultOperation>
> </endpoint>
> </mappings>
> <policies
> xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
> xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
> xmlns:wse="http://schemas.microsoft.com/wse/2003/06/Policy"
> xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"
> xmlns:wssp="http://schemas.xmlsoap.org/ws/2002/12/secext"
> xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy"
> xmlns:wssc="http://schemas.xmlsoap.org/ws/2004/04/sc"
> xmlns:rp="http://schemas.xmlsoap.org/rp">
> <wspolicy wsu:Id="signed-body-username">
> <wssp:Integrity wsp:Usage="wsp:Required">
> <wssp:TokenInfo>
> <wssp:SecurityToken>
> <wssp:TokenType>http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken</wssp:TokenType>
> </wssp:SecurityToken>
> </wssp:TokenInfo>
> <wssp:MessageParts xmlns:rp="http://schemas.xmlsoap.org/rp"
> Dialect="http://schemas.xmlsoap.org/2002/12/wsse#part">wsp:Body()
> wse:Timestamp() wse:Addressing()</wssp:MessageParts>
> </wssp:Integrity>
> </wspolicy>
> </policies>
> </policyDocument>
>
> -----------------------------------------
>
> Here is my code for calling the web service ...
>
> Public Shared Function GetDataWebservice() As WSProxy.DataWebServiceWse
> Dim Result As New WSProxy.DataWebServiceWse
>
> Dim httpContext As HttpContext = httpContext.Current
> Dim config As Sage.Web.Config =
> CType(httpContext.Items.Item("Config"), Sage.Web.Config)
>
> 'specifically state what the web service url will be on
> 'this is because it's "hardcoded" to be on "localhost" when in
> development
> 'and it provides flexibility to run in various deployment situations
> (such as developing from home)
> 'if this is done...
> Dim sRootPath As String =
> config.Environments.Active.Properties.Item("RootPa th").ToString()
> Result.Url = "http://" + httpContext.Request.Url.Host + sRootPath +
> "/Webservice/DataWebservice.asmx"
>
> 'extend the webservice timeout so it can cope with longer things
> like when community dir item added (which re-indexes full text catalogue on
> insert new item)
> Result.Timeout = 5 * (60 * 1000) '5 minutes
>
> 'get soap context
> Dim soapContext As SoapContext = Result.RequestSoapContext
> 'create token for user login details
> Dim iUserID As Integer
> Try
> 'is a connection available to use?
> Dim p As BasePage
> p = CType(httpContext.Handler, BasePage)
> If Not IsNothing(p.Conn) Then
> iUserID = config.SessionManager.UserID
> Else
> iUserID = 0
> End If
> Catch ex As Exception
> iUserID = 0
> End Try
> Dim t As New UsernameToken(iUserID.ToString(), iUserID.ToString(),
> Microsoft.Web.Services2.Security.Tokens.PasswordOp tion.SendNone)
> soapContext.Security.Tokens.Add(t)
>
> Result.PreAuthenticate = True
> Result.Credentials = System.Net.CredentialCache.DefaultCredentials
>
> Return Result
> End Function
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml'. Jesús Bosch ASP .Net 1 07-03-2006 02:04 PM
Client found response content type of '', but expected 'text/xml'. Robert Rotstein ASP .Net 0 12-21-2005 01:26 AM
Re: Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml' Damon Payne ASP .Net 0 03-08-2005 02:35 AM
Client found response content type of '', but expected 'text/xml'. with Wse 2.0 powerranger ASP .Net Web Services 0 07-26-2004 02:47 AM
Client found response content type of '', but expected 'text/xml' Vish Ramachandran ASP .Net Web Services 1 05-26-2004 08:09 AM



Advertisments