Basic problem with WebService POST

J

Jon Maz

Hi All,

I'm at the "Hello World" stage of learning about web services (just to warn
you), and have what is I think a simple question.

I have created a basic HelloWorld.asmx, which has the following Web Method:

[WebMethod]
public string HelloWorldDemo(string stuff)
{
return "Hello World " + stuff;
}


I have added the following to web.config:

<webServices>
<protocols>
<add name="HttpSoap" />
<add name="HttpGet" />
<add name="HttpPost" />
</protocols>
</webServices>

So far, I have got this to work using GET:

http://localhost/ExampleWebService/HelloWorld.asmx/HelloWorldDemo?stuff=test
returns:
<?xml version="1.0" encoding="utf-8" ?>
<string xmlns="http://tempuri.org/">Hello World test</string>

but I have a problem with POST. If I POST key:stuff value:test to
http://localhost/ExampleWebService/HelloWorld.asmx/HelloWorldDemo,

the only response I get back is:
<!-- Thu May 26 14:12:19 UTC+0100 2005 -->

HOWEVER exactly the same post DOES work if I POST to the following url (note
the?wdsl appended to the end)
http://localhost/ExampleWebService/HelloWorld.asmx/HelloWorldDemo?wdsl

<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/">Hello World test</string>

The only difference I can see is in the Returned Headers:

http://localhost/ExampleWebService/HelloWorld.asmx/HelloWorldDemo
gives
Content-Type: text/xml; charset=utf-8

whereas

http://localhost/ExampleWebService/HelloWorld.asmx/HelloWorldDemo?wdsl
gives
Content-Type: text/html

Can anyone help tell me what's going on? As far as I know I should
*not* have to put "?wdsl" in the url to get a POST to work...

TIA,

JON
 
G

Guest

Jon - ever learn any more about this issue? Facing the same thing when I
move my web services from local XP pro IIS to Server 2003 IIS.
Thanks.
Bob
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top