I have a webservice that returns response as datetime. Is there a way to parse the response XML? getText does not seem to work as the field is of type datetime. Any help here?

I am new to webservice integration, so would be helpful if pointed in the right direction.

  • 3
    Are you using a WSDL (if not, why not?)? What have you tried so far? The general idea is that yes, you can get the dateTime value, but we'll need to see some code of what you've tried so far. – sfdcfox Feb 25 '18 at 15:58
  • 1
    Can you share the XML you are trying to parse? – Daniel Ballinger Feb 25 '18 at 23:53
  • @sfdcfox - I am new to webservice integration, don't have to WSDL. I only had the webservice endpoint. Sorry for the late update, I tried different methods and ended up using Date.TimevalueOf(parser.getText()) and it works. I am not sure whether this is the clean/efficient way, but it works for me. – yeselkay Feb 27 '18 at 18:52
  • Would be happy if someone can advise if there is an alternate/better way. – yeselkay Feb 27 '18 at 18:53
  • @yeselkay I would seriously consider writing up a WSDL and importing it. It's a lot cleaner to use when you have a stable API to work from. – sfdcfox Feb 27 '18 at 19:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.