Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Dynamic data connection

Avatar

Level 2

Hi,

I was wondering if there is a way to setup data connection to call web services dynamically.

There are 3 environments (Dev, Test, and Production) and each environment has designated web services server.

For example, http://devserver is for dev web services, http://testserver is for web services for test environment.

What I'm trying to achieve is that I want to be able to create a pdf in dev environment and then promote it to the test server where the pdf has to call http://testserver instead of http://devserver without having to modify data connection everytime I promote a pdf.

Thanks in advance.

17 Replies

Avatar

Former Community Member

You can dynamically set the submit address for web services but you woudl need to pass that info into the form in some way. How do you know which environment you are supposed to submit to?

Paul

Avatar

Level 2

Hi Paul,

Thanks for your reply.

I know which environment the application is running because the web application which retrieves the pdf through LiveCycle web service knows where it is running based on configuration.

So if I can set the web services address dynamically, that will be great because I can pass the web services address.

Thanks.

Avatar

Former Community Member

The command you want is:

xfa.connectionSet.DataConnection.soapAddress.value

where DataConnection is the name of the connection that you gave it when you set it up.

Paul

Avatar

Level 2

Paul,

Thanks for your answer.

Would you please elaborate where and how can I use xfa.connectionSet.[DataConnectionName].soapAddress.value?

A way I was thinking was that setting the soap address in the LiveCycle process at runtime. I'd be better if there's a better way.

I was able to set submit url dynamically using an input paramter (type of URLSpec) passed by my web application. So I was looking for a similar way to do it.

Thanks a lot,

Jake

Avatar

Former Community Member

You woudl have to get the address into a field on the form. You could set it in a xml data file and merge that file onto the template at render time. Then use the Form Ready event to get the value from the field at set the value ...using that command.

Paul

Avatar

Level 2

I was able to set the environment's soap address in a text field in the form - using XML Schema binding and process variable set by parameter.

And tried to assign the value to the web service data connection in the ready:form event.

xfa.connectionSet.WS.soapAddress.value = soapAddr.rawValue;

But it xfa.connectionSet.WS.soapAddress.value wouldn't change.

Anything missing here?

Thanks,

Jake

Avatar

Former Community Member

What is the target version of your form (look in the form properties)?

Paul

Avatar

Level 2

I tried all possible target versions in the list - from 6.0.2 to 9.0.

None of them works.

xfa.connectionSet.MyDataConnection.soapAddress.value never changes and calls the old address.

Thanks,

Jake

Avatar

Former Community Member

I just tried it here and it worked fine. I set my target to 7.0.5 and set the SoapAddress parameter. Make sure you do not include the ?wsdl in the call. I have included my test form .....it will not work for you as you do not have access to my servers but you can at least see what I did.

Paul

Avatar

Level 2

Thanks for your example.

That's exactly what I did in my XDP wondering why this simple script wouldn't work.

And your example doesn't work either. The two message boxes shows the same address which is the first one.

So, it seems that there must be something else that should make this thing work.

To test your pdf, I created a simple process with only two activities - Read Resource Content to read the file and Apply Usage Rights to apply reader extention.

Any ideas?

Thanks,

Jake

Avatar

Former Community Member

I was playing with the target version before I sent it ...make sure it is set to version 7.0.5

That works on my machine

Paul

Avatar

Level 2

Yeah, the target version is set to 7.0.5.

Unfortunately, I tried all possible versions but none of them works...

It is so frustrating this simple script doesn't work.

Avatar

Former Community Member

The issue has to do with some security that Acrobat added in version 8 that will not allwo you to modifythe connectionSet after the form has been rendered. I thought of a different way (based on an article that Stefan Cameron wrote) and it worked - for all versions. II clone the connectioSet nodes and adjust them instead. Have a look at this example and try the technique on your form.

Paul

Avatar

Level 2

Paul,

I appreciate your help on this.

It works now.

Thanks again.

Jake

Avatar

Level 5

Hi Paul:

I've been trying to duplicate your process, and I am still having a problem.

I have a web service that supports searching.

It includes a query field to pass a string to the web service to search for, and a result field that is populated with the result.

I have 2 versions of the service running to simulate Test and Production web services.

I have linked the form to the Test version of the web service in Designer.

I am trying to dynamically shift to the Production version at run time.

I am cloning the data connection, populating the query field, and execting the connection.

I am getting an operation failed message: Error attempting to read from file.

I suspect that the query field's binding is not associated with the Production web service.

The server that hosts the services does not register a hit.

Any thougthts would be appreciated.

Thanks

Mark

Avatar

Former Community Member

Are you setting the soapconnection or the wsdl connection? If you post your form I will have a look.

paul

Avatar

Level 5

Hi Paul:

I solved the problem. It was not with your solution, but my service implementation.

The service I was redirecting to had different security settings than the original.

Once security was consistant, the technique worked fine.

Thanks for the information, and offer of assistance.

Mark