Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I created a simple web service and a WSDL for it. In my WSDL I have five parameters for my SOAP response.

<message name="EmailStatusResponse">
    <part name='id' type='xsd:integer'/>
    <part name='name' type='xsd:string'/>
    <part name='message' type='xsd:string'/>
    <part name='createdDate' type='xsd:date'/>
    <part name='approver' type='xsd:string'/>
</message>

I want to create a client using my WSDL with eclipse and Axis2. The format of the createdDate which I receive through SOAP response is DD/MM/YYYY. When I run the client it throws an AxisFault saying that date format of createdDate is incorrect.
I know this would work if I change the date format sent in SOAP response to DD/MM/YYYY or change the type of the createdDate parameter in WSDL to xsd:string.
My question is, is there a way to specify the date pattern in WSDL?

For an example something like this:
<part name='createdDate' type='xsd:date' pattern="DD/MM/YYYY"/>

Thanks.

share|improve this question
add comment

2 Answers

You can declare it a string and then restrict the pattern of the string like so:

<xs:simpleType name="createdDate">
   <xs:restriction base="xs:string">
       <xs:pattern value="(0[1-9]|[12][0-9]|3[01])/(0[1-9]|1[012])/\d{4}"/>
   </xs:restriction>
</xs:simpleType>

This will get you the right format but you could have problems with the SOAP type being a string.

share|improve this answer
add comment

You can use schema to have your preferred pattern?

share|improve this answer
    
Can you explain it little bit further? What do you mean by 'schema'? –  prageeth Jul 10 '13 at 7:54
    
w3.org/standards/xml/schema –  Ratha Jul 10 '13 at 8:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.