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

Discussion in 'ASP .Net' started by Jay, Feb 9, 2006.

  1. Jay

    Jay Guest

    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>"
    }
     
    Jay, Feb 9, 2006
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:...
    > 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>"
    > }
    >
     
    S. Justin Gengo [MCP], Feb 9, 2006
    #2
    1. Advertising

  3. Jay

    Jay Guest

    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?
     
    Jay, Feb 9, 2006
    #3
  4. 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" <> wrote in message
    news:...
    > 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?
    >
     
    S. Justin Gengo [MCP], Feb 9, 2006
    #4
  5. Jay

    Jay Guest

    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:eek:peration name="HelloWorld">
    <wsdl:input message="tns:HelloWorldSoapIn" />
    <wsdl:eek:utput message="tns:HelloWorldSoapOut" />
    </wsdl:eek:peration>
    - <wsdl:eek:peration name="JayTest">
    <wsdl:input message="tns:JayTestSoapIn" />
    <wsdl:eek:utput message="tns:JayTestSoapOut" />
    </wsdl:eek:peration>
    </wsdl:portType>
    - <wsdl:binding name="Service1Soap" type="tns:Service1Soap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
    style="document" />
    - <wsdl:eek:peration name="HelloWorld">
    <soap:eek:peration soapAction="http://www.jaystest.com/HelloWorld"
    style="document" />
    - <wsdl:input>
    <soap:body use="literal" />
    </wsdl:input>
    - <wsdl:eek:utput>
    <soap:body use="literal" />
    </wsdl:eek:utput>
    </wsdl:eek:peration>
    - <wsdl:eek:peration name="JayTest">
    <soap:eek:peration soapAction="http://www.jaystest.com/JayTest"
    style="document" />
    - <wsdl:input>
    <soap:body use="literal" />
    </wsdl:input>
    - <wsdl:eek:utput>
    <soap:body use="literal" />
    </wsdl:eek:utput>
    </wsdl:eek:peration>
    </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>
    -----------------------------------------------------------
     
    Jay, Feb 9, 2006
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Reid Madsen
    Replies:
    8
    Views:
    4,492
    Reid Madsen
    May 16, 2004
  2. Richard A. Wells

    Receive and return bare XML in C#/ASP.NET Web Service

    Richard A. Wells, Dec 12, 2003, in forum: ASP .Net Web Services
    Replies:
    2
    Views:
    1,989
  3. Marja de Vroed

    Receive and process a XML post

    Marja de Vroed, Feb 23, 2006, in forum: ASP General
    Replies:
    3
    Views:
    197
    Marja de Vroed
    Feb 23, 2006
  4. Luis Saffie

    git post-receive service hook gem

    Luis Saffie, Oct 29, 2010, in forum: Ruby
    Replies:
    0
    Views:
    149
    Luis Saffie
    Oct 29, 2010
  5. sed_y
    Replies:
    0
    Views:
    1,036
    sed_y
    Feb 15, 2012
Loading...

Share This Page