CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2008
    Posts
    11

    Regarding Making a SOAP request

    Hi,

    I need to build a SOAP request from C# to access a web service.

    Following is a sample request that I have to build.

    POST /gwy/test.asmx HTTP/1.1
    Host: test.com
    Content-Type: text/xml; charset=utf-8
    Content-Length: length
    SOAPAction: "http://test.com/gwy/getdata"

    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header>
    <OriginatorHeader xmlns="http://test.com/gwy/">
    <OriginatorId>int</OriginatorId>
    </OriginatorHeader>
    </soap:Header>
    <soap:Body>
    <getdata xmlns="http://test.com/gwy/">
    <Id>int</Id>
    <Name>string</Name>
    </getdata>
    </soap:Body>
    </soap:Envelope>


    Can you please let me know how to write code in C# to build the request for the above format. Appreciate if someone can help me with this.

    Thanks in Advance!

  2. #2
    Join Date
    Jan 2006
    Location
    18° 32' N / 73° 52' E
    Posts
    416

    Re: Regarding Making a SOAP request

    May be you could just get the refrence of the web service you want to access in your project.
    OR,
    Create a proxy class and access the methods of the web service.
    Regards,
    MMH
    Rate my post if you find it usefull.

  3. #3
    Join Date
    Mar 2008
    Location
    IRAN
    Posts
    811

    Re: Regarding Making a SOAP request

    if you want to write code from scratch to access a web services yoy shoud deal with SOAP, WSDL, UDDI, DISCO and XML all by yuorself;so let the visual stadion .net (if you use it) do the hard part for you and save your time then focus on the logic of your program.

    tale a look at this article:
    http://www.codeproject.com/KB/webser...myservice.aspx
    Please rate my post if it was helpful for you.
    Java, C#, C++, PHP, ASP.NET
    SQL Server, MySQL
    DirectX
    MATH
    Touraj Ebrahimi
    [toraj_e] [at] [yahoo] [dot] [com]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured