Modifying the soap body for web services.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Elixir
    New Member
    • Apr 2010
    • 1

    #1

    Modifying the soap body for web services.

    Hello, I'm having a bit of trouble with a .NET webservice. I'm creating a webmethod called getItems which will accept and return the following data in a soap envelope from sql server. I'm just curious as to how to force the web service to return the soap data in the format following, currently the data is formatted differently. The methods and their functions will now be explained:

    The getItems webmethod will return all publications added or edited between two dates. This must only return publications data.

    4.1.1 Request
    The proposed request method would have the following input parameters:
    • Fromdate – UTC date format
    • todate – UTC date format
    • filter – publications
    4.1.2 Response
    The response would return the following in XML format for each publication wrapped in a <document> tag:

    • Uniqueid – id from publications table
    • title - publicationTitl e
    • date – last edited date
    • url – url for pdf
    • area - Area of Expertise
    • country – region
    • pubdate - publishedDate
    • type - ???

    The soap document should contain the following in the soap response body:
    <document>
    <uniqueID>123 5</uniqueID>
    <title>Anothe r Publication</title>
    <date>946513000 </date>
    <url>http://www.sjberwin.co m/clientpublicati ons/a1235.pdf</url>
    <area>Real Estate</area>
    <country>France </country>
    <pubdate>946514 000</pubdate>
    <type>Letter</type>
    </document>

    Any help would be much appreciated. Thank you.
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    Straight out of a textbook....

    Bytes has a policy regarding assisting students with their homework.

    The short version is that the volunteers here can't help you with schoolwork.
    A) We don't know what material you have and have not learned in class.
    B) We don't know the guidelines you must follow.
    C) In the long run giving you the answers actually short changes your education.

    Hint 1: Try hitting Google with terms of your programming language and primary terms of what you want to do. For example "C# custom events" or "VB datagrid Excel". I've found this to be a very effective tool.
    Hint 2: Your text book
    Hint 3: Your instructor
    Hint 4: Posting guidelines regarding homework assignments.

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      Elixir,

      Please research your problem before posting your question.
      A great place start your research is the MSDN library. This library is a bunch of articles and documentation provided by Microsoft about anything to do with .NET development. I recommend that you bookmark the resource for your future reference.

      In the MSDN library there are a lot of articles about Web Services.

      When you first start learning about Web Services you have to understand that they use SOAP for transferring data from the client to the server (unless you're using a RESTful Web Service, but I don't want to confuse you so I'll just leave this topic alone). SOAP is just a fancy XML document. Normally we (as humans) don't want to be writing SOAP/XML documents because it's pretty boring stuff that can be very time consuming to do...So we have created classes that will create the SOAP/XML for us. These classes use the Document Type Definition (DTD) to generate valid SOAP/XML responses.

      In other words, you do not have to force the web service to return a SOAP response in any format other than the one that the web service returns. If you start messing with this it's very likely that your SOAP is going to be invalid.

      Just learn the concepts of XML, SOAP and DTDs so that you know what's involved with transferring information between the web service and the client and then don't mess with it. (Until you need to secure it).

      -Frinny

      Comment

      Working...