Monday, March 16, 2009
Netsuite web service and ColdFusion 8
I will readily admit that it is possible I am missing something in this problem. There could very well be a timeout issue with ColdFusion compiling the stub classes, but it doesn't throw an error. And while you can easily adjust the timeout for WSDL2Java from the command line, I am not aware of a way to increase the timeout in the ColdFusion Administrator. If anyone else is aware of a way to do this, I'd love to hear from you in the comments or an email. If I get an answer, I'll be certain to post it here.
Sunday, February 15, 2009
Apache Axis (java.io.IOException: Non nillable element '[ElementName]' is null)
Solution
My first course of action was to upgrade to Axis 1.4. No dice. I still was getting the same error. My next step was to delete the jar file I'd made of the WSDL classes from the CFusionMX7/lib directory (if you've read previous posts here regarding ColdFusion and its interactions with Axis, you understand why I tend to lean toward that method instead of using the auto-compiled stub classes in the ColdFusion installation directory), added the stub class file directory I was using to the Java classpath in ColdFusion administrator, and restarted the CF service. Blam! Problem fixed.
Post Mortem
To be honest, I am not 100% certain what the issue was, but I strongly suspect this was an issue between the version of Java that had compiled the Axis jar file distribution, the version of Java our ColdFusion installation was running on, and/or the version of Java I had used to manually compile the stub class jar file I had been using previously. If anyone else has had this issue and has further details into the "why" of the fix, I'd love to hear them.
Thursday, May 29, 2008
Automatic page refreshes are so 1998
To eliminate any confusion, the type of page refresh I'm talking about includes those in <meta ...> tags and javascript setTimeout() and setInterval() calls that unceremoniously reload the entire page you are viewing. Why in this day and age of RSS, AJAX, Flash, and hell, even iframes would you still use auto-refreshes? I will concede that there might continued value for mobile versions of websites where timely delivery of information is key (think live sports scores and stock prices), as there are still a great number of mobile devices that do not support Flash (iPhone anyone?). But taking away a reader's choice in the age of Web 2.0 and ubiquitous connectivity tells me that you just don't get it.
Wednesday, April 16, 2008
Process for generating Netsuite java files, compiling stub classes, and creating jar file
If you've read other posts I've done about ColdFusion and Netsuite integration, you may recall that I solved an issue with MX7 refusing to compile all of the necessary stub files from the Netsuite WSDL by manually compiling them and creating a jar file. This used to be a huge hassle for me each time Netsuite released an upgrade. This time, however, it should be a ridiculously smooth process. I know the following steps will look intimidating if you are not familiar with Apache ANT or Apache Ivy, but trust me, they will make your life a lot easier.
Someone recently wrote me with some questions about this process, and I thought I would post this for everyone's benefit. Or at least I hope it's for your benefit and not your additional confusion. *grin*
Oh, and a couple of notes. I have not done any development in ColdFusion 8, so some of the steps and issues below may not apply. In fact, this entire process may not be necessary at all for all I know. Also I'm quite green when it comes to ANT and Ivy, so as with everything else I post here, if there is a more efficient way to any of these steps, I'd love to hear from you.
Assumptions for this process (modify as necessary for your environment):
- [Netsuite WSDL version] = 2_6_0
- [CF install path] = C:\CFusionMX7
- You are using ColdFusion MX 7 (Notes for ColdFusion 8 will be given where necessary)
- [java install path] = C:\j2sdk1.4.2_12
- [major java version that your CF installation uses] = 1.4
- [stub class target] = C:\netsuiteclasses\2_6_0
- [Apache Axis version] = 1.2.1
Prerequisites:
- You have Apache ANT 1.7.0 or higher installed and have all environment variables set per its installation documentation. (Download binaries and see documentation at http://ant.apache.org/)
- You have Apache Ivy 2.0.0 beta 2 or higher installed and have all environment variables set per its installation documentation. (Download binaries and see documentation at http://ant.apache.org/ivy/)
- A version of the java jdk compatible with the java runtime version of your ColdFusion installation.
- NOTE: This item is only for ColdFusion MX7 and likely does not apply to ColdFusion 8. A modified version of the Apache Axis 1.2 jar file (axis.jar) (distributed by Netsuite to fix a login issue caused by how cookies are passed by Axis in the HTTP header) was copied into [CF install path]\lib, and the ColdFusion server was restarted afterward.
Generate and Compile Process:
1. Generate java class source code (windows dos window).
[java install path]\bin\java -cp [CF install path]\runtime\lib\wsdl2java.jar org.apache.axis.wsdl.WSDL2Java -v -O 120 -a -o [stub class target] https://webservices.netsuite.com/wsdl/[Netsuite WSDL version]/netsuite.wsdl
2. Create Apache ANT build file.
Create a file named build.xml in [stub class target] with the following contents (pay attention to bracketed areas that you will need to modify accordingly):
<?xml version="1.0" encoding="UTF-8"?>
<project name="netsuite_[Netsuite WSDL Version]" default="init" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<description>
Build file for Netsuite [Netsuite WSDL Version] WSDL.
</description>
<property name="classes.dir" location="classes" />
<property name="dist.dir" location="dist" />
<property name="dist.jarfile" value="netsuite_[Netsuite WSDL Version].jar" />
<target name="resolve" description="--> retrieve dependencies with ivy">
<ivy:retrieve pattern="${lib.dir}/[type]/[artifact]-[revision].[ext]" conf="runtime"/>
</target>
<target name="clean" description="Clean up output directories.">
<delete dir="${classes.dir}" />
</target>
<target name="compile" depends="-init" description="Compile all sources.">
<mkdir dir="${classes.dir}" />
<javac srcdir="." destdir="${classes.dir}" debug="true" deprecation="true">
<compilerarg line="-source [major java version that your CF installation uses]" /> <!—NOTE: The “-source” option may not be necessary for CF8 -->
<compilerarg line="-classpath [CF install path]\lib\axis.jar; [CF install path]\lib\jaxrpc.jar" />
</javac>
</target>
<target name="rebuild" depends="clean,compile" description="Cleanly compiles all sources." />
<target name="-init">
<!-- Create the time stamp. -->
<tstamp>
<format property="TODAY_US" pattern="dd MMM yyyy HH.mm" locale="en_US" />
</tstamp>
</target>
<target name="dist" depends="rebuild" description="Creates the binary distribution.">
<mkdir dir="${dist.dir}/${TODAY_US}" />
<jar basedir="${classes.dir}" destfile="${dist.dir}/${TODAY_US}/${dist.jarfile}" />
</target>
</project>
3. Create Apache Ivy config file.
Create a file named ivy.xml in [stub class target] with the following contents (pay attention to bracketed areas that you will need to modify accordingly):
<ivy-module version="2.0">
<info organisation="apache" module="hello-ivy"/>
<dependencies>
<dependency org="apache" name="axis" rev="[Apache Axis version]"/>
</dependencies>
</ivy-module>
4. Compile files and generate jar file.
Open a Command Prompt window and change directories to your [stub class target] directory and run the following command:
ant dist
You may see multiple warning messages throughout the compile process, but as long as you see a BUILD SUCCESSFUL message upon completion, there shouldn’t be any problems. Copy the generated jar file (the output of the ant command should indicate the filename and location of the jar file) to [CF install path]\lib and restart your ColdFusion Application Server service.
Wednesday, March 12, 2008
Jeremy to Microsoft Live "quality" bot: you're doing it wrong
Wednesday, February 27, 2008
Save yourself the effort of defining the same code for multiple javascript events
e.g.
// define the onchange event and call the same code for onmouseover, onmouseout, and onclick
// Now if you make changes to onchange, you don't need to copy those changes to the other events.
<input ... onchange="myFunctionDoYouLikeIt(this, 'valueadded', false, 0); compareSomeValues('placeholder', false, true, 'the google webz');"
onmouseover = "eval(this.onchange + '\;anonymous()\;');"
onmouseout = "eval(this.onchange + '\;anonymous()\;');"
onclick = "eval(this.onchange + '\;anonymous()\;');" />
Friday, February 22, 2008
Combine multiple Twitter feeds on Blogger
Oh, and I probably will have to find a paid host, so if you are a user of this widget and would like to help out, a donation would be appreciated (the Donate button is in the right hand column on this page).
UPDATE 1/25/2009: I have received a few feature and bug fix requests. That list is available here. I have a fairly packed schedule through the spring and mid-summer of 2009, so it may be quite some time before I am able to complete these. But you are welcome to download a copy of the code, add these or other features you'd like to see, and fire it back to me. This code is non-commercial, not-for-profit open source, so I will gladly give full credit to whomever contributes code if I decide to include it in the version that is distributed here. And while this is not-for-profit, if you should wish to thank me for the time I've invested in this project, I am happy to accept even the smallest PayPal donation (see the Donate button to the right on this page). ;-) And now back to the original post.
This Blogger widget I created is based on the original widget provided by Twitter. This one, however, will let you combine multiple users' feeds into one and sort them by time. This is as opposed to showing your entire timeline, including everyone you follow. Perhaps someone has already written something like this, but damned if I could find it. Constructive criticism is welcome, particularly since this is my first crack at creating a blogger widget.
Configure and add the widget here.
I promise to post more documentation for this feature later, as there are other nifty things you can do to control the style of the output, including creating a "mask" to define the format of your output, and inclusion of data like the user profile, user homepage link, user profile image, etc.
Caveats: The number you are defining in the form does NOT mean that only the last n posts from your pool of users will appear. It means that the last n posts from each user will be shown. For example, you've set the twitter number to 3. User1 posted a single twitter 4 days ago, but User2 posted 4 twitters today alone. You will see the last 3 posts from User1 and the last 3 posts from User2.
