Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to add a date in the SOAPElement while calling a web service

 
lakshmi desai
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have written a java client that consumes .NET web service. The web service takes few string values and a date which is type DATE. The xsi:type is "date".I am using SOAPElement to add all the input values, but I cannot add the date field, since it accepts only string and I get the below exception:

Can somebody help me with this?how I can pass the date value?

Exception in thread "main" AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client
faultSubcode:
faultString: Server was unable to read request. ---> There is an error in XML document (1, 801). ---> String was not recognized as a valid DateTime.
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:Server was unable to read request. ---> There is an error in XML document (1, 801). ---> String was not recognized as a valid DateTime.
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:1910)
at com.ess.vv.util.TestWeb.callUsingCustomEnvelope(TestWeb.java:196)
at com.ess.vv.util.TestWeb.main(TestWeb.java:83)

Thanks in advance.
 
Dan Drillich
Ranch Hand
Posts: 1183
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Lakshmi,

Can you show us please the SOAP request?

Regards,
Dan
 
lakshmi desai
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dan,

Here is the SOAPRequest

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<PollingPlaceRequest xmlns="http://tempuri.org/">
<pollingRequest xmlns="http://tempuri.org/Request.xsd/">
<version>v1</version>
<byVoter xmlns="http://tempuri.org/Request.xsd/">
<LastName>CRESPO</LastName>
<DOB>02/24/1948</DOB>
<VoterID>17259</VoterID>
</byVoter>
</pollingRequest>
</PollingPlaceRequest>
</soap:Body>
</soap:Envelope>
 
Dan Drillich
Ranch Hand
Posts: 1183
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Lakshmi,

http://tempuri.org/Request.xsd doesn't seem to point to an XML Schema Definition.

Regards,
Dan
 
Doug Slattery
Ranch Hand
Posts: 294
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Lakshmi,

Maybe it's a DateTime problem related to this thread.

Hope that helps...
Aloha,
Doug

-- Nothing is impossible if I'mPossible
 
lakshmi desai
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dan,

Its a valid xml schema definition.

Doug,

I have gone through the thread and mine is different.
I need to send a date value to the web service adding it as a SOAPElement.

Thanks for your reply.
 
Dan Drillich
Ranch Hand
Posts: 1183
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by lakshmi desai:
Dan,

Its a valid xml schema definition.



Oh - please check it :roll:
[ May 06, 2008: Message edited by: Dan Drillich ]
 
Peer Reynders
Bartender
Posts: 2934
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by lakshmi desai:
{http://xml.apache.org/axis/}stackTrace:Server was unable to read request. ---> There is an error in XML document (1, 801). ---> There is an error in XML document (1, 801). ---> String was not recognized as a valid DateTime.



<DOB>02/24/1948</DOB>


XML Schema Part 2: 3 Built-in datatypes, 3.2 Primitive datatypes, 3.2.9 date

So the above date isn't a valid XMLSchema date. It should be:


<DOB>1948-02-24</DOB>

[ May 06, 2008: Message edited by: Peer Reynders ]
 
lakshmi desai
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Peer, it worked. I am not getting the error message now.
I am working on the other part of it and if I need any help I will post my problem....Thanks again for your suggestion....
 
Peer Reynders
Bartender
Posts: 2934
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Dan Drillich:
{http://tempuri.org/Request.xsd} doesn't seem to point to an XML Schema Definition.


It doesn't have to. Namespace names are URIs (Universal Resource Identifier), not URLs (Universal Resource Locators). It isn't mandatory that somebody publish the schema at the identical URL. It is the schemaLocation attribute that is used to identify the location of the schema. And that isn't always used either because tools rather use their own configured location so that they can use a cached version, rather that accessing the schema over the network every time they need it.

Please see also:
XML namespace url doubt
Resolving relative URIs for Canonicalization
Need explanations about urn and uri for a targetNamespace

It is however sloppy to use the tempuri.org domain. Tools like Visual Studio .NET always use this as the default - it is supposed to be replaced with the domain name of your organization in order to avoid global (as in the whole internet) namespace collisions. "tempuri.org" roughly stands for "temporary uri for your organization" - i.e. "place your organization's domain name here".
[ May 06, 2008: Message edited by: Peer Reynders ]
 
Dan Drillich
Ranch Hand
Posts: 1183
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Peer!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic