You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Phillip Baird <ph...@gmail.com> on 2007/08/09 00:49:59 UTC
DateTime format problem (was Re: Looking for suggestions on how to
troubleshot this webservice error?)
Have discovered how to log with interceptors and this has shown that the
string representation of the outgoing dateTime does not appear to be
"valid".
From the wsdl a field is mapped as xs:dateTime...
<xs:element msdata:Caption="Ship By" minOccurs="0" name="RequestDate"
type="xs:dateTime"/>
When this is received from the service it comes in as...
<RequestDate>2007-08-03T00:00:00.0000000+12:00</RequestDate>
When we send it back however its going out as...
<RequestDate>2007-08-03T00:00:00E-7+12:00</RequestDate>
We have confirmed that .Net cannot parse this format.
My question therefore is how can we change the outgoing format? As this
client code was built with wsdl2java I'm assuming JAXB is being used for
binding. Can anyone short circuit my search on how to override the
default marshalling for xs:dateTime?
thanks in advance
Phil
Re: DateTime format problem - solved
Posted by Phillip Baird <ph...@gmail.com>.
After many hours of searching I've discovered the original dateTime
marshalling problem was a bug in JAXP (see bug 6565321 -
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6565321).
So if you have problems marshalling dateTimes which contain fractional
seconds components then get hold of JAXP 1.4.2 and drop the two jars in
<jre>\lib\endorsed. Problem solved.
Thank you to James and others that assisted me today while chasing this.
/Phil
James Mao wrote:
> Hi Phil,
>
> Looks like a bug,
> Can you log an issue, turn on the -V to get the stack trace, and put
> it on the jira.
>
> https://issues.apache.org/jira/browse/CXF
>
> Thanks,
> James
Re: DateTime format problem (was Re: Looking for suggestions on how
to troubleshot this webservice error?)
Posted by James Mao <ja...@iona.com>.
Hi Phil,
Looks like a bug,
Can you log an issue, turn on the -V to get the stack trace, and put it
on the jira.
https://issues.apache.org/jira/browse/CXF
Thanks,
James
> This is what I changed the file to...
>
> <jaxws:bindings
> wsdlLocation="http://192.168.81.129/Services/SalesOrderService.asmx?WSDL"
> xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl"
> xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
> jaxb:version="2.0"
> >
> <jaxws:bindings
> node="wsdl:definitions/wsdl:types/xs:schema[@targetNamespace='http://epicor.com/webservices/']">
>
> <jaxb:globalBindings>
> <jaxb:javaType name="java.util.Date" xmlType="xs:dateTime"
>
> parseMethod="org.apache.cxf.tools.common.DataTypeAdapter.parseDateTime"
>
> printMethod="org.apache.cxf.tools.common.DataTypeAdapter.printDateTime"/>
> </jaxb:globalBindings>
> </jaxws:bindings>
> </jaxws:bindings>
>
> This got past the verion error but now complains about the XPATH
> query... org.apache.cxf.tools.common.ToolException: The xpath query
> identifies mutil or none target nodes with the query expression :
> //wsdl:definitions/wsdl:types/xs:schema[@targetNamespace='http://epicor.com/webservices/']
>
>
> The wsdl has...
>
> <wsdl:definitions targetNamespace="http://epicor.com/webservices/">
> <wsdl:types>
> <s:schema elementFormDefault="qualified"
> targetNamespace="http://epicor.com/webservices/">
> <xs:import namespace="http://epicor.com/schemas"/>
> <xs:element name="GetNewOrderHed">
> <xs:complexType>
> <xs:sequence>....
>
> the other schema element in the wsdl is...
>
> <s:schema elementFormDefault="unqualified"
> targetNamespace="http://epicor.com/schemas">
>
> JDK is 1.5
> CXF is from apache-cxf-2.0-incubator.zip
>
> Not sure if this will clarify things or not.
>
> thanks
>
> Phil
>
> James Mao wrote:
>> Strange, I can pass this without error, do you replace the
>> wsdlLocation and the targetNamespace?
>> What's the version of CXF are you using? what's the jdk version?
>>
>> Can you try with hello_world.wsdl in samples, just change one of the
>> type to xsd:dateTime, see if it works
>> If you still got errors, can you log an issue, just provide your
>> testcase, so i can reproduce
>>
>> Regards,
>> James
>
Re: DateTime format problem (was Re: Looking for suggestions on how
to troubleshot this webservice error?)
Posted by Phillip Baird <ph...@gmail.com>.
This is what I changed the file to...
<jaxws:bindings
wsdlLocation="http://192.168.81.129/Services/SalesOrderService.asmx?WSDL"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
jaxb:version="2.0"
>
<jaxws:bindings
node="wsdl:definitions/wsdl:types/xs:schema[@targetNamespace='http://epicor.com/webservices/']">
<jaxb:globalBindings>
<jaxb:javaType name="java.util.Date" xmlType="xs:dateTime"
parseMethod="org.apache.cxf.tools.common.DataTypeAdapter.parseDateTime"
printMethod="org.apache.cxf.tools.common.DataTypeAdapter.printDateTime"/>
</jaxb:globalBindings>
</jaxws:bindings>
</jaxws:bindings>
This got past the verion error but now complains about the XPATH
query... org.apache.cxf.tools.common.ToolException: The xpath query
identifies mutil or none target nodes with the query expression :
//wsdl:definitions/wsdl:types/xs:schema[@targetNamespace='http://epicor.com/webservices/']
The wsdl has...
<wsdl:definitions targetNamespace="http://epicor.com/webservices/">
<wsdl:types>
<s:schema elementFormDefault="qualified"
targetNamespace="http://epicor.com/webservices/">
<xs:import namespace="http://epicor.com/schemas"/>
<xs:element name="GetNewOrderHed">
<xs:complexType>
<xs:sequence>....
the other schema element in the wsdl is...
<s:schema elementFormDefault="unqualified"
targetNamespace="http://epicor.com/schemas">
JDK is 1.5
CXF is from apache-cxf-2.0-incubator.zip
Not sure if this will clarify things or not.
thanks
Phil
James Mao wrote:
> Strange, I can pass this without error, do you replace the
> wsdlLocation and the targetNamespace?
> What's the version of CXF are you using? what's the jdk version?
>
> Can you try with hello_world.wsdl in samples, just change one of the
> type to xsd:dateTime, see if it works
> If you still got errors, can you log an issue, just provide your
> testcase, so i can reproduce
>
> Regards,
> James
Re: DateTime format problem (was Re: Looking for suggestions on how
to troubleshot this webservice error?)
Posted by James Mao <ja...@iona.com>.
Strange, I can pass this without error, do you replace the wsdlLocation
and the targetNamespace?
What's the version of CXF are you using? what's the jdk version?
Can you try with hello_world.wsdl in samples, just change one of the
type to xsd:dateTime, see if it works
If you still got errors, can you log an issue, just provide your
testcase, so i can reproduce
Regards,
James
> Cannot get past.. WSDLToJava Error : Thrown by JAXB : JAXB version
> attribute must be present
>
> Tried adding jaxb:version="2.0" to the root jaxws:bindings element but
> this did not help.
>
> Any suggestions?
>
> thanks
>
> Phil
>
>
> James Mao wrote:
>> Hi Phil,
>>
>> Here is an example,
>>
>> <jaxws:bindings wsdlLocation="you wsdl location"
>> xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
>> xmlns:xs="http://www.w3.org/2001/XMLSchema"
>> xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
>> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
>> <jaxws:bindings
>> node="wsdl:definitions/wsdl:types/xs:schema[@targetNamespace='http://date.fortest.tools.cxf.apache.org/']">
>>
>> <jxb:globalBindings xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
>> xmlns:xs="http://www.w3.org/2001/XMLSchema">
>> <jxb:javaType name="java.util.Date" xmlType="xs:dateTime"
>>
>> parseMethod="org.apache.cxf.tools.common.DataTypeAdapter.parseDateTime"
>>
>> printMethod="org.apache.cxf.tools.common.DataTypeAdapter.printDateTime"/>
>>
>> </jxb:globalBindings>
>> </jaxws:bindings>
>> </jaxws:bindings>
>>
>>
>> Cheers,
>> James
>>
>
Re: DateTime format problem (was Re: Looking for suggestions on how
to troubleshot this webservice error?)
Posted by Phillip Baird <ph...@gmail.com>.
Cannot get past.. WSDLToJava Error : Thrown by JAXB : JAXB version
attribute must be present
Tried adding jaxb:version="2.0" to the root jaxws:bindings element but
this did not help.
Any suggestions?
thanks
Phil
James Mao wrote:
> Hi Phil,
>
> Here is an example,
>
> <jaxws:bindings wsdlLocation="you wsdl location"
> xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
> <jaxws:bindings
> node="wsdl:definitions/wsdl:types/xs:schema[@targetNamespace='http://date.fortest.tools.cxf.apache.org/']">
>
> <jxb:globalBindings xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
> xmlns:xs="http://www.w3.org/2001/XMLSchema">
> <jxb:javaType name="java.util.Date" xmlType="xs:dateTime"
>
> parseMethod="org.apache.cxf.tools.common.DataTypeAdapter.parseDateTime"
>
> printMethod="org.apache.cxf.tools.common.DataTypeAdapter.printDateTime"/>
> </jxb:globalBindings>
> </jaxws:bindings>
> </jaxws:bindings>
>
>
> Cheers,
> James
>
Re: DateTime format problem (was Re: Looking for suggestions on how
to troubleshot this webservice error?)
Posted by James Mao <ja...@iona.com>.
Hi Phil,
Here is an example,
<jaxws:bindings wsdlLocation="you wsdl location"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<jaxws:bindings
node="wsdl:definitions/wsdl:types/xs:schema[@targetNamespace='http://date.fortest.tools.cxf.apache.org/']">
<jxb:globalBindings xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<jxb:javaType name="java.util.Date" xmlType="xs:dateTime"
parseMethod="org.apache.cxf.tools.common.DataTypeAdapter.parseDateTime"
printMethod="org.apache.cxf.tools.common.DataTypeAdapter.printDateTime"/>
</jxb:globalBindings>
</jaxws:bindings>
</jaxws:bindings>
Cheers,
James
> Thanks James,
>
> I'll give this a go but I'm not familiar with the binding file
> format. This is what I've got from numerous web searches. Think I'm
> missing a node attribute with a xpath query but not sure what it
> should look like.
>
> <jaxws:bindings
> wsdlLocation="http://192.168.81.129/Services/SalesOrderService.asmx?WSDL"
> xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
> xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> node="wsdl:definitions/wsdl:types/xsd:schema">
> <jaxb:globalbindings version="2.0" node=?????>
> <jaxb:javatype name="java.util.Date" xmltype="xs:dateTime"
> parsemethod="org.apache.cxf.tools.common.DataTypeAdapter.parseDateTime"
> printmethod="org.apache.cxf.tools.common.DataTypeAdapter.printDateTime"
> />
> </jaxb:globalbindings>
> </jaxws:bindings>
>
> Would appreciate if someone could put me straight on what the binding
> file should look like.
>
> thanks
>
> Phil
>
> James Mao wrote:
>> What about use the java.util.Calendar or java.util.Date? will that
>> make any difference?
>> I have not tried your testcase, but you can try add a jaxws binding
>> file when you do wsdl2java to map the xsd:dataTime to java.util.Calendar
>>
>> James
>
Re: DateTime format problem (was Re: Looking for suggestions on how
to troubleshot this webservice error?)
Posted by Phillip Baird <ph...@gmail.com>.
Thanks James,
I'll give this a go but I'm not familiar with the binding file format.
This is what I've got from numerous web searches. Think I'm missing a
node attribute with a xpath query but not sure what it should look like.
<jaxws:bindings
wsdlLocation="http://192.168.81.129/Services/SalesOrderService.asmx?WSDL"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
node="wsdl:definitions/wsdl:types/xsd:schema">
<jaxb:globalbindings version="2.0" node=?????>
<jaxb:javatype name="java.util.Date" xmltype="xs:dateTime"
parsemethod="org.apache.cxf.tools.common.DataTypeAdapter.parseDateTime"
printmethod="org.apache.cxf.tools.common.DataTypeAdapter.printDateTime" />
</jaxb:globalbindings>
</jaxws:bindings>
Would appreciate if someone could put me straight on what the binding
file should look like.
thanks
Phil
James Mao wrote:
> What about use the java.util.Calendar or java.util.Date? will that
> make any difference?
> I have not tried your testcase, but you can try add a jaxws binding
> file when you do wsdl2java to map the xsd:dataTime to java.util.Calendar
>
> James
Re: DateTime format problem (was Re: Looking for suggestions on how
to troubleshot this webservice error?)
Posted by James Mao <ja...@iona.com>.
What about use the java.util.Calendar or java.util.Date? will that make
any difference?
I have not tried your testcase, but you can try add a jaxws binding file
when you do wsdl2java to map the xsd:dataTime to java.util.Calendar
James
> Have discovered how to log with interceptors and this has shown that
> the string representation of the outgoing dateTime does not appear to
> be "valid".
>
> From the wsdl a field is mapped as xs:dateTime...
> <xs:element msdata:Caption="Ship By" minOccurs="0" name="RequestDate"
> type="xs:dateTime"/>
>
> When this is received from the service it comes in as...
> <RequestDate>2007-08-03T00:00:00.0000000+12:00</RequestDate>
>
> When we send it back however its going out as...
> <RequestDate>2007-08-03T00:00:00E-7+12:00</RequestDate>
>
> We have confirmed that .Net cannot parse this format.
>
> My question therefore is how can we change the outgoing format? As
> this client code was built with wsdl2java I'm assuming JAXB is being
> used for binding. Can anyone short circuit my search on how to
> override the default marshalling for xs:dateTime?
>
> thanks in advance
>
> Phil
>