Invoking a web service

J

jaango

Hi all,



I have written a code to invoke a webservice as shown below

Option Explicit
' Excel VBA Function wrapper to call add Web Service on the web!
Public Function add(a As Integer, b As Integer) As Single
Dim objSClient As MSSOAPLib30.SoapClient30 ' Remove the 30 if using
an earlier version of SOAP
Dim fResult As Single

' Point the SOAP API to the web service that we want to call...
Set objSClient = New SoapClient30
Call
objSClient.mssoapinit(par_WSDLFile:="http://10.120.135.17:8080/CalcApp/AddNumbersService.wsdl")

' Call the web service
fResult = objSClient.calcExcRate(a, b)
Set objSClient = Nothing

add = fResult
End Function





The wsdl file is updated as below


<? xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <!--

Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is
JAX-WS RI 2.1.3.1-hudson-417-SNAPSHOT.

-->
- < definitions targetNamespace =" http://service.calc.com/ " name ="
AddNumbersService " xmlns:tns =" http://service.calc.com/ " xmlns:xsd ="
http://www.w3.org/2001/XMLSchema " xmlns:soap ="
http://schemas.xmlsoap.org/wsdl/soap/ " xmlns:wsu ="
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd " xmlns =" http://schemas.xmlsoap.org/wsdl/ " >
- < types >
- < xsd:schema >
< xsd:import namespace =" http://service.calc.com/ " schemaLocation ="
AddNumbersService_schema1.xsd " />
</ xsd:schema >
</ types >
- < message name =" add " >
< part name =" parameters " element =" tns:add " />
</ message >
- < message name =" addResponse " >
< part name =" parameters " element =" tns:addResponse " />
</ message >
- < portType name =" AddNumbers " >
- < operation name =" add " >
< input message =" tns:add " />
< output message =" tns:addResponse " />
</ operation >
</ portType >
- < binding name =" AddNumbersPortBinding " type =" tns:AddNumbers " >
< soap:binding transport =" http://schemas.xmlsoap.org/soap/http " style
=" document " />
- < operation name =" add " >
< soap:eek:peration soapAction =" " />
- < input >
< soap:body use =" literal " />
</ input >
- < output >
< soap:body use =" literal " />
</ output >
</ operation >
</ binding >
- < service name =" AddNumbersService " >
- < port name =" AddNumbersPort " binding =" tns:AddNumbersPortBinding " >
< soap:address location ="
http://10.120.135.17:8080/CalcApp/AddNumbersService " />
</ port >
</ service >
</ definitions >



Do I have to add the schema file also while invoking the webservice. I
havent tried this yet. Can you guys please help me out in modifying the code
if any.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top