I developed a small stand alone webserver in Delphi. The procedure is as below:
function sum(a,b:string):string;stdcall;
begin
result:=a+b;
end;
How can I call it in Vue JS?
The web service URL is
http://127.0.0.1:8080/soap/iservice1
the WSDL document:
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" name="Iservice1service"
targetNamespace="http://tempuri.org/">
<script/>
<message name="sum0Request">
<part name="a" type="xs:string"/>
<part name="b" type="xs:string"/>
</message>
<message name="sum0Response">
<part name="return" type="xs:string"/>
</message>
<portType name="Iservice1">
<operation name="sum">
<input message="tns:sum0Request"/>
<output message="tns:sum0Response"/>
</operation>
</portType>
<binding name="Iservice1binding" type="tns:Iservice1">
<binding xmlns="http://schemas.xmlsoap.org/wsdl/soap/" style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="sum">
<operation xmlns="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="urn:service1Intf-Iservice1#sum"
style="rpc"/>
<input>
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:service1Intf-Iservice1"/>
</input>
<output>
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:service1Intf-Iservice1"/>
</output>
</operation>
</binding>
<service name="Iservice1service">
<port name="Iservice1Port" binding="tns:Iservice1binding">
<address xmlns="http://schemas.xmlsoap.org/wsdl/soap/" location="http://localhost:8080/soap/Iservice1"/>
</port>
</service>
</definitions>
The vue codes:
axios({
method: 'post',
url: webservice_url,
data: data_to_send
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
Now can you tell me what is the url (in vue code) please?
The HTTP endpoint for the SOAP service is
Here is how a SOAP request to invoke the "sum" operation on this service might look:
Note that the operation is not part of the URL, but passed in the SOAPAction header of the HTTP request.
Examples for Vue.js can be found here
So the steps to invoke the sum operation using axios would be:
define constants for URL, request body, and request headers (Content-Type and SOAPAction)
invoke axios:
axios({ url: url, method: 'POST', data: soapRequestBody, headers: headers, }) .then((response) => { this.response = response; console.log('Response', response); }) .catch((error) => { console.log('Error', error); });