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

Discussion in 'ASP .Net Web Services' started by j.edwards, Nov 23, 2005.

  1. j.edwards

    j.edwards Guest

    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">
    <wsp:policy 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>
    </wsp:policy>
    </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("RootPath").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.PasswordOption.SendNone)
    soapContext.Security.Tokens.Add(t)

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

    Return Result
    End Function
     
    j.edwards, Nov 23, 2005
    #1
    1. Advertising

  2. j.edwards

    Kenny M. Guest

    RE: WSE 2 SP3 error: Client found response content type of '', but ex

    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">
    > <wsp:policy 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>
    > </wsp:policy>
    > </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("RootPath").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.PasswordOption.SendNone)
    > soapContext.Security.Tokens.Add(t)
    >
    > Result.PreAuthenticate = True
    > Result.Credentials = System.Net.CredentialCache.DefaultCredentials
    >
    > Return Result
    > End Function
    >
    >
    >
     
    Kenny M., Feb 13, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Damon Payne
    Replies:
    0
    Views:
    9,183
    Damon Payne
    Mar 8, 2005
  2. Jesús Bosch
    Replies:
    1
    Views:
    13,085
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Jul 3, 2006
  3. powerranger
    Replies:
    0
    Views:
    142
    powerranger
    Jul 26, 2004
  4. Søren M. Olesen
    Replies:
    4
    Views:
    545
    Dan Rogers
    Feb 15, 2005
  5. Replies:
    0
    Views:
    311
Loading...

Share This Page