Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / February 2007

Tip: Looking for answers? Try searching our database.

Client found response content type of '', but expected 'text/xml'

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sidharth - 05 Feb 2007 12:27 GMT
Hello all,

We have web service (v1.1 & WSE 2 sp 3) that is called by a web site.
Everything works fine on dev and uat however on live the following error
message appears:

[InvalidOperationException: Client found response content type of '', but
expected 'text/xml'.
]
 
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall) +1486
  System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters) +217
  MediationWeb.RegistrationSvc.RegistrationSvcWse.Login(LoginRequest
LoginRequest) +48
  MediationWeb._default.btnLogin_Click(Object sender, EventArgs e) +142
  System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
 
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
  System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +18
  System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33

This appears in the event log:

Event Type:    Error
Event Source:    Microsoft WSE 2.0
Event Category:    None
Event ID:    0
Date:        05/02/2007
Time:        12:46:37
User:        N/A
Computer:    computer
Description:
System.NullReferenceException: Object reference not set to an instance of an
object.
  at
Microsoft.Web.Services2.WebServicesExtension.AfterSerializeServer(SoapServerMessage message)


And there is a internal server error 500 in the IIS logs.

The call is quite basic:

Web site:

            RegistrationSvc.LoginRequest LoginRequest = new
RegistrationSvc.LoginRequest();
            LoginRequest.Username = txtUsername.Text;
            LoginRequest.HashedPassword = HashedPassword;

            RegistrationSvc.RegistrationSvcWse RegSvc = new
RegistrationSvc.RegistrationSvcWse();
            RegistrationSvc.LoginResponse LoginResponse = RegSvc.Login(LoginRequest);


Web service:

       [WebMethod]        
       [return: XmlElement("UsernameExistsResponse")]
       public Messages.UsernameExistsResponse UsernameExists(
           [XmlElement("UsernameExistsRequest")]
           Messages.UsernameExistsRequest request)
       {            
            try
            {
                // create response message
                Messages.UsernameExistsResponse response = new
Messages.UsernameExistsResponse();
                response.Username = request.Username;
                // execute sproc

                DataAccess.usp_User_SelectByUsername sp = new
MediationRegistrationSvc.DataAccess.usp_User_SelectByUsername();
                sp.UsernameValue = request.Username;

                using(IDataReader dr = Database.ExecuteReader(sp))
                {
                    response.Exists = dr.Read();          
                    dr.Close();
                }
               
                // return response
                return response;
            }
            catch(Exception exc)
            {
                bool rethrow = ExceptionPolicy.HandleException(exc, "General");
                if (rethrow)
                    throw exc;
                throw new RoiRegistrationException(exc.Message);
            }
       }


The web.config on the web site and web service contains this:

   <webServices>
     <soapExtensionTypes>
       <add type="Microsoft.Web.Services2.WebServicesExtension,
Microsoft.Web.Services2, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" priority="1" group="0" />
     </soapExtensionTypes>
   </webServices>


Any help would be much appreciated.

Thanks

Sidharth
Sidharth - 06 Feb 2007 10:17 GMT
Some more information:

The output trace of the web service has:
 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
   <soap:Header>
     
<wsa:Action>http://schemas.xmlsoap.org/ws/2004/03/addressing/fault</wsa:Action>
     <wsa:MessageID>uuid:3fa10d50-1ded-4eef-9e3e-77491ffa164b</wsa:MessageID>
     <wsa:RelatesTo>uuid:418ac8cb-1610-478a-8b3e-6dba81b34d57</wsa:RelatesTo>
     
<wsa:To>http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous</wsa:To>
     <wsse:Security>
       <wsu:Timestamp
wsu:Id="Timestamp-510709cb-7142-4c1a-b369-5b21aae924a4">
         <wsu:Created>2007-02-06T09:51:38Z</wsu:Created>
         <wsu:Expires>2007-02-06T09:56:38Z</wsu:Expires>
       </wsu:Timestamp>
     </wsse:Security>
   </soap:Header>
 <soap:Body>
   <soap:Fault>
     <faultcode>soap:Server</faultcode>
     <faultstring>Server was unable to process request. --> ?</faultstring>
     <detail />
   </soap:Fault>
 </soap:Body>
</soap:Envelope>

The input trace of the web service:
 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
   <soap:Header>
     <wsa:Action>http://url/Oct2005/Login</wsa:Action>
     <wsa:MessageID>uuid:84b2d93b-4e7d-4953-a43a-0af0492ed945</wsa:MessageID>
     <wsa:ReplyTo>
       
<wsa:Address>http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous</wsa:Address>
     </wsa:ReplyTo>
     <wsa:To>http://url/RegistrationSvc.asmx</wsa:To>
     <wsse:Security>
       <wsu:Timestamp
wsu:Id="Timestamp-4d54874f-d321-4985-a902-65862f33e36a">
         <wsu:Created>2007-02-06T10:10:45Z</wsu:Created>
         <wsu:Expires>2007-02-06T10:15:45Z</wsu:Expires>
       </wsu:Timestamp>
     </wsse:Security>
   </soap:Header>
   <soap:Body>
     <LoginRequest xmlns="http://url/Oct2005">
       <Username>test</Username>
       
<HashedPassword>A94A8FE5CCB19BA61C4C0873D391E987982FBBD3</HashedPassword>
     </LoginRequest>
   </soap:Body>
 </soap:Envelope>

Thanks
Sidharth

> Hello all,
>
[quoted text clipped - 108 lines]
>
> Sidharth
Sidharth - 06 Feb 2007 10:19 GMT
And the inputtrace of the website:

 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
     <NonSoapMessage ContentType="" ResponseStatusCode="ProtocolError" />
   </soap:Body>
 </soap:Envelope>

Thanks
Sidharth

> Hello all,
>
[quoted text clipped - 108 lines]
>
> Sidharth

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.