Skip to Content
author's profile photo Former Member
Former Member

Change web service connection

Hello,

I'm using the Crystal Reports Java runtime of Crystal Reports for Eclipse (JRC 2.0.11, normal Java code, no JSP) and trying to change a web service connection during runtime. Some time ago, I had a similar issue changing JDBC connections (see [change-database;).

The original data source has been specified during design time of the report and points for example to the WSDL "http://192.168.0.10:8080/axis2/services/ExampleService?wsdl". During runtime, I'm trying to change the data source for example to "http://192.168.0.20:8080/axis2/services/ExampleService?wsdl". Here's my code snippet:

ITable newTable = null;
for (final ITable oldTable : database.getTables()) {
    newTable = (ITable) oldTable.clone(true);

    // Create new connection properties.
    final PropertyBag newConnectionProperties = new PropertyBag();
    newConnectionProperties.put("Database DLL"                   , "crdb_xml.dll");
    newConnectionProperties.put("Server Name"                    , "http://192.168.0.20:8080/axis2/services/ExampleService?wsdl ExampleService ExamplePort ExampleMethod");
    newConnectionProperties.put("Server Type"                    , "XML");
    newConnectionProperties.put("PreQEServerName"                , "http://192.168.0.20:8080/axis2/services/ExampleService?wsdl ExampleService ExamplePort ExampleMethod");
    newConnectionProperties.put("Http WebService URL"            , "http://192.168.0.20:8080/axis2/services/ExampleService?wsdl");
    newConnectionProperties.put("List Methods"                   , "ExampleMethod");
    newConnectionProperties.put("List Ports"                     , "ExamplePort");
    newConnectionProperties.put("List Services"                  , "ExampleService");
    newConnectionProperties.put("UserID Http(s) WebService"      , "USER");
    newConnectionProperties.put("Web Service Authentication User", "PASSWORD");

    // Create new connection info object.
    final IConnectionInfo newConnectionInfo = new ConnectionInfo();
    newConnectionInfo.setAttributes(newConnectionProperties);
    newConnectionInfo.setKind(ConnectionInfoKind.SQL);
    newConnectionInfo.setUserName("USER");
    newConnectionInfo.setPassword("PASSWORD");

    // Replace web service connection.
    newTable.setConnectionInfo(newConnectionInfo);
    databaseController.setTableLocation(oldTable, newTable);
}

The problem is, that Crystal Reports always connects to the data source specified during design time of the report. I've tried several approaches but nothing has solved the problem (for example using replaceConnection instead of setTableLocation). If you have any hints or ideas I would be very grateful!

Thanks in Advance!

Robin

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Apr 06, 2011 at 08:39 AM

    No ideas?

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.