Results 1 to 6 of 6

Thread: How do you receive xml web service responses?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Posts
    149

    How do you receive xml web service responses?

    I am quite new to working with web services.

    I just recently created a web service that returns an xml document. All the xml serialization is done by .net, all i really did was create an array of a structure, populate it and return it.

    Now in the app calling the method of the web service, what am I receiving the xml document into.

    proxyWebService = devServer.Services

    unknownVariableType = proxyWebService.GetMeSomeValues

    What is the unknownVariableType?

    I know I could just return a dataset, and have tried that and it does work, I just want to know if I could do it this way as well.

    Thanks again.

  2. #2
    Code Monkey wild_bill's Avatar
    Join Date
    Mar 2005
    Location
    Montana
    Posts
    2,993

    Re: How do you receive xml web service responses?

    In your service you should have this:
    Public Function GetMeSomeValues() as whatever
    You'll have to declare your variable as whatever. Is that what you are wondering?

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Posts
    149

    Re: How do you receive xml web service responses?

    I was actually wondering what would the using app of the webservice have to receive an xml response.

    In my service i do have a function GetMeSomeValues, and it works just fine when the return value is a dataset. But I know that you can also return structures, that will get translated into xml documents.

    I was wondering what the receiving line of code would look like to receive such a document; what the caller of the method would put as a variable to receive the xml response.

    God i hope that made sense. I have a habit of not making things any more clearer.

  4. #4
    Code Monkey wild_bill's Avatar
    Join Date
    Mar 2005
    Location
    Montana
    Posts
    2,993

    Re: How do you receive xml web service responses?

    As you've already got a dataset, all you've got to do is convert it to an xmldoc:
    VB Code:
    1. Public Function GetMeSomeValues() as xml.xmldocument
    2.  Dim xdRtn As New Xml.XmlDocument
    3. dim dsRtn as new dataset
    4. 'populate dataset
    5. xdRtn.LoadXml(dsRtn.GetXml)
    6. return xdRtn
    7. end function

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Posts
    149

    Re: How do you receive xml web service responses?

    Thanks wild_bill, I dont know why that didnt occur to me.

    I was just wondering though:
    Is there a way to convert an array of structures to an xml document? Or maybe how to just receive an array of structures from the calling app? Or should I just stick to the dataset thing?

    public structure person

    dim firstName as string
    dim lastName as string

    end structure

    public sub searchPerson (searchText as string) as person()

    'find all persons that match searchText

    'populate an array of structures

    return person

    end sub

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Posts
    149

    Re: How do you receive xml web service responses?

    Thanks again wild_bill, I figured it out.

    I can return an array of structures from the web service. And to receive it, I didnt realize that in the proxy created when you consume the webservice there is a class created for the return. You simply make an instance of it and return the web service response into that and it works just great.

    I read about it in an article published by one of the 4guysfromrolla.com guys.

    But thanks again for your help.

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