PDA

View Full Version : VBA to generate Request Response XML from WSDL (Webservice)



avtarxing
11-27-2012, 03:09 AM
I am preparing an excel macro that picks the values from excel columns and generates a request xml which is fired to a Webservice (WSDL).

The Request XML as of now is prepared by concatenation method. The structure of the request xml is hard coded and the values from the cells is concatenated in between the xml tags.


:banghead: :banghead: :banghead:
I am looking for the code to generate the request/response structure by analyzing the WSDL file so that this macro can be used for any webservice and hence be more generic in use.
Present Macro piece of code:

clubTypeHolder = ThisWorkbook.Sheets("testPricing").Cells(rowcount, 11).Value

requestXML = "<soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/ (http://schemas.xmlsoap.org/soap/envelope/)"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema (http://www.w3.org/2001/XMLSchema)"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance (http://www.w3.org/2001/XMLSchema-instance)"">"
...........................................................
...........................................................
requestXML = requestXML + " <clubType>" & clubTypeHolder & "</clubType>"
...........................................................
...........................................................

Here the tags such as Club type is hard coded, but it is not necessary that all webservices would have the same request xml structure. So the macro has to generate the request xml structure itself if the WSDL is provided. :banghead: :banghead: :banghead:

Thanks in Advance.

Avtar