Archive for October, 2009
Games: Fallout 3 Hacking Minigame Solver
Oct 29th
I’ve added my Fallout 3 Solver back to the website, so if you were having trouble finding it before it is back now.
For those that haven’t used it before: In Fallout 3 there are computer terminals all around the world. To access some of them you have to pass a “hacking” puzzle. Sometimes its fun to play this out and try and solve the puzzle manually. However, often I really needed what was in the next room and the door was controlled by the computer.
To ensure that I didn’t lose my chances, I wrote this solving tool.
The tool has percentages based upon how common the letters are in it. For example, the letter e is the most common letter in the English language. It seems to me then that a word with an e in it is more likely to occur than a word with no e’s in it. That being said, the percentages are just for fun.
Enjoy and leave me comments!
WSDL2Java with Maven – Fixing “BadCommandLineException: grammar is not specified”
Oct 28th
At my job, we use the wsdl2java maven plugin to generate the appropriate classes from the webservices’ wsdl document. When we received notice that we were to incorporate a new webservice into the system, we thought “No big deal, we’ll just use the plugin and be off!”
Unfortunately, we ran into the dreaded “com.sun.tools.xjc.BadCommandLineException: grammar is not specified” error. After inspecting the code I couldn’t find any issue. The wsdl was right there, and it didn’t reference any outside xsds or anything? What’s the problem?
I did a google search. Found some interesting threads from nabble that had nothing to do with my problem. Eventually, I found that (with a misleading name) the wsdl2java plugin doesn’t automatically pickup xsds. If you are pointed to a directory that has XSDs (usually referenced by the actual wsdl files) it will autogen from those. But if your xsd are in a subdirectory (or not needed for such a simple webservice) then wsdl2java blows up with the grammar error.
I ended up the following in my pom:
<plugin>
<groupId>com.sun.tools.xjc.maven2</groupId>
<artifactId>maven-jaxb-plugin</artifactId>
<executions>
<execution>
<!-- This one has the xsd's in the same directory, so it was already working -->
<id>simple-xsd-wsdl2java</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<!-- directory of the wsdls and the xsds -->
<schemaDirectory>src/main/wsdl/simple</schemaDirectory>
<generateDirectory>src/autogen/simple</generateDirectory>
<readOnly>true</readOnly>
</configuration>
</execution>
<execution>
<!-- This one was only the WSDL files, with no external XSDs -->
<id>wsdlOnly-wsdl2java</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<!-- directory of the wsdl files -->
<schemaDirectory>src/main/wsdl/wsdlOnly</schemaDirectory>
<generateDirectory>src/main/autogen/wsdlOnly</generateDirectory>
<readOnly>true</readOnly>
<includeSchemas>
<!-- Each schema has to be spelled out as an includedSchema, or it will be ignored -->
<includeSchema>AccountService.wsdl</includeSchema>
<includeSchema>SystemService.wsdl</includeSchema>
<includeSchema>GiftService.wsdl</includeSchema>
</includeSchemas>
<!-- Indicates to the grammar parser that the schema files are in the wsdl format -->
<args>-wsdl</args>
</configuration>
</execution>
</executions>
</plugin>
Notice that in the wsdlOnly configuration I have specifed each schema file separately. I think there is a way to specify a directory/wildcard search, but I didn’t spend the time figuring it out. The other immensely important part is adding the args section. This tells the parser that the files are in wsdl format, not in XSD.
I hope that this helps anyone out there looking for a way to auto generate class files to use with SpringWS from stand-alone wsdl files.