developer:resellerapi:howto:javajaxws

Java JAX-WS Howto

The following guide demonstrates how to use the USAePayResApi-jaxws.jar package with either Sun's Jax-WS 2.1 or Apache Foundation's CXF libary. This package contains a helper class for easily generating security tokens, classes for all USAePay objects and a client service class for calling web service methods. The package requires Jax-WS (see Dependencies).

Downloads

File Version Release Date Description
usaepayresapi-jaxws-1.4.0.zip 1.4.0 10/07/10 Library .jar and example .java
usaepayresapi-jaxws-1.4.jar.zip 1.4.0 10/07/10 USAePayResAPI-jaxws-1.4.jar only

Dependencies (Using Apache CXF)

  • USAePayResAPI-jaxws-1.4.jar
  • apache-cxf-2.2.9/lib/commons-logging-1.1.1.jar
  • apache-cxf-2.2.9/lib/cxf-2.2.9.jar
  • apache-cxf-2.2.9/lib/geronimo-activation_1.1_spec-1.0.2.jar
  • apache-cxf-2.2.9/lib/geronimo-annotation_1.0_spec-1.1.1.jar
  • apache-cxf-2.2.9/lib/geronimo-javamail_1.4_spec-1.6.jar
  • apache-cxf-2.2.9/lib/geronimo-jaxws_2.1_spec-1.0.jar
  • apache-cxf-2.2.9/lib/geronimo-servlet_2.5_spec-1.2.jar
  • apache-cxf-2.2.9/lib/geronimo-stax-api_1.0_spec-1.0.1.jar
  • apache-cxf-2.2.9/lib/geronimo-ws-metadata_2.0_spec-1.1.2.jar
  • apache-cxf-2.2.9/lib/jaxb-api-2.1.jar
  • apache-cxf-2.2.9/lib/jaxb-impl-2.1.12.jar
  • apache-cxf-2.2.9/lib/jetty-6.1.19.jar
  • apache-cxf-2.2.9/lib/jetty-util-6.1.19.jar
  • apache-cxf-2.2.9/lib/neethi-2.0.4.jar
  • apache-cxf-2.2.9/lib/saaj-api-1.3.jar
  • apache-cxf-2.2.9/lib/saaj-impl-1.3.2.jar
  • apache-cxf-2.2.9/lib/wsdl4j-1.6.2.jar
  • apache-cxf-2.2.9/lib/wstx-asl-3.2.8.jar
  • apache-cxf-2.2.9/lib/xml-resolver-1.2.jar
  • apache-cxf-2.2.9/lib/XmlSchema-1.4.5.jar

Dependencies (Using Sun's Jax-WS 2.1)

  • USAePay-jaxws-1.2.0.jar
  • jaxb/activation.jar
  • jaxb/api/jaxb-api.jar
  • jaxb/jaxb-impl.jar
  • jaxb/jaxb-xjc.jar
  • jaxb/api/jsr173_api.jar
  • jaxws21/FastInfoset.jar
  • jaxws21/http.jar
  • jaxws21/api/jaxws-api.jar
  • jaxws21/jaxws-rt.jar
  • jaxws21/jaxws-tools.jar
  • jaxws21/api/jsr181-api.jar
  • jaxws21/api/jsr250-api.jar
  • jaxws21/mimepull.jar
  • jaxws21/api/saaj-api.jar
  • jaxws21/saaj-impl.jar
  • jaxws21/sjsxp.jar
  • jaxws21/stax-ex.jar
  • jaxws21/streambuffer.jar

Using Library

Step 1: Importcom.usaepay.resapi.jaxws Classes

In classes that are going to use the USAePay methods or object, you need to import the appropriate classes from com.usaepay.resapi.jaxws package. The following will import all usaepay objects at once:

import com.usaepay.resapi.jaxws.*;

Step 2: Instantiate client Object

All calls to the USAePay web service are handled by a “client” object of type “UeSoapServerPortType”. There are two ways to instantiate the client object. To instantiate a client for use with the main production servers:

// Instantiate client for production
UeSoapServerPortType client = usaepay.getClient();

Alternately, you can specify a server hostname, which will allow you to setup a connection to the sandbox server for testing or a backup datacenter (see the high availability programming guide).

// Instantiate client for sandbox
UeSoapServerPortType client = usaepay.getClient("sandbox.usaepay.com");

Step 3: Generate Security Token

A “restoken” object (of type UeSecurityToken) is required by all methods in the USAePay Reseller API. It is used to identify and authenticate the reseller.

// Create security token
String SourceKey="YourKeyGoesHere";
String Pin ="YourPinGoesHere";
String ClientIP="10.10.10.10";
UeSecurityToken restoken = usaepay.getToken(SourceKey, Pin, ClientIP);

Step 4: Calling a Webservice Method

Web service methods are called using the client object. Below is an example for calling the getMerchant method. For further examples see the api documentation.

// Set the merchant ref num (merchid)
BigInteger merchrefnum = new BigInteger("118227");
 
// Create response object
Merchant merch;
 
// Retrieve Merchant
merch = client.getMerchant(restoken, merchrefnum);
 
// Display response
System.out.println("Merchant: " + merch.getMerchantName());

Additional Documentation

For addition documentation on which methods are available and example usage, please see the main Reseller API Documenation. The documentation includes a description of all methods and their parameters as well as examples for the java library.

If you run into any trouble please contact our integration support department.

developer/resellerapi/howto/javajaxws.txt · Last modified: 2010/10/07 15:41 by tem

Page Tools