MikeCombe
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</DateT ime>
<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</StockNa me>
</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</DateTi me>
<misc1>string</misc1>
<misc2>string</misc2>
<misc3>string</misc3>
</myResponse>
</GetStockPriceResult>
</GetStockPriceResponse>
</soap:Body>
</soap:Envelope>
I don't know how to write the WebMethod() to generate this...
<myResponse>
<Price>34.5</Price>
<DateTime>8/17/2012</DateT
<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</StockNa
</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</DateTi
<misc1>string</misc1>
<misc2>string</misc2>
<misc3>string</misc3>
</myResponse>
</GetStockPriceResult>
</GetStockPriceResponse>
</soap:Body>
</soap:Envelope>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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) ?
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.
ASKER
ok....yes. It's generated by the name of the Function:
Public Function GetStockPrice(ByVal StockName As String) As GetStockPriceDetails
which generates
<GetStockPriceResult>
Thanks !
Public Function GetStockPrice(ByVal StockName As String) As GetStockPriceDetails
which generates
<GetStockPriceResult>
Thanks !
ASKER
thanks again