Convert xsd:string into xsd:date in BPEL

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Convert xsd:string into xsd:date in BPEL

azielinski
Hello,

I have two services. One service delivers a date as xsd:string to me and in
the BPEL process I want to assign this to next web service call, which
expects a xsd:date.
Is it possible to convert in an assign element this format? If so, how can I
manage this?

Thanks in advance!
Regards,
Andre



--
Sent from: http://openesb-community-forum.794670.n2.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: Convert xsd:string into xsd:date in BPEL

vishnu.piskala
Hello Andre

You can use a Java static call to format the string to the standard xsd:date format. Invoke this java static method from BPEL assign. Bundle the java in a jar and place the jar in server classpath or in the same folder as .bpel file.

Regards
Vishnu
www.logicoy.com

-----Original Message-----
From: User <[hidden email]> On Behalf Of azielinski
Sent: Monday, March 26, 2018 5:40 PM
To: [hidden email]
Subject: [User] Convert xsd:string into xsd:date in BPEL

Hello,

I have two services. One service delivers a date as xsd:string to me and in the BPEL process I want to assign this to next web service call, which expects a xsd:date.
Is it possible to convert in an assign element this format? If so, how can I manage this?

Thanks in advance!
Regards,
Andre



--
Sent from: http://openesb-community-forum.794670.n2.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: Convert xsd:string into xsd:date in BPEL

azielinski
Hello Vishnu,

Thanks for your quick response.
This was also my first idea, but the static function didn't show up in the
BPEL process.

I tried this one:
    public static java.sql.Date getDate_v1() {
        return new
java.sql.Date(Calendar.getInstance().getTime().getTime());
    }

and this one:
    public static XMLGregorianCalendar getDate_v2() {
       
        XMLGregorianCalendar xcal = null;
        try {
            xcal =
DatatypeFactory.newInstance().newXMLGregorianCalendar("2015-08-08T18:46:16.6Z");
        } catch (DatatypeConfigurationException ex) {
            Logger.getLogger(Tool.class.getName()).log(Level.SEVERE, null,
ex);
        }
       
        return xcal;
    }

Maybe the xsd:date is represented by another Java type.

Regards,
Andre



--
Sent from: http://openesb-community-forum.794670.n2.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: Convert xsd:string into xsd:date in BPEL

support

Hello Andree

 

You and Vishnu are right: the Java static method is a good idea.

Nevertheless, you cannot see your method since the BPEL only retains the methods with a String as returned argument.

Now in an XSD definition, a date is just a restriction of "simpleType" as is the String.

 

So when you map your Java result to an XML Date you have to provide a String. (XML schema is not working on datatype but on restriction)

 

So, in your Java Method create your date transform it in String with the correct format then return this "String". Then use the mapper to assign the returned value to your BPEL variable  

 

Let us know if it is useful.

 

Pymma support

www.pymma.com

 

-----Original Message-----
From: User <[hidden email]> On Behalf Of azielinski
Sent: 26 March 2018 13:40
To: [hidden email]
Subject: Re: [User] Convert xsd:string into xsd:date in BPEL

 

Hello Vishnu,

 

Thanks for your quick response.

This was also my first idea, but the static function didn't show up in the BPEL process.

 

I tried this one:

    public static java.sql.Date getDate_v1() {

        return new

java.sql.Date(Calendar.getInstance().getTime().getTime());

    }

 

and this one:

    public static XMLGregorianCalendar getDate_v2() {

       

        XMLGregorianCalendar xcal = null;

        try {

            xcal =

DatatypeFactory.newInstance().newXMLGregorianCalendar("2015-08-08T18:46:16.6Z");

        } catch (DatatypeConfigurationException ex) {

            Logger.getLogger(Tool.class.getName()).log(Level.SEVERE, null, ex);

        }

       

        return xcal;

    }

 

Maybe the xsd:date is represented by another Java type.

 

Regards,

Andre

 

 

 

--

Sent from: http://openesb-community-forum.794670.n2.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Convert xsd:string into xsd:date in BPEL

azielinski
Thanks for the hints. I will give it a try and let you know the result.

Regards,
Andre



--
Sent from: http://openesb-community-forum.794670.n2.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: [*** Possible SPAM ***] Re: Convert xsd:string into xsd:date in BPEL

Paul Perez
Administrator
Hello André
Did you success?

Paul


On 27 Mar 2018 at 09:17, <[hidden email]> wrote:

Thanks for the hints. I will give it a try and let you know the result.

Regards,
Andre



--
Sent from: http://openesb-community-forum.794670.n2.nabble.com/

www.pymma.com The best services on OpenESB