473,387 Members | 1,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

C# Consuming webservice

i'm consuming a Webservice (created in java) in .Net 2003 (in C#)... whenever i invoke the webmethod, i'm getting below error message

"Additional information: Client found response content type of 'text/html;
charset=ISO-8859-1', but expected 'text/xml'."

but when the same webservice is called from SOAPUI (an open source
application from www.soapui.org) or XMLSpy - it just works fine...

so i'm confused about this, any suggestions??

Cheers
Venu
Jan 30 '08 #1
3 3252
Plater
7,872 Expert 4TB
Hmm that java webservices seems a little funny.
the text/html with charset spec I believe fits the standard, that the java rejects it seems incorrect.
Not sure if you can remove/edit the line in your code, but it might be possible to change the contenttype.
How do you call this method?
Jan 30 '08 #2
Hmm that java webservices seems a little funny.
the text/html with charset spec I believe fits the standard, that the java rejects it seems incorrect.
Not sure if you can remove/edit the line in your code, but it might be possible to change the contenttype.
How do you call this method?
In .Net application i have created the Webreference and created the 'Request' and 'Response' object.... below the the code (i have changed Namespace, Request object name to make it easy to understand)

Expand|Select|Wrap|Line Numbers
  1. WebSrvc.MyWebservice_Service objWS = new WebSrvc.MyWebservice_Service();
  2.  
  3. WebSrvc.SubmitRequest objRequestData = new WebSrvc.SubmitRequest();
  4. WebSrvc.submitResponse objResponse = new WebSrvc.submitResponse ();
  5.  
  6. string sRequestXML;
  7.  
  8. //Load the original XML
  9. StreamReader sr = new StreamReader(txtXMLFile.Text.ToString());
  10. sRequestXML = sr.ReadToEnd() ;
  11. sr.Close();
  12.  
  13.  
  14. //remove any 'return' and 'newline' characters
  15. sRequestXML = sRequestXML.Replace ("\r", "");
  16. sRequestXML = sRequestXML.Replace ("\n", "");
  17.  
  18. //Create the request object and fill in the XML data as string
  19. objRequestData.strRequestData = sRequestXML;
  20.  
  21.  
  22. //invoke the webmethod
  23. objResponse = objWS.Function1(objRequestData);
  24.  

Let me know if i'm doing anything wrong...
(project compiles well, but it is a runtime error )

Cheers
Venu
Jan 31 '08 #3
Plater
7,872 Expert 4TB
Part of the HTTP protocol includes using a standard set of headers. In this case the "Content-Type", somewhere, someone is using microsoft's usage which would be the "Content-Type: text/html; charset..." which I believe fits the standards but I guess it wants JUST "Content-Type: text/html"
So, somewhere there has to be the call that goes out over the internet and somewhere it automatically inserts that line. If you can find where that happens (or where it validates that header line) you might be able to edit it.
Jan 31 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: kamig | last post by:
Hi! Scenario: Consuming my webService in a windows application give denied acces! Explanation: I have to say a moveTo fn. which move one file/dir from one drive to another, <authorization>
0
by: plmanikandan | last post by:
I need to develop a application to consume a webservice. For consuming web service i tried a example in Consuming a Web Service in C# in http://www.csharphelp.com.But i am uanble to use that...
5
by: Preben Zacho | last post by:
Anyone that has a link or description that simply as possible shows how to add a web reference to a class library in C# and consuming it? TIA PZ
0
jeffbroodwar
by: jeffbroodwar | last post by:
hi, i need help about consuming webservice created in java with vb6. i've created the webservice in netbeans with sun java server bundle and used MS Soap toolkit 3.0 on the client side. i've...
2
jeffbroodwar
by: jeffbroodwar | last post by:
hi, i need help about consuming webservice created in java with vb6. i've created the webservice in netbeans with sun java server bundle and used MS Soap toolkit 3.0 on the client side. i've...
0
jeffbroodwar
by: jeffbroodwar | last post by:
hi, i need help about consuming webservice created in java with vb6. i've created the webservice in netbeans with sun java server bundle and used MS Soap toolkit 3.0 on the client side. i've...
5
jeffbroodwar
by: jeffbroodwar | last post by:
hi, i need help about consuming webservice created in java with vb6. i've created the webservice in netbeans with sun java server bundle and used MS Soap toolkit 3.0 on the client side. i've...
4
by: Boni | last post by:
I want consuming a webserivce trough a proxy. I use this code. myService s = new myService (); System.Net.WebProxy proxyObject = new System.Net.WebProxy("http://proxyhost:8080"); s.Proxy =...
1
by: Thomas Mueller | last post by:
Hi, I'm currently working on C# code consuming a PHP-webservice (soapserver-class of PHP5). A PHP test-client worked fine and achieved the requested data from the service's server. Using the...
2
by: arnomarga | last post by:
I am trying to consuming a .NET web service from a standard (classic) ASP, but having not so much luck as I dont have much experience about SOAP. Here is the webservice url:...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.