Skip to Content

B1WS UsersService GetByParams throwing System.InvalidOperationException

HI All,

I am using B1WS UsersService to read a user detail as following.

 UsersService l_user = new UsersService();

// MsgHeader class
MsgHeader msgHeader = new MsgHeader(); 
msgHeader.SessionID = SuperUserSession;                 
msgHeader.ServiceName = MsgHeaderServiceName.UsersService;
msgHeader.ServiceNameSpecified = true;
l_user.MsgHeaderValue = msgHeader;

UserParams param = new UserParams() { InternalKey = 4, InternalKeySpecified = true }; 
User SAPUser = l_user.GetByParams(param); //EXCEPTION HERE

Is there any issue on the above code? Looks like the XML de-serialization have issue.

See the exception detail

System.InvalidOperationException: There is an error in XML document (1, 665). ---> System.FormatException: String was not recognized as a valid DateTime. at System.DateTimeParse.ParseExactMultiple(String s, String[] formats, DateTimeFormatInfo dtfi, DateTimeStyles style) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderUsersService.Read11_User(Boolean isNullable, Boolean checkType) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderUsersService.Read25_GetByParamsResponse() at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer19.Deserialize(XmlSerializationReader reader) at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) --- End of inner exception stack trace --- at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) at UsersService.GetByParams(UserParams UserParams)

I checked the DI SERVER Log and found the response as below. Is this somehow getting error as there is not all info returned from the DI Server?

