Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8095007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:58:53+00:00 2026-06-05T20:58:53+00:00

I have to expose an ejb service layer via jax-ws . I have generated

  • 0

I have to expose an ejb service layer via jax-ws .

I have generated the web service using jax-ws and wsimport but I’m stopped by a strange things ; Date are being mapped to XmlGregorianCalendar .
Is it possible to use classic java Date instead ?
Can you show me the right way to proceed ?

Thanks .
Edit:
this the binding file i used :
thanks , I modified slightly your xml and attached it with netbeans to the client’s webservice and it worked . This the binding I used :

<jaxws:bindings  node="wsdl:definitions/wsdl:types/xsd:schema"
                 xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"

                                xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"

                                xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"

                                xmlns:xsd="http://www.w3.org/2001/XMLSchema" wsdlLocation="../wsdl/localhost_8080/web_test/Testor.wsdl" >


 <jaxb:globalBindings>
          <jaxb:javaType   name="java.util.Date"
        xmlType="xsd:dateTime"
        parseMethod="lol.XsdDateTimeConverter.unmarshal"
        printMethod="lol.XsdDateTimeConverter.marshalDateTime"        
          /><jaxb:javaType 
        name="java.util.Date"
        xmlType="xsd:date"
        parseMethod="lol.XsdDateTimeConverter.unmarshal"
        printMethod="lol.XsdDateTimeConverter.marshalDate"
        />
      </jaxb:globalBindings>


</jaxws:bindings>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T20:58:55+00:00Added an answer on June 5, 2026 at 8:58 pm

    Not tested, but should work. First create such class:

    import javax.xml.bind.DatatypeConverter;
    
    public class XsdDateTimeConverter {
    
        public static Date unmarshal(String dateTime) {
            return DatatypeConverter.parseDate(dateTime).getTime();
        }
    
        public static String marshalDate(Date date) {
            final GregorianCalendar calendar = new GregorianCalendar();
            calendar.setTime(date);
            return DatatypeConverter.printDate(calendar);
        }
    
        public static String marshalDateTime(Date dateTime) {
            final GregorianCalendar calendar = new GregorianCalendar();
            calendar.setTime(dateTime);
            return DatatypeConverter.printDateTime(calendar);
        }
    
    }
    

    Then add this to custom xjb file:

    <javaType
            name="java.util.Date"
            xmlType="xs:dateTime"
            parseMethod="XsdDateTimeConverter.unmarshal"
            printMethod="XsdDateTimeConverter.marshalDateTime"
            />
    <javaType
            name="java.util.Date"
            xmlType="xs:date"
            parseMethod="XsdDateTimeConverter.unmarshal"
            printMethod="XsdDateTimeConverter.marshalDate"
            />
    </globalBindings>
    

    Not tested, but should work. Based on my answer here: JAX-WS and Joda-Time?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an existing web service and I want it to expose 2 MEX
I have been requested to expose a web service for managing Active Directory Users
I have a class that I wish to expose as a remote service using
I have a WCF service that needs to expose a custom collection to it's
I have a WCF based service that I use to expose AJAX functionality. Sometimes
I have a simple WCF Data Services service and I want to expose a
I have a WCF service and have to expose an interface as datacontract. There
I have a public EJB class that I want accessible online as a web
I have a EAR package that contains a web module and EJB. The EJB
Lots of frameworks let me expose an ejb as a webservice. But then 2

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.