We successfully created Web Service record in previous post and in this post we will do the following:
- Create a button on Contact Form Applet with caption as “Lookup” and method name as “LookupCountry”.
- Create two new fields “IP Address” and “IP Country” on Contact BC
- Expose these two fields on Contact Form Applet
- When we click on Lookup button and there is a valid IP Address in “IP Address” Field it will invoke the GeoIPService’s GetGeoIP method and fetch the country related to that IP and store it in “IP Country” Field.
I am not going to provide configuration steps for creating button and two fields. I assume that you have already created them. Now we will jump on to the invocation part of Web Service.
Create Named Method N (N is a unique number) user property with following value:
“LookupCountry”, “INVOKESVC”, “Contact”, “GeoLookup”, “InvokeWebService”, “‘IPAddress’”, “[IP Address]”
This user property will result in calling of “GeoLookup” Business Service with “InvokeWebService” method when we click Lookup button and it will also pass value of IP Address Field value as an input argument to the business service.
Now the next step and the only step is to write the GeoLookup business service with “InvokeWebService” method which will invoke the web service, receive response and store it in database.
I wrote two variations of GeoLookup business. One uses normal eScript functions to Set and Get properties from Property Set while in other I have used PRM ANI Utility Service “SetProperty” and “GetProperty” methods (just wanted to share usage of these methods)
Before you jump and have a look at the code I must warn you that it is not the most aesthetic piece of code that you are going to see, I have not done any error handling or nullified any objects. In other words it is the bare minimum working code that:
- Creates an empty Property Set
- Sets the Required Properties
- Invokes Web Service and receive response
- Stores the response in database
You can download the code by clicking on the below given links
Code without PRM ANI Utility Service method usage
Code with PRM ANI Utility Service method usage
Now, after going through the code many of you might be wondering that are many other ways (better than this) to acomplish this. I agree with you and I am not finished with the tutorial yet
.
I will be discussing the problems I faced and the alternate approach I tried (rather I would say, trying …) and most importantly how did I debug the problems I faced.
Stay tuned….
<< Previous in series Next in series >>

(7 votes, average: 4.43 out of 5)





you’d better use a Runtine Event running a workflow process …
Hey bob,
As I mentioned in the article tutorial is not over.
I will be discussing various alternatives that we can use to acomplish it. So, I will say again .. stay tuned for updates
there is quite a big difference between not over … and completly in the wrong direction …
Yes, I totally agree with you..
but there is also difference between wrong and not recommended
Completing a requirement through eScript is not wrong.. ..
it is not recommended only if there are other better alternatives available. I believe everybody should have knowledge about everything that is why I share all the approaches/alternatives I know to complete the requirement, some of them are ok and others are better.
I am just sharing my opinion and knowledge.
Neel, Can u please share the XML which was the output of the custom Business Service(GeoLookup) i.e input for the webservice. So that we can track the code written easily.
Thanks
Hey Rahul,
It will be able to understand better if you give it a try yourself. If you still cannot understand it , let me know I will be more than happy to help you.
Hi Neel,
I am unable to download GEOIPService wsdl file. even i tried to download from webservicex.net site. could you please help me to send another link. please provide some other link.
Hi Neel,
The Lookup button was not working well. I received the error “The method ‘InvokeWebService’ is not supported on Business service ‘GeoLookup’.(SBL-DAT-00323)”
Then, I realized that the BS Scripts didn’t have a “return(CancelOperation)” at the end.
The error was solved!
That’s just a little help for others with the same error.
Tks for you great help!
Fernando Cruz
Named Method N is BC user property?
If yes, then how it ll get the value of [Ip Address] field? as the this fiels is not based on any coulumn of BC?
Can anyone help me understand the value part of “Named Method N”
Is there any seqence of parameters we r paasing in “Named method N”?