+ Start a Discussion
Vimal Bhavsar 6Vimal Bhavsar 6 

Apex Trigger for Call Webservice Function

Hi,

Can any one tell me the sample code for how to call external webservice function in apex trigger.

I want to pass parameter to Function of that webservice and store in my sql database.

thnx
KevinPKevinP
Unfortunately, I can't just give you demo code. What you're trying to do is highly dependent on the individual webservice you're calling. Is it WSDL or REST based ? Can you say more about what the webservice is ?
Vinit_KumarVinit_Kumar
Agreed with Kevin,

You should be specific to the question what you are looking for and also have you written something as of now or do you expect someone else to do the job for you ??

If you have and you are stuck somewhere then let us know we could help you out !!
Vimal BhavsarVimal Bhavsar
I have WSDL service for this one
Vinit_KumarVinit_Kumar
Then,consume the WSDL and generate Apex class in salesforce.Use the methods in the class to make calls.
Vimal Bhavsar 6Vimal Bhavsar 6
Thx Vinit,

Actly i have tried same but my WSDL get this error :Failed to parse wsdl: Parse error: Found invalid XML. could not determine namespace bound to element prefix wsdl (position: START_DOCUMENT seen ...definitions name="Service1" targetNamespace="http://tempuri.org/">... @2:73)


When i have use some online WSDL files it will able to create Apex class ..


my WSDL is sample WSDl which provide by VS 2010 in built "Hello World", sorry m tottaly new to salesforce so getting so much problem  for the same.

thnx for reply
Vinit_KumarVinit_Kumar
It seems that the WSDL you are trying to import is not correct..