Professional Web Applications Themes

ColdFusion + Java Guru Install Cybersource Java Api - Coldfusion - Advanced Techniques

Hi, I need to install a cybersource java api on a coldfusion MX 6 server and call it as a component to pass variables to their gateway. Here is the java package I got from cybersource. Very small file... [url]http://apps.cybersource.com/cgi-bin/pages/dev_kits.cgi?kit=Java/All_Platforms[/url] Can anyone please help me with this. Thanks!...

  1. #1

    Default ColdFusion + Java Guru Install Cybersource Java Api

    Hi,

    I need to install a cybersource java api on a coldfusion MX 6 server and call
    it as a component to pass variables to their gateway.

    Here is the java package I got from cybersource. Very small file...

    [url]http://apps.cybersource.com/cgi-bin/pages/dev_kits.cgi?kit=Java/All_Platforms[/url]

    Can anyone please help me with this.

    Thanks!

    charleyyyy Guest

  2. #2

    Default Re: ColdFusion + Java Guru Install Cybersource Java Api

    it doesn't seem that hard (but nothing does at first glance). copy the two cyb*
    jars to cfinstallDir\wwwroot\web-inf\lib\ dir (might need to restart the
    cfserver service). the java example (AuthCaptureSample.java) is pretty
    rinky-dink but it seems simple enough to convert to cf.


    PaulH Guest

  3. #3

    Default Re: ColdFusion + Java Guru Install Cybersource Java Api

    Hi Paul,

    This is a huge chalenge for me and I have already spent hours around this
    issue. There are NO CyberSource ColdFusionMX tutorials on the net, my google
    searches were all in vain. However there are quite a bit of discussions here on
    the forum concerning Cybersource and "paradoxically" none of them was fully
    answered.

    My question is the following. How do you call the com.cybersource.sample with
    CFOBJECT. Is this the only object I have to create. How do I see all the
    methods? What is the rolle/yuse of the GTECyberTrustRoot.cer in the package?
    Where does this has to be installed in the ColdFusion server?

    I read the docs and everything is explained in terms of Java classes. My
    knowledge of Java is simple but I am used to using CF components and I am sure
    that I can brainstorm the scenarios and call the right methods to pass
    transactions to CyberSource.

    I would appreciate your answers they would give me a hughe jumpstart in my
    quest.

    Thanks!

    Charley



    charleyyyy Guest

  4. #4

    Default Re: ColdFusion + Java Guru Install Cybersource Java Api

    i didn't look at many postings concerning cybersource but the few that i did
    were having issues w/COM (mx & other java apps will usually have some
    difficulty w/COM stuff). as i said, the java example is pretty trivial.

    well you wouldn't "call" that sample. you might duplicate it's logic in cf
    (for a quick & dirty port see below). to see methods for the classes you need
    to use, you'd simply read the API.

    as far as the gritty details of this thing, have you read
    [url]http://apps.cybersource.com/library/doentation/dev_guides/Web_Services_Client[/url]
    s_Java/html/ ?



    <cfscript>
    // setup needed java bits
    clientObj=createObject("java","com.cybersource.ws. client.Client");
    //useless overkill?? why not java.util.Properties??
    utilObj=createObject("java","com.cybersource.ws.cl ient.Utility");
    //or maybe cf equivalent struct
    hashMap=createObject("java","java.util.HashMap");
    captureHM=hashMap.clone();

    //get this thing's properties file, roundabout way, wants commandline args
    propFile=arrayNew(1);
    propFile[1]="E:\Inetpub\wwwroot\simapi\sample\cybs.properties ";
    properties=utilObj.readProperties(propFile);

    // defaults
    requestID="";
    thisReply="";
    captureReply="";

    // do something with that properties file, ripped from java example
    hashMap.put("ccAuthService_run", "true" );
    hashMap.put( "merchantReferenceCode", "MRC-14344" );
    hashMap.put( "billTo_firstName", "John" );
    hashMap.put( "billTo_lastName", "Doe" );
    hashMap.put( "billTo_street1", "1295 Charleston Road" );
    hashMap.put( "billTo_city", "Mountain View" );
    hashMap.put( "billTo_state", "CA" );
    hashMap.put( "billTo_postalCode", "94043" );
    hashMap.put( "billTo_country", "US" );
    hashMap.put( "billTo_email", "nobodycybersource.com" );
    hashMap.put( "billTo_ipAddress", "10.7.7.7" );
    hashMap.put( "billTo_phoneNumber", "650-965-6000" );
    hashMap.put( "shipTo_firstName", "Jane" );
    hashMap.put( "shipTo_lastName", "Doe" );
    hashMap.put( "shipTo_street1", "100 Elm Street" );
    hashMap.put( "shipTo_city", "San Mateo" );
    hashMap.put( "shipTo_state", "CA" );
    hashMap.put( "shipTo_postalCode", "94401" );
    hashMap.put( "shipTo_country", "US" );
    hashMap.put( "card_accountNumber", "4111111111111111" );
    hashMap.put( "card_expirationMonth", "12" );
    hashMap.put( "card_expirationYear", "2020" );
    hashMap.put( "purchaseTotals_currency", "USD" );
    // there are two items in this sample
    hashMap.put( "item_0_unitPrice", "12.34" );
    hashMap.put( "item_1_unitPrice", "56.78" );
    try {
    thisReply = clientObj.runTransaction(hashMap,properties);
    if (thisReply.get("decision") EQ "ACCEPT")
    requestID=thisReply.get("requestID");
    } // try
    // do some error handling, probably need a couple-three catches
    catch ("com.cybersource.ws.client.ClientException" e) {
    writeoutput("#e.getLogString()#");
    } // catch client exception
    catch ("com.cybersource.ws.client.FaultException" e) {
    writeoutput("#e.getLogString()#");
    } // catch client exception

    // did it work?
    if (trim(len(requestID))) { // got something back?
    captureHM.put("ccCaptureService_run", "true");
    captureHM.put("merchantReferenceCode", "MRC-14344" );
    captureHM.put("ccCaptureService_authRequestID", requestID);
    captureHM.put("purchaseTotals_currency", "USD");
    captureHM.put("item_0_unitPrice", "12.34");
    try {
    captureReply = clientObj.runTransaction(captureHM,properties);
    } //try
    // do some error handling, probably need a couple-three catches
    catch ("com.cybersource.ws.client.ClientException" e) {
    writeoutput("#e.getLogString()#");
    } // catch client exception
    catch ("com.cybersource.ws.client.FaultException" e) {
    writeoutput("#e.getLogString()#");
    } // catch client exception

    }
    </cfscript>

    <cfdump var="#clientObj#">
    <br>
    <cfdump var="#thisReply#">
    <br>
    <cfdump var="#captureReply#">

    PaulH Guest

  5. #5

    Default Re: ColdFusion + Java Guru Install Cybersource Java Api

    Hello Boys

    Anyone managed to integrate cybersource with java into coldfusion. I also spent three days with it. I made cfobjects and try to use it without cfscript but no success.


    krigton Guest

  6. #6

    Default Re: ColdFusion + Java Guru Install Cybersource Java Api

    Hey gang ..
    I'm working here on a fusebox 4 app and I now need to connect the online
    donations to cybersource ..
    Has anyone here been able to get cybersource working with cold fusion mx ?

    Any help or ideas will be appreciated ..

    atahualpa Guest

  7. #7

    Default Re: ColdFusion + Java Guru Install Cybersource Java Api

    Paul,

    Your code was very useful. I'm trying to get the Cybersource stuff working as
    well. Here is the error that was genereated when I attempted to use your code.



    Error Occurred While Processing Request
    org/apache/xerces/dom/DoentImpl


    The error occurred in E:\webfiles\neweracap.com\sandboxes\jbean\index.cf m:
    line 48

    46 : hashMap.put( "item_1_unitPrice", "56.78" );
    47 : try {
    48 : thisReply = clientObj.runTransaction(hashMap,properties);
    49 : if (thisReply.get("decision") EQ "ACCEPT")
    50 : requestID=thisReply.get("requestID");

    JB3178 Guest

  8. #8

    Default Re: ColdFusion + Java Guru Install Cybersource Java Api

    First problem solved. All of the .jar files need to be moved into the
    ColdFusion directory. Now that I did that, here is the error that I'm getting.

    The system has attempted to use an undefined value, which usually indicates a
    programming error, either in your code or some system code.
    Null Pointers are another name for undefined values.


    The error occurred in E:\webfiles\x\index.cfm: line 48

    46 : hashMap.put( "item_1_unitPrice", "56.78" );
    47 : try {
    48 : thisReply = clientObj.runTransaction(hashMap,properties);
    49 : if (thisReply.get("decision") EQ "ACCEPT")
    50 : requestID=thisReply.get("requestID");

    JB3178 Guest

  9. #9

    Default Re: ColdFusion + Java Guru Install Cybersource Java Api

    Did any of you figure this out yet? I'm battling with this too. Thanks.

    John
    [email]john.princehotelplanner.com[/email]
    [url]http://www.HotelPlanner.com[/url]
    PrinceDog Guest

  10. #10

    Default Re: ColdFusion + Java Guru Install Cybersource Java Api

    I'm at the same point as you now. This is the code I'm using. Were you able to
    get past the null pointer error JB3178?

    The system has attempted to use an undefined value, which usually indicates a
    programming error, either in your code or some system code.
    Null Pointers are another name for undefined values.


    PrinceDog Guest

  11. #11

    Default Re: ColdFusion + Java Guru Install Cybersource Java Api

    Help, I am also trying to use the Java Client with CF MX. I've tried many
    routes, but I don't want to convert our whole credit card app to ASP just to
    grab the keys. I tried the simple API and the XML API and kept getting errors
    saying that the MerchantID was invalid. Any custom tags anyone knows about or
    work arounds for the simple API? Cybersource is no help.

    cfdesigner Guest

  12. #12

    Default Re: ColdFusion + Java Guru Install Cybersource Java Api

    Sorry, but I'm still stuck at the point in my message above. The java solution seems to get real close, but I can't get past that error. Please let me know if you solve it. Thanks, J. Prince
    cfprince Guest

  13. #13

    Default Re: ColdFusion + Java Guru Install Cybersource Java Api

    Hi All, I work at CyberSource in the support department, and have been able to
    get ColdfusionMX 6.0 to work with the CyberSource Java SOAPI CDK. I am using
    the linux version of Coldfusion.

    I'm defintely not a Coldfusion expert, but below are the steps I took to get
    it to work:
    1 - Modified the jvm.config file in the bin directory to look like below:
    # JVM classpath

    java.class.path=/home/simapijava/simapi-2.0.0/lib/cybsclients.jar,/home/simapija
    va/simapi-2.0.0/lib/cybssecurit

    y.jar,/home/simapijava/simapi-2.0.0/lib/xalan.jar,/home/simapijava/simapi-2.0.0/
    lib/xercesImpl.jar,/home/s

    imapijava/simapi-2.0.0/lib/xml-api.jar,{application.home}/lib,{application.home}
    /runtime/lib/jrun.jar,{application.home}/
    runtime/lib

    The xerces version that comes with the CDK is the important portion here, as
    it is required in order to sign the soap message with the RSA libraries that
    are part of the client. If any other xerces version is used besides the one
    included in the CDK, then it will fail with the java.lang.null that is commonly
    seen.

    2. You would then restart the coldfusion server.

    3. Below is the sample code that I'm using. This does not do any exception
    handling and basically just runs a transaction.

    <cfobject action="create" type="java" class="java.util.Properties"
    name="proprequest">
    <cfobject action="create" type="java" class="java.util.HashMap"
    name="response">
    <cfobject action="create" type="java" class="java.util.Properties"
    name="props">
    <cfobject action="create" type="java" class="com.cybersource.ws.client.Client"
    name="clientobj">
    <cfobject action="create" type="java" class="java.lang.String"
    name="stringhash">

    <cfscript>
    props.setProperty("merchantID", "yourmechantid");
    props.setProperty("targetAPIVersion", "1.13");
    props.setProperty("keysDirectory",
    "/home/simapijava/simapi-2.0.0/keys");
    props.setProperty("sendToProduction", "false");
    props.setProperty("enableLog", "false");
    props.setProperty("logDirectory", "/opt/coldfusionmx/wwwroot");
    props.setProperty("logMaximumSize", "10");

    proprequest.setProperty( "ccAuthService_run", "true" );
    proprequest.setProperty( "merchantReferenceCode", "MRC-14344" );
    proprequest.setProperty( "merchantID", "yourmerchantid" );

    proprequest.setProperty( "billTo_firstName", "John" );
    proprequest.setProperty( "billTo_lastName", "Doe" );
    proprequest.setProperty( "billTo_street1", "1295 Charleston Road" );
    proprequest.setProperty( "billTo_city", "Mountain View" );
    proprequest.setProperty( "billTo_state", "CA" );
    proprequest.setProperty( "billTo_postalCode", "94043" );
    proprequest.setProperty( "billTo_country", "US" );
    proprequest.setProperty( "billTo_email", "nobodycybersource.com" );
    proprequest.setProperty( "billTo_ipAddress", "10.7.7.7" );
    proprequest.setProperty( "billTo_phoneNumber", "650-965-6000" );
    proprequest.setProperty( "shipTo_firstName", "Jane" );
    proprequest.setProperty( "shipTo_lastName", "Doe" );
    proprequest.setProperty( "shipTo_street1", "100 Elm Street" );
    proprequest.setProperty( "shipTo_city", "San Mateo" );
    proprequest.setProperty( "shipTo_state", "CA" );
    proprequest.setProperty( "shipTo_postalCode", "94401" );
    proprequest.setProperty( "shipTo_country", "US" );
    proprequest.setProperty( "card_accountNumber", "4111111111111111" );
    proprequest.setProperty( "card_expirationMonth", "12" );
    proprequest.setProperty( "card_expirationYear", "2020" );
    proprequest.setProperty( "purchaseTotals_currency", "USD" );

    proprequest.setProperty( "purchaseTotals_grandTotalAmount", "56.78" );

    stringhash=proprequest.toString();
    </cfscript>

    <cfoutput><br> #stringhash#<br></cfoutput>
    <cfset response=clientobj.runTransaction(proprequest, props)>
    <cfset stringhash=response.toString()>
    <cfoutput><br> #stringhash#<br></cfoutput>

    I've basically done 2 things here that are a little different. I've created a
    seperate properties object and fill out the properties in it. I then use this
    object when I call runTransaction. This is a change from typically reading the
    properties from the file.

    The second thing I've done is use the java properties class instead of the
    java hashMap for the request. It turns out coldfusion converts all the keys in
    the hashMap to lowercase, and these values are case sensitive. Since properties
    inherits from hashMap this seems to work fine. For some reason coldfusion does
    not change the values in properties to lowercase.

    I've run this sample program and am able to run the transaction sucessfully
    through coldfusion using the CyberSource Java SOAPI CDK.

    Please let me know if you have further questions.

    onlinepayments Guest

  14. #14

    Default Re: ColdFusion + Java Guru Install Cybersource Java Api



    onlinepayments wrote:
    > Hi All, I work at CyberSource in the support department, and have been able to
    > get ColdfusionMX 6.0 to work with the CyberSource Java SOAPI CDK. I am using
    > the linux version of Coldfusion.
    >
    > I'm defintely not a Coldfusion expert, but below are the steps I took to get
    > it to work:
    > 1 - Modified the jvm.config file in the bin directory to look like below:
    > # JVM classpath
    >
    > java.class.path=/home/simapijava/simapi-2.0.0/lib/cybsclients.jar,/home/simapija
    > va/simapi-2.0.0/lib/cybssecurit
    >
    > y.jar,/home/simapijava/simapi-2.0.0/lib/xalan.jar,/home/simapijava/simapi-2.0.0/
    > lib/xercesImpl.jar,/home/s
    >
    > imapijava/simapi-2.0.0/lib/xml-api.jar,{application.home}/lib,{application.home}
    > /runtime/lib/jrun.jar,{application.home}/
    > runtime/lib
    >
    > The xerces version that comes with the CDK is the important portion here, as
    > it is required in order to sign the soap message with the RSA libraries that
    > are part of the client. If any other xerces version is used besides the one
    > included in the CDK, then it will fail with the java.lang.null that is commonly
    > seen.
    >
    > 2. You would then restart the coldfusion server.
    >
    > 3. Below is the sample code that I'm using. This does not do any exception
    > handling and basically just runs a transaction.
    >
    > <cfobject action="create" type="java" class="java.util.Properties"
    > name="proprequest">
    > <cfobject action="create" type="java" class="java.util.HashMap"
    > name="response">
    > <cfobject action="create" type="java" class="java.util.Properties"
    > name="props">
    > <cfobject action="create" type="java" class="com.cybersource.ws.client.Client"
    > name="clientobj">
    > <cfobject action="create" type="java" class="java.lang.String"
    > name="stringhash">
    >
    > <cfscript>
    > props.setProperty("merchantID", "yourmechantid");
    > props.setProperty("targetAPIVersion", "1.13");
    > props.setProperty("keysDirectory",
    > "/home/simapijava/simapi-2.0.0/keys");
    > props.setProperty("sendToProduction", "false");
    > props.setProperty("enableLog", "false");
    > props.setProperty("logDirectory", "/opt/coldfusionmx/wwwroot");
    > props.setProperty("logMaximumSize", "10");
    >
    > proprequest.setProperty( "ccAuthService_run", "true" );
    > proprequest.setProperty( "merchantReferenceCode", "MRC-14344" );
    > proprequest.setProperty( "merchantID", "yourmerchantid" );
    >
    > proprequest.setProperty( "billTo_firstName", "John" );
    > proprequest.setProperty( "billTo_lastName", "Doe" );
    > proprequest.setProperty( "billTo_street1", "1295 Charleston Road" );
    > proprequest.setProperty( "billTo_city", "Mountain View" );
    > proprequest.setProperty( "billTo_state", "CA" );
    > proprequest.setProperty( "billTo_postalCode", "94043" );
    > proprequest.setProperty( "billTo_country", "US" );
    > proprequest.setProperty( "billTo_email", "nobodycybersource.com" );
    > proprequest.setProperty( "billTo_ipAddress", "10.7.7.7" );
    > proprequest.setProperty( "billTo_phoneNumber", "650-965-6000" );
    > proprequest.setProperty( "shipTo_firstName", "Jane" );
    > proprequest.setProperty( "shipTo_lastName", "Doe" );
    > proprequest.setProperty( "shipTo_street1", "100 Elm Street" );
    > proprequest.setProperty( "shipTo_city", "San Mateo" );
    > proprequest.setProperty( "shipTo_state", "CA" );
    > proprequest.setProperty( "shipTo_postalCode", "94401" );
    > proprequest.setProperty( "shipTo_country", "US" );
    > proprequest.setProperty( "card_accountNumber", "4111111111111111" );
    > proprequest.setProperty( "card_expirationMonth", "12" );
    > proprequest.setProperty( "card_expirationYear", "2020" );
    > proprequest.setProperty( "purchaseTotals_currency", "USD" );
    >
    > proprequest.setProperty( "purchaseTotals_grandTotalAmount", "56.78" );
    >
    > stringhash=proprequest.toString();
    > </cfscript>
    >
    > <cfoutput><br> #stringhash#<br></cfoutput>
    > <cfset response=clientobj.runTransaction(proprequest, props)>
    > <cfset stringhash=response.toString()>
    > <cfoutput><br> #stringhash#<br></cfoutput>
    >
    > I've basically done 2 things here that are a little different. I've created a
    > seperate properties object and fill out the properties in it. I then use this
    > object when I call runTransaction. This is a change from typically reading the
    > properties from the file.
    >
    > The second thing I've done is use the java properties class instead of the
    > java hashMap for the request. It turns out coldfusion converts all the keys in
    > the hashMap to lowercase, and these values are case sensitive. Since properties
    > inherits from hashMap this seems to work fine. For some reason coldfusion does
    > not change the values in properties to lowercase.
    >
    > I've run this sample program and am able to run the transaction sucessfully
    > through coldfusion using the CyberSource Java SOAPI CDK.
    >
    > Please let me know if you have further questions.

    We're having this same problem with the null pointer exception. We
    removed the xerces jar file and it was unable to load the xerces class,
    so we're certain we're using the correct one. Any ideas as to how to
    get rid of the null pointer?

    Bill Simpson Guest

  15. #15

    Default Re: ColdFusion + Java Guru Install Cybersource Java Api

    Thank you for taking the time to try and solve this. I tried your suggestion
    and I'm still getting the following error:

    "The system has attempted to use an undefined value, which usually indicates a
    programming error, either in your code or some system code.
    Null Pointers are another name for undefined values."

    The only differences between my set up and what you suggested is:
    - I'm using ColdFusion MX 6.1 on Windows
    - Instead of "/home/simapijava/" -- I'm using -- "d:/simapijava/" throughout
    where applicable

    Do you have a windows box you could test it on? The error is occuring on the
    clientobj.runTransaction(proprequest, props) call. My javaclass paths are
    exactly the same and in the same order.

    Any help is greatly appreciated.

    cfprince Guest

  16. #16

    Default Re: ColdFusion + Java Guru Install Cybersource Java Api

    Bank of America dropped a huge bomb on me by forcing their merchant accounts to
    go to Cybersource only to find that ColdFusion cannot create subscriptions
    using the Hosted Order Page (FORM post). I'm now forced into programming an
    API which will add a huge layer of support issues and extra coding.

    So, I'm now instead looking into just changing companies altogether to
    Authorize.NET or VeriSign. Has anyone had any issues with going to these guys
    using CF form pages to submit and return result coding via CFM pages
    exclusively? Any suggestions on these or other companies with good support and
    good online management features?

    Thanks!:disgust;:|:Q

    MarcMataya Guest

  17. #17

    Default Re: ColdFusion + Java Guru Install Cybersource Java Api

    I too was just told by the Client that is using Bank of America, to switch to
    Cybersource as well. I found this thread and I am already not happy just from
    reading the posts. I have implemented Authorize.net on several sites and it is
    very straight forward. I am using the "cf_openauthnet" custom tag and have had
    great success with it.

    I too am going to struggle with Cybersource and see if I can get it to work
    and will post back if I encounter anything.

    Vance Duke Guest

  18. #18

    Default Re: ColdFusion + Java Guru Install Cybersource Java Api

    I am using authorize.net and it works great ..
    I am actually using it together with a cold fusion shopping cart called
    CFWEBSTORE ..
    As a setting into the credit card authorization you can choose authorize.net
    and the rest is simple stuff ..
    Site is working and doing well ..

    I also got the cybersource code to work, however it took a lot of work (open
    ports on firewall, tweak the .net api, etc ..

    atahualpa Guest

  19. #19

    Default Re: ColdFusion + Java Guru Install Cybersource Java Api

    Just wondering, since BofA said you must use CyberSource, what is BofA and/or Cybersource charging for this solution (monthly fees)?
    Steve Guest

  20. #20

    Default Re: ColdFusion + Java Guru Install Cybersource Java Api

    cfprince,
    Did you ever get this to work? I am at the same exact point as you were back
    in June and I'm stuck on the null pointer issue that you were. I did get it to
    work running the runSample.bat file so I know it *can* work I jsut don't know
    how to get it to work from ColdFusion.

    stymie Guest

Page 1 of 2 12 LastLast

Similar Threads

  1. [JAVA] - To Make training of JAVA, help me Underestand FLEX and AS 3.0 ?
    By Eduardo Burko - Dotmidia in forum Macromedia Flex General Discussion
    Replies: 0
    Last Post: August 31st, 02:33 PM
  2. #25651 [Bgs]: mixing --with-java and --enable-debug pull out java
    By fperez at tuzsa dot es in forum PHP Development
    Replies: 0
    Last Post: September 26th, 06:26 AM
  3. #25651 [NEW]: mixing --with-java and --enable-debug pull out java
    By fperez at tuzsa dot es in forum PHP Development
    Replies: 0
    Last Post: September 25th, 07:04 AM
  4. Replies: 0
    Last Post: August 8th, 11:18 AM
  5. Replies: 0
    Last Post: August 2nd, 08:07 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139