vb.netweb-servicesvisual-studio-2012soap-clientweb-reference

How to consume a referenced webservice in visual studio 2012


I have added a reference of a soap webservice in my visual studio 2012. Working for the first time with is a little bit hard because it gave an error and I don't know how to resolve it. Any hints? Below is my code:

 Dim obj() As MobileApp.ClaimsDetails
 Dim respClaimsDetails As MobileApp.BAMobileAppSoap
 Dim a As New MobileApp.MVGetClaimsDetailsAllRequest
 a.strVisaID = 123
 Dim b As New MobileApp.MVGetClaimsDetailsAllResponse
 b = respClaimsDetails.MVGetClaimsDetailsAll(a)
 obj = b.MVGetClaimsDetailsAllResult

MobileApp is the name of my webservice. The exception thrown is a null reference in respClaimsDetails.MVGetClaimsDetailsAll(a). I know that MobileApp.BAMobileAppSoap is an interface that needs a Concrete Implementation to complete my work, but I have at least 50 interfaces, I cannot concrete them all... I am sure there is another way to call webservice and resolve this issue ... any help, any links or documentation concerning added webservices in visual studio 2012 are appreciated. Regards.


Solution

  • OK finally I could solve it : Instad of using an interface there a class for client that takes a parameter "BAMobileAppSoap" which is the enpoint name in web.config, and then I could call my methods easily:

    Dim respClaimsDetails As New MobileApp.BAMobileAppSoapClient("BAMobileAppSoap")
    Dim res = respClaimsDetails.MVGetClaimsDetailsAll(claimNum)