Consider the following approach:
- Put a Script Editor Webpart to your page, below or above the fields
- Create a script element and put there a script, that would perform the following:
- get values of First name and Last name fields
- perform the web service call
- display the results
Get field values
I assume you're using OOTB list form, so in this case field values can be acquired via CSR.
Go to your form page, open developer console (F12->Console tab in IE), and execute the following code:
You will see something like this:
In my case it is "WebPartWPQ2". You need "WPQ2" part of this string. Now you can get the CSR context object for this webpart.
var csrContext = window["WPQ2FormCtx"];
Having the context, it is very simple to get the field values:
var firstName = window["WPQ2FormCtx"].ListData["FirstName"];
var lastName = window["WPQ2FormCtx"].ListData["Title"]; // this is Last name for OOTB Contacts list
Note: Please use internal names of your fields. E.g. it might be
First_x0020_Name, because if you create fields manually, spaces are transformed into
_x0020_. The example above is for the OOTB Contacts list.
Web Service Call
Now, you have First name and Last name values. How do you perform soap request and get the results?
I recommend leveraging an opensource library for that purpose. There are plenty of those. For example:
Or if you don't want to meddle with libraries, then have a look at this SO answer, that provides example code for accessing SOAP web service from JS.
If you're content with having your data below or above the list form, then you can simply add something like
<div id="mydiv"></div> into the Script Editor WebPart, and then
$get('mydiv').innerHTML = '... html here, based on received results ...'; will do the trick.
If you need to put the data you receive from the Web Service inside the form rather than below or above, you then might want to read the following CodeProject article, explaining in detail how that can be done using CSR (see section "Example: manipulating form layout"):