Question Status

Suggested Answer
arhaan asked a question on 21 Mar 2014 2:12 PM

Hello,

  I have a requirment of calling JAVA web service from CRM 2013 in synchronous mode.

Can you please let me know possible options for doing this with some samples that would be highly appreciated.

Thank you

Arhaan

Reply
Suggested Answer
Michael Ferreira responded on 22 Mar 2014 5:09 PM

Hey Arhaan,

Actually answer this one in your more recent post.

Option #1 (most likely if synchronize call while completing form)

If you'd like to make calls while working with the form before saving data.  Example, selecting a form picklist will require a call to backend system to retrieve a price.  Then JavaScript approach.

Option #2  (most likely for synchronous mode when saving)

if you'd like to make your calls while saving your data (i.e. in process).  Then a plug would be your choice

Option #3

you can also use custom workflows to make calls asynch (i.e. post save / when resources allow) to process your information.

Would need to understand your use case or user story before I could provide better examples.

Hope this information helps ...   If so, please mark it as your answer.

Reply
Ben Hosking responded on 21 Mar 2014 2:33 PM

I'm not sure what you mean when you say in synchronous mode?

Is your CRM 2013 on premise or Crm 2013 online

Ben  Hosking

If the my post helped you please mark my post as the suggested answer

Hosk's Dynamic CRM Blog   |  @BenHosk |  Rockstar365

Hosks CRM Dev YouTube Channel

Reply
arhaan responded on 21 Mar 2014 2:38 PM

Thanks for the reply,

          at present it would be online and later on OnPremise

Reply
arhaan responded on 21 Mar 2014 2:39 PM

Synchronous mode meaning that user need not wait for response

Reply
SyedHussain responded on 22 Mar 2014 12:02 AM

As Boskings said, you have two options to process events; Asynchronous & Synchronous, both of which you'll use the plugin registration tool to set. I suggest you have a look at the CRM SDK and read this: msdn.microsoft.com/.../gg327941.aspx

Also, I note that all plugins in both CRM Online and On-Premise have a 2 minute timeout limit. On-Premise you have an option to extend that limit but it's not usually considered best practice to do so.

Reply
Suggested Answer
Michael Ferreira responded on 22 Mar 2014 5:09 PM

Hey Arhaan,

Actually answer this one in your more recent post.

Option #1 (most likely if synchronize call while completing form)

If you'd like to make calls while working with the form before saving data.  Example, selecting a form picklist will require a call to backend system to retrieve a price.  Then JavaScript approach.

Option #2  (most likely for synchronous mode when saving)

if you'd like to make your calls while saving your data (i.e. in process).  Then a plug would be your choice

Option #3

you can also use custom workflows to make calls asynch (i.e. post save / when resources allow) to process your information.

Would need to understand your use case or user story before I could provide better examples.

Hope this information helps ...   If so, please mark it as your answer.

Reply
arhaan responded on 25 Mar 2014 11:50 PM

Thanks a lot for clarifying,

         i am in process of making an POC of calling external Web Service from any of the events like form_load or picklist in sync mode for CRM 2013.

If you can please point me to the right code to implement the same

Regards

Aarhaan

Reply
arhaan responded on 26 Mar 2014 1:02 AM

i am using following javascript function to call the webservice exposed on the internet

i.e.tools.usps.com/.../ZipLookupResultsAction here it is giving permission denied issue

function CallWebService()

{            

alert('in webservice');

var xmlHttp;

           xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");

           //xmlHttp.open('POST', 'http://servername/Numbers2WordsConversion/Service.asmx/GetWords', false);

    xmlHttp.open('POST', 'tools.usps.com/.../ZipLookupResultsAction!input.action

resultMode=0&companyName=&address1=&address2=&city=Orlando&state=CA&urbanCode=&postalCode=&zip=', false);

           xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

          // xmlHttp.send("number=" + input);

xmlHttp.send();

           var xmlDoc = xmlHttp.responseXML;

           var responseElement = xmlDoc.getElementsByTagName("string")[0];

           var exch = responseElement.firstChild.nodeValue;

alert(exch);

//            Xrm.Page.getAttribute("new_valueinwords").setValue(exch);

}

Reply
arhaan responded on 26 Mar 2014 5:45 AM

Hello Just to add on to my above comments

Would like say one field to be populated from web service  on selection of another pickup list.

One more point i am using CRM 2013 Online

Thanks for all you help

Arhaan

Reply