Link to home
Start Free TrialLog in
Avatar of MikeCombe
MikeCombeFlag for United States of America

asked on

How to generate multiple xml nodes in my WebMethod response

I want to generate multiple xml nodes in my WebMethod response.

I don't know how to write the WebMethod() to generate this...
<myResponse>
<Price>34.5</Price>
<DateTime>8/17/2012</DateTime>
<misc1>aaa</misc1>
<misc2>bbb</misc2>
<misc3>ccc</misc3>
</myResponse>


reference my recent SOAP question:
https://www.experts-exchange.com/questions/27832901/How-do-I-write-the-WebMethod-to-generate-the-The-SOAP-response-like-below.html

' Request
<?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:Body>
    <GetStockPrice xmlns="http://www.domaintest.org/">
      <StockName>string</StockName>
    </GetStockPrice>
  </soap:Body>
</soap:Envelope>

' Response
<?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:Body>
    <GetStockPriceResponse xmlns="http://www.domaintest.org/">
      <GetStockPriceResult>
           <myResponse>
                 <Price>string</Price>
                 <DateTime>datetime</DateTime>
                 <misc1>string</misc1>
                 <misc2>string</misc2>
                 <misc3>string</misc3>
         </myResponse>
      </GetStockPriceResult>
    </GetStockPriceResponse>
  </soap:Body>
</soap:Envelope>
ASKER CERTIFIED SOLUTION
Avatar of Rose Babu
Rose Babu
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MikeCombe

ASKER

perfect !
thanks again
A follow up question...

Looking at:
<soap:Body>
    <GetStockPriceResponse xmlns="https://somewherecom/SoapTest/">
      <GetStockPriceResult>
        <Price>string</Price>
        <DateTime>string</DateTime>
        <misc1>string</misc1>
        <misc2>string</misc2>
        <misc3>string</misc3>
      </GetStockPriceResult>
    </GetStockPriceResponse>
  </soap:Body>

How is the node  "<GetStockPriceResult>" set (or created) ?
<GetStockPriceResult> is created by webservice program.
ok....yes. It's generated by the name of the Function:
Public Function GetStockPrice(ByVal StockName As String) As GetStockPriceDetails

which generates
<GetStockPriceResult>

Thanks !