WebObjects/Web Services/Common Pitfalls and Troubleshooting
NullPointerException calling WebService with Axis
[edit | edit source]If you get an exception like the following:
Caused by: java.lang.NullPointerException at java.util.Hashtable.put(Hashtable.java:396) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.setProperty(SAXParserImpl.java:395) at org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:246) at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:538) at org.apache.axis.Message.getSOAPEnvelope(Message.java:376) at org.apache.axis.client.Call.invokeEngine(Call.java:2583) at org.apache.axis.client.Call.invoke(Call.java:2553) at org.apache.axis.client.Call.invoke(Call.java:2248) ... 5 more
It's most likely because you are using Java 1.5 with Axis 1.1. If you want your client to run on Java 1.5, you will need to upgrade to Axis 1.2RC2.
SAXParseException when using HTTPS
[edit | edit source]If, in WebObjects 5.4.x, you get an exception connecting to your web service via HTTPS (through the WebObjects Apache adaptor) and get an error like the following:
org.xml.sax.SAXParseException: Premature end of file. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)) ... more
You will need to add additional information to the file server.wsdd to tell Apache AXIS what to do when it believes the transport mechanism is 'https.' AXIS will make this determination based on the HTTP header information forwarded by the Apache WebObjects adaptor. If no entry is made to tell AXIS how to handle 'https', it will assume the incoming data from the adaptor is encrypted via SSL, even though the communication between the adaptor and the instance is in the clear. To change the behavior of AXIS, change the file server.wsdd from:
<transport name="http"> <requestFlow> <handler type="HTTPActionHandler"/> <handler type="URLMapper"/> </requestFlow> </transport>
To:
<transport name="http"> <requestFlow> <handler type="HTTPActionHandler"/> <handler type="URLMapper"/> </requestFlow> </transport> <transport name="https"> <requestFlow> <handler type="HTTPActionHandler"/> <handler type="URLMapper"/> </requestFlow> </transport>
Losing Session with Axis Client
[edit | edit source]For more information about cookie-based sessions with Axis clients, read the Consuming with Axis in Java section.