By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,538 Members | 875 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,538 IT Pros & Developers. It's quick & easy.

Web service that is able to receive a xml "POST" and process it

P: n/a
Jay
Hello all,

I was wondering if someone can point me to a tutorial that show me how
I can set up a web service that can listen for me to send a POST from a
client? like so

Client sends http POST to http://www.mysite.com/processTheRequest. The
data being sent across is XML like so "<request><data>alot of text data
that I will manipulate and save to the sql database</data></request>"
the serverside should have some function to receive this data.

receiveData(object sender, events e)
{
manipulate the data and respond to the post with
"<response>success</response>"
}

Feb 9 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Jay,

That's what a webservice does by default. Just create the webservice method
and have it accept an xml parameter. XML is easily converted to and from a
dataset which is safe for sending in a webservice (data must be
serializable). In .NET 2.0 DataTables are also serializable. So you could do
something like this:

<WebMethod()> _
Public Sub XMLAcceptor(ByVal xmlDataset As Data.DataSet)

End Sub

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Jay" <jd******@gmail.com> wrote in message
news:11*********************@g44g2000cwa.googlegro ups.com...
Hello all,

I was wondering if someone can point me to a tutorial that show me how
I can set up a web service that can listen for me to send a POST from a
client? like so

Client sends http POST to http://www.mysite.com/processTheRequest. The
data being sent across is XML like so "<request><data>alot of text data
that I will manipulate and save to the sql database</data></request>"
the serverside should have some function to receive this data.

receiveData(object sender, events e)
{
manipulate the data and respond to the post with
"<response>success</response>"
}

Feb 9 '06 #2

P: n/a
Jay
what if I wanted to send xmldata as a string (that is formated in xml),
receive this string and do a

xmlDocument.Load(xmldata);
any examples or step by step tutorials?

Feb 9 '06 #3

P: n/a
Jay,

You may certainly send the xml as a string just use ByVal xmlString As
String instead of the dataset.

Then load the string into an xml document like this:

xmldoc.LoadXml(sXML)

After that there are plenty of examples like this (do a google search on
"asp.net xmldoc" to see plenty more):

http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=213

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Jay" <jd******@gmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
what if I wanted to send xmldata as a string (that is formated in xml),
receive this string and do a

xmlDocument.Load(xmldata);
any examples or step by step tutorials?

Feb 9 '06 #4

P: n/a
Jay
so I get to the point where I created a web service and it comes up to
this page when I push play. I can also click on jaytest and it will
take me to an invoke page... but when I try to send a transaction from
another application(that I have sent thousands of WebRequest Post to
our linux jboss server) it does not work.

---
The following operations are supported. For a formal definition, please
review the Service Description.

JayTest

HelloWorld
----------

SERVICE DECRIPTION CONTENT
-----------------------------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
- <wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://www.jaystest.com"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
targetNamespace="http://www.jaystest.com"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
- <wsdl:types>
- <s:schema elementFormDefault="qualified"
targetNamespace="http://www.jaystest.com">
- <s:element name="HelloWorld">
<s:complexType />
</s:element>
- <s:element name="HelloWorldResponse">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="HelloWorldResult"
type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
- <s:element name="JayTest">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="strMyName"
type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
- <s:element name="JayTestResponse">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="JayTestResult"
type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
- <wsdl:message name="HelloWorldSoapIn">
<wsdl:part name="parameters" element="tns:HelloWorld" />
</wsdl:message>
- <wsdl:message name="HelloWorldSoapOut">
<wsdl:part name="parameters" element="tns:HelloWorldResponse" />
</wsdl:message>
- <wsdl:message name="JayTestSoapIn">
<wsdl:part name="parameters" element="tns:JayTest" />
</wsdl:message>
- <wsdl:message name="JayTestSoapOut">
<wsdl:part name="parameters" element="tns:JayTestResponse" />
</wsdl:message>
- <wsdl:portType name="Service1Soap">
- <wsdl:operation name="HelloWorld">
<wsdl:input message="tns:HelloWorldSoapIn" />
<wsdl:output message="tns:HelloWorldSoapOut" />
</wsdl:operation>
- <wsdl:operation name="JayTest">
<wsdl:input message="tns:JayTestSoapIn" />
<wsdl:output message="tns:JayTestSoapOut" />
</wsdl:operation>
</wsdl:portType>
- <wsdl:binding name="Service1Soap" type="tns:Service1Soap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
- <wsdl:operation name="HelloWorld">
<soap:operation soapAction="http://www.jaystest.com/HelloWorld"
style="document" />
- <wsdl:input>
<soap:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
- <wsdl:operation name="JayTest">
<soap:operation soapAction="http://www.jaystest.com/JayTest"
style="document" />
- <wsdl:input>
<soap:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <wsdl:service name="Service1">
<documentation xmlns="http://schemas.xmlsoap.org/wsdl/" />
- <wsdl:port name="Service1Soap" binding="tns:Service1Soap">
<soap:address
location="http://localhost/WebServiceTest/Service1.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
-----------------------------------------------------------

Feb 9 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.