Expand my Community achievements bar.

SOLVED

best practice for web service call

Avatar

Former Community Member

I can add a web service using the standard data connection wizard - works fine. I also can do it all in Javascript which give me a bit more flexibility. Is there some guideline or wisdom for which is best?

1 Accepted Solution

Avatar

Correct answer by
Level 10

It all depends on your requirement..

For example, if you know your webservice address at design time itself, then it would be better to put in the data connection tab.

But if your webservice address changes at run time based on the environment your application is deployed in, then you can use the java script code to change the webservice address dynamically.

Thanks

Srini

View solution in original post

4 Replies

Avatar

Correct answer by
Level 10

It all depends on your requirement..

For example, if you know your webservice address at design time itself, then it would be better to put in the data connection tab.

But if your webservice address changes at run time based on the environment your application is deployed in, then you can use the java script code to change the webservice address dynamically.

Thanks

Srini

Avatar

Former Community Member

thanks, that was exactly the type of answer I was looking for.

When you say, "then you can use the java script code to change the webservice address dynamically.", do you mean that, for example, in an initialize event, you test some field to see which environment you are in, and set the URL accordingly?

Avatar

Level 10

In my case, I use the server components to render PDF files, so I can pass the environment value as part of the XML at the time of rendering.. I can read the value and change the webservice address at runtime (probably in the initialize event).

Thanks

Srini

Avatar

Former Community Member

Excellent, that's what I was planning to do - thanks a lot. Gordon