To create mobile web service applications in Java, you must complete the following initialization tasks.
To initialize QAnywhere and mobile web services for Java
Add the location of the following files to your classpath. By default, they are located in install-dir\java:
Import the ianywhere.qanywhere.client and ianywhere.qanywhere.ws packages:
import ianywhere.qanywhere.client.*; import ianywhere.qanywhere.ws.*;
Create a QAManager object.
QAManager mgr; mgr = QAManagerFactory.getInstance().createQAManager(null);
You can also customize a QAManager object by specifying a properties file to the createQAManager method:
mgr = QAManagerFactory.getInstance().createQAManager("qa_mgr.props.");
For maximum concurrency benefits, multi-threaded applications should create a QAManager for each thread. See Multi-threading considerations.
Initialize the QAManager object.
The argument to the open method is an acknowledgement mode, which indicates how messages are to be acknowledged. It must be one of IMPLICIT_ACKNOWLEDGEMENT or EXPLICIT_ACKNOWLEDGEMENT.
QAnywhere messages used by mobile web services are not accessible to the mobile web services application. When using a QAManager in EXPLICIT_ACKNOWLEDGEMENT mode, use the Acknowledge method of WSResult to acknowledge the QAnywhere message that contains the result of a web services request. This method indicates that the application has successfully processed the response.
For more information about acknowledgement modes, see:
Instead of creating a QAManager, you can create a QATransactionalManager. See Implementing transactional messaging for Java clients.
Create an instance of the service binding class.
The mobile web services WSDL compiler generates the service binding class from the WSDL document that defines the web service.
In the process of making web service requests, the QAManager is used by the instance of the web service binding class to perform messaging operations. You specify the connector address to use to send web service requests through QAnywhere by setting the WS_CONNECTOR_ADDRESS property of the service binding class. Each QAnywhere web service connector is configured with a URL of a web service to connect to. This means that if an application needs web services located at more than one URL, then a QAnywhere connector must be configured for each service URL.
CurrencyConverterSoap service = new CurrencyConverterSoap( ); service.setQAManager(mgr); service.setProperty("WS_CONNECTOR_ADDRESS", "ianywhere.connector.currencyconvertor\\");
Note that the final \\ in the address must be included.
To initialize mobile web services, you must create a QAManager and create an instance of the service binding class. For example:
// QAnywhere initialization Properties props = new Properties(); props.put( "CONNECT_PARAMS", "eng=qanywhere;dbf=qanywhere.db;uid=ml_qa_user;pwd=qanywhere" ); QAManager mgr = QAManagerFactory.getInstance().createQAManager( props ); mgr.open( AcknowledgementMode.IMPLICIT_ACKNOWLEDGEMENT ); mgr.start(); // Instantiate the web service proxy CurrencyConvertorSoap service = new CurrencyConvertorSoap(); service.setQAManager( mgr ); service.setProperty( "WS_CONNECTOR_ADDRESS", "ianywhere.connector.currencyconvertor\\" );
|Send feedback about this page via email or DocCommentXchange||Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0|