File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes [Axis] Problems with java.sql.Timestamp namespace Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Web Services
Reply Bookmark "[Axis] Problems with java.sql.Timestamp namespace" Watch "[Axis] Problems with java.sql.Timestamp namespace" New topic
Author

[Axis] Problems with java.sql.Timestamp namespace

Bruno Barocco
Greenhorn

Joined: Jul 19, 2006
Posts: 2
Hi @all,

I have generate a wsdl file with the java2wsdl tool from apache axis.

Now i try to generate the skeletons with wsdl2java, but the wsdl contains following namespace declaration:

xmlns:tns2="http://sql.java"

and

<import namespace="http://sql.java"/>

if i start the tool, the following exception is thrown:

java.io.IOException: Type {http://sql.java}Timestamp is referenced but not defi
ed.at org.apache.axis.wsdl.symbolTable.SymbolTable.checkForUndefined(Symbo
Table.java:665)

Has anyone a idea, what is the problem?

thanks in advanced

bruno
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2906
Originally posted by Bruno Barocco:

I have generate a wsdl file with the java2wsdl tool from apache axis.


This is were your problem starts. java.sql.Timestamp can only be understood by systems with the Java platform. Furthermore both the client and server will have to use a common serializer/deserializer for this type. There is no standard mapping for java.sql.Timestamp to XML and Axis doesn't seem to provide a serializer/deserializer for it - in which case you would have to write your own. These are the options available to you.
  • Write a custom axis serializer/deserializer.
  • Convert the timestamp to a java type that has a standard mapping as specified in Java API for XML-Based RPC (JAX-RPC) Specification 1.1 (JSR-101); Section: 5. Java to XML/WSDL Mapping like java.lang.String or java.util.Date.
  • Simply design your service WSDL-first and use the supported XSD types as outlined in Java API for XML-Based RPC (JAX-RPC) Specification 1.1 (JSR-101); Section: 18. Appendix: XML Schema Support (This is the preferred solution). Though "SOAP" initially included the word "Object" in its now abandoned expansion, Web Services really are only XML-based messaging systems - they are not an effective object remoting solution. Distill the data of your objects on one end, send the data to the other end, and then reconstitute the objects in a manner that is supported by the underlying platform.


  • "Don't succumb to the false authority of a tool or model. There is no substitute for thinking."
    Andy Hunt, Pragmatic Thinking & Learning: Refactor Your Wetware p.41
    Bruno Barocco
    Greenhorn

    Joined: Jul 19, 2006
    Posts: 2
    Hi Peer,

    Thanks for your answer, you see i am a webservice beginner.

    so i get already the next problem.

    The generated sources are incompatible to the business classes, for example:

    i have a class:

    com.x.Link

    the wsdl2java generate:

    com.x.ws.Link

    but these both classes are incompatible(not the same interface or subtype). Its very expensive to write all Wrapper classes manual. Do you know a pattern, or what is the best practice solution in this case?

    greetings
    Peer Reynders
    Bartender

    Joined: Aug 19, 2005
    Posts: 2906
    Most likely your business classes and operations are too fine-grained for a Web Service. The are many "calculator" Web Services in tutorials � however those WS are not representative of what WS should be used for � submitting an entire XML purchase order is more like it.
    WebServices versus EJB

    Once you operate at a higher level of granularity there will probably be less wrapper code to write and maintain. You can also use JAXB to alleviate the object -> XML -> object conversion coding burden somewhat.
    Java Architecture for XML Binding (JAXB) FAQs
    JAXB 2.0 Project
    Using JAXB: Basic Examples

    Patterns and Strategies for Building Document-Based Web Services
    3.7 Handling XML Documents in a Web Service
    4.3 Designing XML-Based Applications
     
    I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
     
    subject: [Axis] Problems with java.sql.Timestamp namespace
     
    Similar Threads
    WSDL2Java Error
    Invoking CrmService from Java Client problem
    Generating with axis-java2wsdl a WSDLwith 2 PortType
    Calling Axis-Ant targets
    Generate Client Stub Using Axis