Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I have developed a webservice client using c#. Using client I am going to call 3rd party web service developed using java.

But when I run the application I am getting exception as "
Quote:
Error in deserializing body of reply message for operation 'QueryUserProfile'.

and the Inner exception is
Quote:
String was not recognized as a valid DateTime.


Can anyone have the solution for this. I have no control in the web service server side.

sample XML

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <ns:QueryUserProfileBOResponse xmlns:ns="http://com.ztesoft.zsmart/xsd">
         <MSISDN>94722009580</MSISDN>
         <AcntStopDate/>
         <CompletedDate>2016-08-22</CompletedDate>
         <CertType>1</CertType>
         <CertNbr>E52342566</CertNbr>
         <CustType>A</CustType>
         <CustName>LJH</CustName>
         <Address/>


What I have tried:

Here is the c# code that I used.

C#
DateTime dt;
            System.DateTime dt1;
            DateTime dt2;
            DateTime dt3;
            DateTime dt4;
            DateTime dt5;

            try
            {
                ServiceReference1.QueryPortTypeClient client = new ServiceReference1.QueryPortTypeClient();
                ServiceReference1.tAuthHeader auth = new ServiceReference1.tAuthHeader();
                auth.Password = "?";
                auth.Username = "?";


                ServiceReference1.tPricePlanDtoListType planList = new ServiceReference1.tPricePlanDtoListType();
                ServiceReference1.tServiceDto serviceList = new ServiceReference1.tServiceDto();
                ServiceReference1.tFellowISDNDto fellowList = new ServiceReference1.tFellowISDNDto();

                ServiceReference1.tQueryUserProfileRequestBO requestBO = new ServiceReference1.tQueryUserProfileRequestBO();
                requestBO.MSISDN = "94722009580";
                //requestBO.IMSI = "";
                //requestBO.UserPwd = "";
                ServiceReference1.QueryUserProfileResponse responce = new ServiceReference1.QueryUserProfileResponse();         

                ServiceReference1.QueryUserProfileRequest ProfileRequest = new ServiceReference1.QueryUserProfileRequest();
                ProfileRequest.AuthHeader = auth;
                ProfileRequest.QueryUserProfileRequestBO = requestBO;
                
                client.QueryUserProfile(auth, requestBO, out dt, out dt1, out strOutParam1, out strOutParam2, out strOutParam3,
                    out strOutParam4, out strOutParam5, out strOutParam6, out strOutParam7, out strOutParam8, out strOutParam9,
                    out strOutParam10, out serviceList, out planList, out fellowList, out strOutParam11, out strOutParam12, out strOutParam13,
                    out strOutParam14, out dt2, out dt3, out dt4, out dt5, out amount1, out strOutParam15, out strOutParam16,
                    out strOutParam17, out strOutParam18, out strOutParam19, out amount2);

                ServiceReference1.QueryAvaiableAddOnListResponse AddonResp = new ServiceReference1.QueryAvaiableAddOnListResponse();

                AddonResp.AddOnDtoList = client.QueryAvaiableAddOnList(auth, AddonBO);

                //string Mobile = strOutParam15;
                MessageBox.Show("wow");
            }
            catch (Exception x)
            {
                string error = x.Message;
                MessageBox.Show(error);
            }
Posted
Updated 8-Sep-16 1:54am
v3
Comments
Karthik_Mahalingam 9-Sep-16 1:21am    
show the code where the date casting is done.
Soft009 9-Sep-16 6:33am    
client.QueryUserProfile(auth, requestBO, out dt, out dt1, ......
dt and dt1 are datetime variables
Karthik_Mahalingam 9-Sep-16 6:34am    
i mean the code insde the userprofile function
Soft009 9-Sep-16 6:48am    
I didn't have access to the web service coding. It is from 3rd party. You think the issue is in the web service side. If yes I will contact them and can find a solution.
Karthik_Mahalingam 9-Sep-16 6:49am    
the error is from the 3rd party, you wil have to ask them to fix it.

1 solution

Perhaps <acntstopdate> is a required field. The error is very clear. The code is trying to convert something you sent it into a DateTime and what you sent is not a valid DateTime.

However, since none of us, including you, can see the webservice code I'm not sure what you want from us.

You'll have to ask whoever is running the webservice.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900