developer:soap-1.3:howto:javajaxws

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

developer:soap-1.3:howto:javajaxws [2010/06/01 15:41] (current)
hmcgowan created
Line 1: Line 1:
 +====== Java JAX-WS Howto ======
 +
 +The following guide demonstrates how to use the USAePay-jaxws.jar package with either Sun's Jax-WS 2.1  or [[http://​cxf.apache.org/​|Apache Foundation'​s CXF libary]]. ​ This package contains a helper class for easily generating security tokens, ​ classes for all USAePay soap objects and a client service class for calling soap methods. ​ The package requires Jax-WS (see Dependencies).  ​
 +
 +====== Downloads ======
 +
 +^File  ^Version ^Release Date ^ Description ^
 +|{{:​developer:​soap:​howto:​usaepayapi-jaxws-1.2.0.zip|}} | 1.2.0 |8/25/09 | Library .jar and example .java | 
 +|{{:​developer:​soap:​howto:​usaepay-jaxws-1.2.0.jar.zip|}} |1.2.0 | 9/5/09 |USAePay-jaxws-1.2.jar ​ only|
 +
 + 
 +
 +===== Dependencies (Using Apache CXF) =====
 +
 +  * USAePay-jaxws-1.2.0.jar
 +  * apache-cxf-2.2.3/​lib/​commons-logging-1.1.1.jar
 +  * apache-cxf-2.2.3/​lib/​cxf-2.2.3.jar
 +  * apache-cxf-2.2.3/​lib/​geronimo-activation_1.1_spec-1.0.2.jar
 +  * apache-cxf-2.2.3/​lib/​geronimo-annotation_1.0_spec-1.1.1.jar
 +  * apache-cxf-2.2.3/​lib/​geronimo-javamail_1.4_spec-1.6.jar ​  
 +  * apache-cxf-2.2.3/​lib/​geronimo-jaxws_2.1_spec-1.0.jar
 +  * apache-cxf-2.2.3/​lib/​geronimo-servlet_2.5_spec-1.2.jar
 +  * apache-cxf-2.2.3/​lib/​geronimo-stax-api_1.0_spec-1.0.1.jar
 +  * apache-cxf-2.2.3/​lib/​geronimo-ws-metadata_2.0_spec-1.1.2.jar
 +  * apache-cxf-2.2.3/​lib/​jaxb-api-2.1.jar
 +  * apache-cxf-2.2.3/​lib/​jaxb-impl-2.1.12.jar
 +  * apache-cxf-2.2.3/​lib/​jetty-6.1.19.jar
 +  * apache-cxf-2.2.3/​lib/​jetty-util-6.1.19.jar
 +  * apache-cxf-2.2.3/​lib/​neethi-2.0.4.jar
 +  * apache-cxf-2.2.3/​lib/​saaj-api-1.3.jar
 +  * apache-cxf-2.2.3/​lib/​saaj-impl-1.3.2.jar
 +  * apache-cxf-2.2.3/​lib/​wsdl4j-1.6.2.jar
 +  * apache-cxf-2.2.3/​lib/​wstx-asl-3.2.8.jar
 +  * apache-cxf-2.2.3/​lib/​xml-resolver-1.2.jar
 +  * apache-cxf-2.2.3/​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: Import com.usaepay.api.jaxws Classes =====
 +
 +In classes that are going to use the USAePay soap methods or object, ​ you need to import the appropriate classes from com.usaepay.api.jaxws package. ​  The following will import all usaepay objects at once:
 +
 +<code java>
 +import com.usaepay.api.jaxws.*;​
 +</​code>​
 +
 +
 +===== Step 2: Instantiate client Object =====
 +
 +All calls to the USAePay soap servers 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:
 +
 +<code java>
 +// Instantiate client for production
 +UeSoapServerPortType client = usaepay.getClient();​
 +</​code>​
 +
 +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 [[developer:​highavailability|the high availability programming guide]]).  ​
 +
 +<code java>
 +// Instantiate client for sandbox
 +UeSoapServerPortType client = usaepay.getClient("​sandbox.usaepay.com"​);​
 +</​code>​
 +
 +===== Step 3: Generate Security Token =====
 +
 +A "​token"​ object (of type UeSecurityToken) is required by all soap methods in the USAePay API.  It is used to identify the merchant.  ​
 +
 +<code java>
 +// Create security token
 +String SourceKey="​YourKeyGoesHere";​
 +String Pin ="​YourPinGoesHere";​
 +String ClientIP="​10.10.10.10";​
 +UeSecurityToken token = usaepay.getToken(SourceKey,​ Pin, ClientIP);
 +</​code>​
 +
 +===== Step 4: Calling a Soap Method =====
 +
 +Soap methods are called using the client object. ​ Below is an example for calling the runSale method. ​ For further examples see the soap api documentation.
 +
 +<code java>
 +TransactionRequestObject request = new TransactionRequestObject();​
 +request.setAccountHolder("​Tester John"​);​
 +
 +TransactionDetail details = new TransactionDetail();​
 +details.setAmount(12.30);​
 +details.setDescription("​Example Sale"​);​
 +request.setDetails(details);​
 +
 +CreditCardData ccdata = new CreditCardData();​
 +ccdata.setAvsStreet("​1234 Main"​);​
 +ccdata.setAvsZip("​12345"​);​
 +ccdata.setCardNumber("​4444555566667779"​);​
 +ccdata.setCardExpiration("​0909"​);​
 +request.setCreditCardData(ccdata);​
 +
 +TransactionResponse response;
 +
 +response = client.runSale(token,​ request);
 +
 +System.out.println("​Response:​ " + response.getResult() + " RefNum: " + response.getRefNum());​
 +
 +</​code>​
 +
 +====== Additional Documentation ======
 +
 +For addition documentation on which methods are available and example usage, ​ please see the main [[..|Soap API Documenation]]. ​ The soap 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/soap-1.3/howto/javajaxws.txt ยท Last modified: 2010/06/01 15:41 by hmcgowan

Page Tools