+ Reply to Thread
Results 1 to 21 of 21

Invoke a SOAP Web Service from Excel VBA

  1. #1
    Registered User
    Join Date
    08-31-2017
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    19

    Invoke a SOAP Web Service from Excel VBA

    Hi,

    I am trying to call a SOAP Webservice from Excel VBA.

    I have a dummy service to just add 2 Integers that I found from the Internet.

    Can anyone help me with the code?

    http://www.dneonline.com/calculator.asmx?op=Add

  2. #2
    Registered User
    Join Date
    08-31-2017
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    19

    Re: Invoke a SOAP Web Service from Excel VBA

    Any help??

  3. #3
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Invoke a SOAP Web Service from Excel VBA

    You just post the xml to the required url, it requires quite a bit of VBA coding though. Is this something you want to know how to do out of curiosity or are you trying to call a SOAP service that's not the one you've linked to? The reason I ask is that whilst the principles are similar, you won't be able to easily adapt sample code to your actual requirements without a good knowledge of VBA

  4. #4
    Registered User
    Join Date
    08-31-2017
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    19

    Re: Invoke a SOAP Web Service from Excel VBA

    Hi,

    I actually use a code which I got from Excel Forum which I think was posted by you.

    I have changed a bit of it to suit my requirements.

    However, this is a Restful Service. When I try using the same for a SOAP Service it does not work.

    Please Login or Register  to view this content.

  5. #5
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Invoke a SOAP Web Service from Excel VBA

    Did you even read my answer?

  6. #6
    Registered User
    Join Date
    08-31-2017
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    19

    Re: Invoke a SOAP Web Service from Excel VBA

    Hi Kyle,

    Yes I did. Actually I have decent knowledge of VBA and If you help me out with a VBA Code for the service I have linked to, I will be able to find my way for my actual service.

    Thanks

  7. #7
    Registered User
    Join Date
    08-31-2017
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    19

    Re: Invoke a SOAP Web Service from Excel VBA

    Hi Sir,

    I have given it a try, but I am stuck up..

    The code does generate a response, but something wierd..

    Any inputs will be appreciated.

    It is blocking me when I post the code, so attaching a screenshot
    Attached Images Attached Images
    Last edited by DD646; 09-08-2017 at 03:04 AM.

  8. #8
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Invoke a SOAP Web Service from Excel VBA

    Working example, you probably don't want to use string building/parsing for anything more indepth:

    https://pastebin.com/raw/1D80cuZj

  9. #9
    Registered User
    Join Date
    08-31-2017
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    19

    Re: Invoke a SOAP Web Service from Excel VBA

    Thank You so much Kyle..

    Works as desired.


  10. #10
    Registered User
    Join Date
    08-31-2017
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    19

    Re: Invoke a SOAP Web Service from Excel VBA

    I just had 1 query if you could help me clarify.

    You kept the SOAP Envelope as it is on the Webservice, but just changed the soap to soap12. Can you tell me why was that?

    Thank You

  11. #11
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Invoke a SOAP Web Service from Excel VBA

    I used SOAP 1.2 it's the second method on the page you linked to

  12. #12
    Forum Expert Doc.AElstein's Avatar
    Join Date
    05-23-2014
    Location
    '_- Germany >Outside Building things.... Mostly
    MS-Off Ver
    Office 2003 2007 2010 PC but Not mac. XP and Vista mostly, sometimes Win 7
    Posts
    3,618

    Invoke a SOAP? - .. well.. do it with a < first and Sucuri pukes up :)

    @ DD646, and Kyle
    Regarding the Sucuri Website Firewall blocking… see this Thread, - https://www.excelforum.com/suggestio...ml#post4736073 – your problem is probably things like

    <soap
    <intA

    Etc…..

    Unfortunately Sucuri Website Firewall blocks things like that.

    Work arounds to get it to post are discussed in that above thread. ( I used the “black character trick” to get them to post here)

    Alan
    Last edited by Doc.AElstein; 09-11-2017 at 02:53 AM.
    '_- Google first, like this _ site:ExcelForum.com Gamut
    Use Code Tags: Highlight code; click on the # icon above,
    Post screenshots COPYABLE to a Spredsheet; NOT IMAGES PLEASE
    http://www.excelforum.com/the-water-...ml#post4109080
    https://app.box.com/s/gjpa8mk8ko4vkwcke3ig2w8z2wkfvrtv
    http://excelmatters.com/excel-forums/ ( Scrolll down to bottom )

  13. #13
    Registered User
    Join Date
    08-31-2017
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    19

    Re: Invoke a SOAP Web Service from Excel VBA

    @Doc.AElstein

    Thank you very much for the clarification

  14. #14
    Forum Expert Doc.AElstein's Avatar
    Join Date
    05-23-2014
    Location
    '_- Germany >Outside Building things.... Mostly
    MS-Off Ver
    Office 2003 2007 2010 PC but Not mac. XP and Vista mostly, sometimes Win 7
    Posts
    3,618

    Re: Invoke a SOAP Web Service from Excel VBA

    You is welcome,

    <Thanks <for <the <feed <back
    '_- posted using black character trick on <Thanks , <feed , and <back as
    <Th[COLOR="#000000"]an[/COLOR]ks <for <the <f[COLOR=black]e[/COLOR]ed <bac[COLOR="#000000"]k[/COLOR]

    Or
    '_- just use the space character trick on all words like
    <T hanks <for <the < feed < back
    (Note all those words use the space trick , even the <for and <the which have the 4th character as a space character. ( The first 4 characters after the < need to be considered ) )

    Alan
    Last edited by Doc.AElstein; 09-11-2017 at 03:04 AM.

  15. #15
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Invoke a SOAP Web Service from Excel VBA

    Or you could just stick it in paste bin

  16. #16
    Registered User
    Join Date
    08-31-2017
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    19

    Re: Invoke a SOAP Web Service from Excel VBA

    Hi Kyle,

    With your help, I was successfully able to call a few different trial services.

    However, this 1 service where I am having issues with parsing the data.

    Here is my code which generates a response sucessfully

    https://pastebin.com/raw/dQ051PLL

    Here is the webservice link -

    http://www.webservicex.net/globalwea...itiesByCountry

    Can you help me a bit with Parsing the response?

    Cheers

  17. #17
    Registered User
    Join Date
    02-01-2020
    Location
    Bangalore
    MS-Off Ver
    365
    Posts
    5

    Re: Invoke a SOAP Web Service from Excel VBA

    I am trying the same with a wsdl that has the following structure , when i use the same code snippet, I get the error"no SOAPAction header". I suspect it has something to do with setting a header as given in code snippet.
    This is the Code line being used. The variable L_XML has the xml as a string obtained from a file.
    Please Login or Register  to view this content.

  18. #18
    Registered User
    Join Date
    02-01-2020
    Location
    Bangalore
    MS-Off Ver
    365
    Posts
    5

    Re: Invoke a SOAP Web Service from Excel VBA

    This is my SOAP request xml
    Please Login or Register  to view this content.

  19. #19
    Registered User
    Join Date
    02-01-2020
    Location
    Bangalore
    MS-Off Ver
    365
    Posts
    5

    Re: Invoke a SOAP Web Service from Excel VBA

    This is the response xml
    Please Login or Register  to view this content.

  20. #20
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: Invoke a SOAP Web Service from Excel VBA

    Quote Originally Posted by arunac View Post
    I am trying the same with a wsdl that has the following structure , when i use the same code snippet, I get the error"no SOAPAction header". I suspect it has something to do with setting a header as given in code snippet.
    This is the Code line being used. The variable L_XML has the xml as a string obtained from a file....
    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  21. #21
    Registered User
    Join Date
    02-01-2020
    Location
    Bangalore
    MS-Off Ver
    365
    Posts
    5

    Re: Invoke a SOAP Web Service from Excel VBA

    Sure Ford. Thanks.I will create a new thread for my query. I am not able to delete my posts here though

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Excel QueryInterface, and Invoke
    By neu_stone in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-13-2015, 03:01 PM
  2. Excel VBA to invoke a Web Service
    By Vinod Krishna.C in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-24-2014, 06:14 AM
  3. excel to SOAP request and back
    By k1ng in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-21-2011, 06:59 AM
  4. Invoke a VB User form through a cell value in Excel
    By cr_ashok in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-19-2009, 06:47 AM
  5. Invoke Java from Excel
    By Todd in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-05-2006, 11:20 PM
  6. How do I invoke a MS access form from an Excel Macro
    By Jim Gabriel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-18-2005, 08:57 PM
  7. [SOLVED] Can I invoke excel automatically from .bat or other means so that.
    By rmkbrj in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 01-23-2005, 01:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1