<?xml version="1.0" encoding="UTF-8"?> <User> <InternalKey>4</InternalKey> <UserCode>Support</UserCode> <UserName>Support</UserName> <Superuser>tYES</Superuser> <Department>1</Department> <Locked>tNO</Locked> <Group>ug_Regular</Group> <MaxDiscountGeneral>100.000000</MaxDiscountGeneral> <MaxDiscountSales>100.000000</MaxDiscountSales> <MaxDiscountPurchase>100.000000</MaxDiscountPurchase> <CashLimit>tNO</CashLimit> <MaxCashAmtForIncmngPayts>0.000000</MaxCashAmtForIncmngPayts> <LastLogoutDate>2018-04-13</LastLogoutDate> <LastLoginTime>1143:41:00</LastLoginTime> <LastLogoutTime>1446:38:00</LastLogoutTime> <LastPasswordChangeTime>1020:17:00</LastPasswordChangeTime> <LastPasswordChangedBy>manager</LastPasswordChangedBy> <U_AllowWebPR>1</U_AllowWebPR> <UserPermission /> <UserActionRecord> <UserActionRecordItem> <UserCode>Support</UserCode> <Action>actionLogoff</Action> <ActionBy>Support</ActionBy> <ClientIP>111.111.111.111</ClientIP> <ClientName>company-PC4</ClientName> <ActionDate>2018-04-13</ActionDate> <ActionTime>1446:38:00</ActionTime> <WindowsSession>-1</WindowsSession> <WindowsUser /> <ProcessName>B1_DIServer.exe</ProcessName> <ProcessID>4240</ProcessID> </UserActionRecordItem> <UserActionRecordItem> <UserCode>Support</UserCode> <Action>actionLogin</Action> <ActionBy>Support</ActionBy> <ClientIP>111.111.111.111</ClientIP> <ClientName>company-PC4</ClientName> <ActionDate>2018-04-13</ActionDate> <ActionTime>1143:41:00</ActionTime> <WindowsSession>-1</WindowsSession> <WindowsUser /> <ProcessName>B1_DIServer.exe</ProcessName> <ProcessID>4240</ProcessID> </UserActionRecordItem> <UserActionRecordItem> <UserCode>Support</UserCode> <Action>actionLogin</Action> <ActionBy>Support</ActionBy> <ClientIP>111.111.111.111</ClientIP> <ClientName>company-PC4</ClientName> <ActionDate>2018-04-12</ActionDate> <ActionTime>906:35:00</ActionTime> <WindowsSession>-1</WindowsSession> <WindowsUser /> <ProcessName>B1_DIServer.exe</ProcessName> <ProcessID>3772</ProcessID> </UserActionRecordItem> <UserActionRecordItem> <UserCode>Support</UserCode> <Action>actionLogin</Action> <ActionBy>Support</ActionBy> <ClientIP>111.111.111.111</ClientIP> <ClientName>company-PC4</ClientName> <ActionDate>2018-04-11</ActionDate> <ActionTime>1424:30:00</ActionTime> <WindowsSession>-1</WindowsSession> <WindowsUser /> <ProcessName>B1_DIServer.exe</ProcessName> <ProcessID>4076</ProcessID> </UserActionRecordItem> <UserActionRecordItem> <UserCode>Support</UserCode> <Action>actionLogoff</Action> <ActionBy>Support</ActionBy> <ClientIP>111.111.111.111</ClientIP> <ClientName>company-PC4</ClientName> <ActionDate>2018-04-10</ActionDate> <ActionTime>1134:13:00</ActionTime> <WindowsSession>-1</WindowsSession> <WindowsUser /> <ProcessName>B1_DIServer.exe</ProcessName> <ProcessID>1692</ProcessID> </UserActionRecordItem> <UserActionRecordItem> <UserCode>Support</UserCode> <Action>actionLogin</Action> <ActionBy>Support</ActionBy> <ClientIP>111.111.111.111</ClientIP> <ClientName>company-PC4</ClientName> <ActionDate>2018-04-10</ActionDate> <ActionTime>1119:03:00</ActionTime> <WindowsSession>-1</WindowsSession> <WindowsUser /> <ProcessName>B1_DIServer.exe</ProcessName> <ProcessID>1692</ProcessID> </UserActionRecordItem> <UserActionRecordItem> <UserCode>Support</UserCode> <Action>actionLogin</Action> <ActionBy>Support</ActionBy> <ClientIP>111.111.111.111</ClientIP> <ClientName>company-PC4</ClientName> <ActionDate>2018-04-10</ActionDate> <ActionTime>1118:52:00</ActionTime> <WindowsSession>-1</WindowsSession> <WindowsUser /> <ProcessName>B1_DIServer.exe</ProcessName> <ProcessID>1692</ProcessID> </UserActionRecordItem> <UserActionRecordItem> <UserCode>Support</UserCode> <Action>actionLogoff</Action> <ActionBy>Support</ActionBy> <ClientIP>111.111.111.111</ClientIP> <ClientName>company-PC4</ClientName> <ActionDate>2018-04-09</ActionDate> <ActionTime>1733:07:00</ActionTime> <WindowsSession>-1</WindowsSession> <WindowsUser /> <ProcessName>B1_DIServer.exe</ProcessName> <ProcessID>4056</ProcessID> </UserActionRecordItem> <UserActionRecordItem> <UserCode>Support</UserCode> <Action>actionLogin</Action> <ActionBy>Support</ActionBy> <ClientIP>111.111.111.111</ClientIP> <ClientName>company-PC4</ClientName> <ActionDate>2018-04-05</ActionDate> <ActionTime>2305:33:00</ActionTime> <WindowsSession>-1</WindowsSession> <WindowsUser /> <ProcessName>B1_DIServer.exe</ProcessName> <ProcessID>4056</ProcessID> </UserActionRecordItem> <UserActionRecordItem> <UserCode>Support</UserCode> <Action>actionLogoff</Action> <ActionBy>Support</ActionBy> <ClientIP>111.111.111.111</ClientIP> <ClientName>company-PC4</ClientName> <ActionDate>2018-04-05</ActionDate> <ActionTime>1758:00:00</ActionTime> <WindowsSession>-1</WindowsSession> <WindowsUser /> <ProcessName>B1_DIServer.exe</ProcessName> <ProcessID>4056</ProcessID> </UserActionRecordItem> </UserActionRecord> <UserBranchAssignment /> </User>

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers