web stats
SOAPFaultException cannot be parsed as the type 'DateTime' - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 10-07-2013, 08:04 AM
amitkhare amitkhare is offline
Mirth Newb
 
Join Date: Aug 2013
Posts: 13
amitkhare is on a distinguished road
Default SOAPFaultException cannot be parsed as the type 'DateTime'

I am getting a SOAPFaultException on a dateTime field when sending out of Mirth via a web service.

I have a channel that will receive an HL7 message from another channel, it then sends an XML message to a web service sender destination. I have mapper steps created in the channel transformer to create variables for mapping to the XML SOAP envelope. For the dateTime fields I used the following javaScript code to convert from the HL7 formatted date:

var rawdate = msg['PID']['PID.7']['PID.7.1'];

var formatter = java.text.SimpleDateFormat("yyyyMMdd");
var date = formatter.parse(rawdate);

formatter = java.text.SimpleDateFormat("MM/dd/yy");
var dob = formatter.format(date);
channelMap.put('DOB',dob);



This is how the SOAP envelope looks with the mappings:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns: pat="http://schemas.datacontract.org/2004/07/PatientManagementInterfaces">
<soapenv:Header/>
<soapenv:Body>
<tem:Admit>
<!--Optional:-->
<tem: patient>
<!--Optional:-->
<pat:Address>${Address}</pat:Address>
<!--Optional:-->
<pat:BusinessPhone>${BusinessPhone}</pat:BusinessPhone>
<!--Optional:-->
<pat:City>${City}</pat:City>
<!--Optional:-->
<pat:ContactName>${ContactName}</pat:ContactName>
<!--Optional:-->
<pat:ContactPhone>${ContactPhone}</pat:ContactPhone>
<!--Optional:-->
<pat: DOB>${DOB}</pat: DOB>
<!--Optional:-->
<pat:EMPINumber>?</pat:EMPINumber>
<!--Optional:-->
<pat:EntryTime>${EntryTime}</pat:EntryTime>
<!--Optional:-->
<pat:FirstName>${FirstName}</pat:FirstName>
<!--Optional:-->
<pat:HomePhone>${HomePhone}</pat:HomePhone>
<!--Optional:-->
<pat:IPID>${IPID}</pat:IPID>
<!--Optional:-->
<pat:LastName>${LastName}</pat:LastName>
<!--Optional:-->
<pat:MRN>${MRN}</pat:MRN>
<!--Optional:-->
<pat:MiddleName>${MiddleName}</pat:MiddleName>
<!--Optional:-->
<pat:NOK>${NOK}</pat:NOK>
<!--Optional:-->
<pat:NOKPhone>${NOKPhone}</pat:NOKPhone>
<!--Optional:-->
<pat:PatientAccountNum>${PatientAccountNum}</pat:PatientAccountNum>
<!--Optional:-->
<pat:Race>${Race}</pat:Race>
<!--Optional:-->
<pat:SSN>${SSN}</pat:SSN>
<!--Optional:-->
<pat:Sex>${Sex}</pat:Sex>
<!--Optional:-->
<pat:State>${State}</pat:State>
<!--Optional:-->
<pat:Zip>${Zip}</pat:Zip>
</tem: patient>
<!--Optional:-->
<tem:visit>
<!--Optional:-->
<pat:AdmitDateTime>${AdmitDateTime}</pat:AdmitDateTime>
<!--Optional:-->
<pat:AttendingDegree>${AttendingDegree}</pat:AttendingDegree>
<!--Optional:-->
<pat:AttendingFirstName>${AttendingFirstName}</pat:AttendingFirstName>
<!--Optional:-->
<pat:AttendingID>${AttendingID}</pat:AttendingID>
<!--Optional:-->
<pat:AttendingLastName>${AttendingLastName}</pat:AttendingLastName>
<!--Optional:-->
<pat:AttendingMiddleName>${AttendingMiddleName}</pat:AttendingMiddleName>
<!--Optional:-->
<pat:FacilityCode>${FacilityCode}</pat:FacilityCode>
<!--Optional:-->
<pat:PatientClass>${PatientClass}</pat:PatientClass>
<!--Optional:-->
<pat:ReferringDegree>${ReferringDegree}</pat:ReferringDegree>
<!--Optional:-->
<pat:ReferringFirstName>${ReferringFirstName}</pat:ReferringFirstName>
<!--Optional:-->
<pat:ReferringID>${ReferringID}</pat:ReferringID>
<!--Optional:-->
<pat:ReferringLastName>${ReferringLastName}</pat:ReferringLastName>
<!--Optional:-->
<pat:ReferringMiddleName>${ReferringMiddleName}</pat:ReferringMiddleName>
<!--Optional:-->
<pat:RoomNumber>${RoomNumber}</pat:RoomNumber>
<!--Optional:-->
<pat:VisitNumber>${VisitNumber}</pat:VisitNumber>
</tem:visit>
<!--Optional:-->
<tem:allergies>
<!--Zero or more repetitions:-->
<pat:AllergyDetail>
<!--Optional:-->
<pat:Code>${AllergyCode}</pat:Code>
<!--Optional:-->
<pat:CodeIdentitier>${AllergyCodeIdentifier}</pat:CodeIdentitier>
<!--Optional:-->
<pat: DateRecorded>${AllergyDateRecorded}</pat: DateRecorded>
<!--Optional:-->
<pat:Reaction>${Reaction}</pat:Reaction>
<!--Optional:-->
<pat:Severity>${Severity}</pat:Severity>
<!--Optional:-->
<pat:Type>${AllergyType}</pat:Type>
</pat:AllergyDetail>
</tem:allergies>
<!--Optional:-->
<tem:insurances>
<!--Zero or more repetitions:-->
<pat:InsuranceDetail>
<!--Optional:-->
<pat:CompanyName>${CompanyName}</pat:CompanyName>
<!--Optional:-->
<pat:PlanID>${PlanID}</pat:PlanID>
</pat:InsuranceDetail>
</tem:insurances>
<!--Optional:-->
<tem:insuranceAdditional>
<!--Optional:-->
<pat:MedicaidNumber>${MedicaidNumber}</pat:MedicaidNumber>
<!--Optional:-->
<pat:MedicareNumber>${MedicareNumber}</pat:MedicareNumber>
</tem:insuranceAdditional>
</tem:Admit>
</soapenv:Body>
</soapenv:Envelope>



