JSONException: A JSONObject text must begin with { at 1 [character 2 line 1] - Teamcenter Connector - Integration

1
When trying to logging in to teamcenter from Mendix , I am getting “Failed to send the service operation Core-2011-06-Session/login. JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1]” error.when I debugged using eclipse I found from where that error occurs (Teamcenter Connector → javasourses → tcconnector.foundation → TcConnection.java → line number 195.)     And the HTTP Response which I received is given below:   Status : OK (200) Content :  =============================================================================================================  <html> <head> <title>Teamcenter Login</title> <link REL='stylesheet' href='/tc/teamcenter/presentation/webclient/styles/TeamCenter.css'> <link rel="shortcut icon" href="/tc/typeicons/favicon.ico" type="image/x-icon"/> <script language="JavaScript1.2"> var cookieEnabled = (navigator.cookieEnabled)? true : false if (cookieEnabled==false)  {    alert("Cookies are disabled. Please enable cookies. Otherwise most of the functionalities will not work properly."); } function isFieldEmpty(textObj){     for (var i = 0; i < textObj.value.length; i++){         var ch = textObj.value.charAt(i);         if (ch != ' ' && ch != '\t') return false;             }     return true; } function checkSubmitLoginForm(loginFormObj) {     var userNameRequiredStr = "User name is required! You must enter a user name!";     if (isFieldEmpty(loginFormObj.j_username) == false)     {        loginFormObj.Submit.disabled=true;        return true;     }     else alert(userNameRequiredStr);         } function doWatchCursor() {   document.body.style.cursor = 'wait'; } </script> </head> <body onbeforeunload="doWatchCursor();" onunload="doWatchCursor();" onLoad="document.WebClientLoginForm.j_username.focus();"> <table cellspacing="0" cellpadding="0" align="left" id="Table1"> <tr valign="top">     <td valign="top"><img src="/tc/teamcenter/presentation/webclient/images/Teamcenter.png"/></td> </tr> </table> <div id="loginSection" class="dialog-section"> <table cellspacing="0" cellpadding="0" border="0" align="right" id="Table2"> <tr>    <td>       <form name="WebClientLoginForm" id="loginform" method="POST" onSubmit="return checkSubmitLoginForm(this)" ID="Form1" autocomplete="off">       <table>       <tr>           <td align="justify" colspan="3">&nbsp;</td>                                                </tr>       <tr>           <td colspan="3">&nbsp;</td>       </tr>             <tr>           <td align="left" class="input-label">User Name:</td>           <td width="1px"><font color="#b22222" size="1">*</font></td>           <td align="left"><input class="input-body" type="text" name="j_username" ID="Text1" size="45" autocomplete="off"></td>       </tr>       <tr>           <td colspan="3">&nbsp;</td>       </tr>       <tr>           <td align="left" class="input-label">Password:</td>           <td width="1px"><font color="#b22222" size="1">*</font></td>           <td align="left"><input class="input-body" type="password" name="j_password" ID="Password1" size="45" autocomplete="off"></td>             </tr>       <tr>           <td colspan="3">&nbsp;</td>       </tr>       <tr>           <td colspan="2">&nbsp;</td>           <td align="left"><input type="submit" value="Login" ID="Submit1" NAME="Submit"></td>       </tr>       <tr>           <td colspan="3">&nbsp;</td>       </tr>       </table>       <INPUT TYPE="hidden" NAME="initialLoginPage" VALUE="myHomePage">       </form>    </td> </tr> </table> </div> </body> </html> =============================================================================================================    So the above httpresponse Content is passing as an argument in line number 195 which I mentioned above, That is why its throwing error since the above content is not JSONobject. But my doubt is the content which received as httpresponse is correct or the response should be in JSON format? I don’t know where I am doing mistake, Please help me in this.   Thanks in Advance. Suresh G    
asked
3 answers
3

Are you sure that you have entered the correct user id and password? That seems to be step one that fails. The second step that seems to go wrong is handling the authentication failure. The HTTP-response shows the login-page authentication. Ideally, the TeamCenterConnector should handle this with a normal authentication-error message,  “user-id and password combination is not valid”, but instead, it just moves on and fails when processing the response.

 

answered
0

facing same error here

could you please elaborate, detail of "wrong serviceURL" as mentioned @Suresh G?
also curious in dba user(infodba)

facing same error here

could you please elaborate, detail of "wrong serviceURL" as mentioned @Suresh G?
also curious in dba user(infodba)

 

answered
0

This is the error you get when you can’t contact the server.

This could be because it isn’t running or because you haven’t got access from your location.

It can also be because you have entered the wrong URL for your Teamcenter configuration.

Can you share what your Teamcenter configuration URLs look like?

answered