Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Web Services section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 10th, 2004, 03:15 PM
Registered User
 
Join Date: Sep 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Simple HTTP POST .Net web service?

Hello,
  A customer of ours wants us to provide a web service that they can access WITHOUT SOAP. They just want to do an HTTP POST to some URL I provide. They will put the XML in the data of the post. We want to do this in .NET in C#.

  OK, so I figured out how to do it, but it seems very backward. I keep thinking there is a better way. Here is what we did:

1) We have a .NET web service that takes NO parameters.
2) It gets the XML with the following lines:
   String postData = this.Context.Request.Form.ToString();
   sxml = System.Web.HttpUtility.UrlDecode(postData);

3) Then, it uses standard XML tools to extract the data from his XML:
    doc.LoadXml(sxml);
    XmlNodeList nodeLst = doc.GetElementsByTagName("OrderInfo");
    ... etc.
4) Finally, it builds an XML result string (a character string) and returns it with
    return sResult;

Is this the best way to hanlde this? It seems that I'm bypassing all of the cool .NET web service tools by getting it from the Request.Form.Tostring. But I don't see a better way.

Also (an annoyance I'll probably figure out sooner or later) when it comes back to him he is seen > instead of GREATER THAN and < instead of LESS THAN in the XML result string. Which setting is causing that to happen?

Thanks much!
Dave
Reply With Quote
  #2 (permalink)  
Old September 10th, 2004, 04:46 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I can't think of a much better way. Yes, you are passing up all the nifty .NET functionality of web services. I can't imagine why they would be so adament about not using SOAP. The only other option would be to use the querystring, but that would be somewhat limiting.

When you return a "<" in xml as part of the data, it get escaped because if it didn't it would break the validation of a properly formed XML string/document:

<xml>
   <data>If x = 5 and y = 10 then 5 < 10 </data>
</xml>

The "<" implies the beginning of a tag where there really isn't one. So it get escaped:

<xml>
   <data>If x = 5 and y = 10 then 5 &lt; 10 </data>
</xml>

The consumer would have to unescape the string. (Something that wouldn't be necessary if they used SOAP, I think. Certainly not if they did it in .NET.)
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VB.net http post with file Master .NET Framework 1.x 0 November 20th, 2008 09:21 AM
Web Service to accept HTTP-Get jasonfisher .NET Web Services 1 June 9th, 2005 09:31 AM
Consuming web services in asp.net using http post dpk100 .NET Web Services 1 May 4th, 2005 02:03 AM
Call the Java Web Service using HTTP-POST/GET anand_indya J2EE 0 January 17th, 2005 08:23 AM
HTTP Post .Net sjlsysprg1 Pro VB.NET 2002/2003 5 June 26th, 2003 12:20 PM



All times are GMT -4. The time now is 09:11 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.