When I send a test transaction through I get the following exception on the DOB field:

ERROR-410: Web Service Connector error
ERROR MESSAGE: Error connecting to web service.
javax.xml.ws.soap.SOAPFaultException: The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/: patient. The InnerException message was 'There was an error deserializing the object of type PatientManagementInterfaces.PatientDetail. The value '06/15/61' cannot be parsed as the type 'DateTime'.'.



The web service method seems to work when tested outside of Mirth. I tried sending the date in different formats and it doesn't seem to make a difference, I get the same exception regardless.

Is there a step I am missing here? What do I need to do to send a dateTime value out of Mirth through web services?

Thanks
Attached Files
File Type: xml Inbound - Product.xml (151.8 KB, 5 views)
Reply With Quote
  #2  
Old 10-07-2013, 02:56 PM
amitkhare amitkhare is offline
Mirth Newb
 
Join Date: Aug 2013
Posts: 13
amitkhare is on a distinguished road
Default

I was able to get this to work. I found the solution here: http://tech.forums.softwareag.com/te...ist/31905.page

Because the web service is expecting those fields in dateTime format instead of string, the values in the SOAP envelope need to adhere to the W3C XML schema valid format. I changed the formatter for the dates in my javascript to

formatter = java.text.SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss'.000Z'");

and that did the trick. So, the issue was with the way I had the dates formatted.
Reply With Quote
  #3  
Old 11-06-2013, 11:40 AM
amitkhare amitkhare is offline
Mirth Newb
 
Join Date: Aug 2013
Posts: 13
amitkhare is on a distinguished road
Default

Ok, I am still having problems with this. Has anyone had luck sending datetime values from Mirth through web services? The problem I am having now is when the datetime fields are blank in the inbound HL7 messages. These are optional fields. But when a blank or null value is passed on in the web service for the dattime field I get the message that the value cannot be parsed as datetime. Has anyone found a solution for this? Is there a proper way to pass nulls in a datetime field?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 02:49 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Mirth Corporation