cancel
Showing results for 
Search instead for 
Did you mean: 

Error while connecting with SMP Server 2.3

Former Member
0 Kudos

Hi,

I am creating one sample iOS application using odata service.

I am trying to connect with SMP Server 2.3 for registering one user but when I run my application in simulator it is giving error as User Registration Error-552.For the application i am using one sample odata service that I have downloaded from Google and i am giving my internal IP for SMP server for establishing the connection.

Could anyone please help me in resolving this error.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

I am creating a native iOS application using Odata sdk and Relay server.

For connecting to relay server through iOS device I am using the method as mentioned below:

ODPUserManager *userManager = [ODPUserManager alloc]init];

userManager = [ODPUserManager getInstance:@"AppId"];

if(![userManager isUserRegistered])

{

[userManager setConnectionProfileWithHost:@https:\\11.11.11.11" port:80 farm:@"1" error:&error];

[userManager registerUser:@"OdataUser" activationCode:@"123" error: &error isSyncFlag:YES];

}

I am mentioning relay server ip address in the above method and its working fine.

But when I am using the hostname of Relay server, It is not getting connected.

Could anyone please help in this regard as how can we use hostname instead of ip address of relay server  in above mentioned method for connecting to relay server.

With Regards

Neha Pandey

Former Member
0 Kudos

Hi Neha.  I think the issue would be on the network side to tie the domain name to the IP address so you can refer to it via hostname and not IP address.  If your code works using the IP address, then your code is fine.  It's the hostname binding to the IP address is the issue and your network support should be able to solve this for you.  Hope this helps.

J

Former Member
0 Kudos

Hi ,

I have installed the relay server for one of my project. Now i have created two outbound enablers in sybase control center and open the url http://localhost/ias_relay_server/server/rs_server.dll in relay server and it displays the relay server version details with Overall Availability:none. When i am trying to start the outbound enablers I am getting some error "The Outbound Enabler was unable to connect to the Relay Server using 'host=78.93.249.184;;https=0;port=80;url_suffix='/ias_relay_server/server/rs_server.dll';' because of [MLC63: Unable to connect a socket. Network Error: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (winsock error code: 10060)."

Could anybody please suggest some solutions for this error.

Regards

Neha

Former Member
0 Kudos

Hi Neha.  I'm sorry that you're experience these technical roadblocks.  I think this problem is at the server end and not necessarily at the coding end.  May I suggest to also post on the SMP & Gateway group?

The relay URL that I use is provided already to me and I just assume that it is valid and fully functioning.  One validation that we've done is to make sure that any parameters or the Request from the device passes through the Relay Server and to SMP via SMP logs.  Once the SMP logs shows that the data is making it through, any other connection issue would most likely be between servers.

Also, I don't have any sample native object-c snippet to provide as I am working with Hybrid.  Then again, I don't think it is a code issue at the moment.

Thanks.

J

Former Member
0 Kudos

If I understand what you are trying to do, below is the code where you are able to register a user in SMP 2.3.  The response is an XML with connection ID value.  Hope this helps.  Only thing is that I am not able to elegantly loop through the XMLResponse to get to the "ConnectionId' element node.  So it's kind of ghetto but it did what I needed it to do.  Even using the example from w3school examples, it wasn't working.

Note that you will need Base64.js.  Feel free to message me and I will send you the file in a separate thread. Thanks and hope this helps a bit.

//Register the device that requires the use of an application id end point

        createConnectionId: function(usrName,pwd,appId,baseurl) {

        

            try {

                this.userName = usrName;

                this.pwd = pwd;

                this.appId = appId;

                this.baseurl = baseurl;

                this.method = "POST";

                //register application

                  var accessInfo = usrName + ":" + pwd;

                  var url = baseurl + "/" + appId + "/Connections";

            

                var xmlhttp = new XMLHttpRequest();

                xmlhttp.open(this.method,url,false);

                xmlhttp.setRequestHeader("Authorization", "Basic " + Base64.encode(accessInfo) );

                xmlhttp.setRequestHeader("Accept", "application/xml,application/atom+xml");

                xmlhttp.setRequestHeader("Content-Type", "application/atom+xml");

                //xmlhttp.setRequestHeader("X-SUP-SC","<SecConfigName>");

                //var t = generateEnvelope();

                /****************** envelope *******************/

                var postData = "<?xml version='1.0' encoding='UTF-8'?>" +

                                "<entry xmlns='http://www.w3.org/2005/Atom' xmlns:m='http://schemas.microsoft.com/ado/2007/08/dataservices/metadata' xmlns:d='http://schemas.microsoft.com/ado/2007/08/dataservices'>" +

                                "<content type='application/xml'>" +

                                "<m:properties>" +

                                "<d:DeviceType>iPad</d:DeviceType>" +

                                "</m:properties>" +

                                "</content>" +

                                "</entry>";

                /****************** envelope *******************/

                xmlhttp.send( postData );

                if( xmlhttp.readyState === 4) {

                    var tmpStr = "";

                    var foundNode = "false";

                    var xmlResponse = xmlhttp.responseText; //responseXML;

                

                    //parsing application connection id manually

                    for(var i=0; i<xmlResponse.length; i++) {

                        tmpStr = tmpStr + xmlResponse[i];

                    

                        if(foundNode === "true") {

                            if(xmlResponse[i] === '>') {

                                //tmpStr = tmpStr + xmlResponse[i];

                                //alert(tmpStr);

                                break;

                            }

                        }//if found

                    

                        if(xmlResponse[i] === '>' && foundNode === "false") {

                            if(tmpStr === "<d:ApplicationConnectionId>"){

                                foundNode = "true";

                                //alert(tmpStr);

                                //break;

                            }

                            else {

                                if(foundNode === "false") tmpStr = "";

                            }

                        }//if xmlResposne

                    }//for var

                

                    //now that we have connectionid node, parse out only the actual connection id

                    var start = tmpStr.indexOf('>');

                    var end = tmpStr.indexOf('/');

                    this.applicationConnectionId = tmpStr.substring((start+1), (end-1));

                

                }//if readystate

            }//try

            catch(error) {

                alert("Connection Id Error: " + error.message);

            }//catch

        

        }

Former Member
0 Kudos

Hi Jay,

Thanks a lot for your help but I am trying to create a native iOS application in which i am fetching SAP data using Odata services and I have to access that app on iPAD using the relay server.

So I am trying to find the code for connectivity of relay server with Odata service url.How to register user and establish a connectivity with relay server using Odata service.

If you have any idea for this plz suggest me.

Regards

Neha

Former Member
0 Kudos

Here's a sample end point that is suppose to go through our relay server:

http://hostname:port/relay_server/client/rs_client.dll/FARMMBS/applicationID/Connections

This url is all provided to me by our SMP server admin.  Then this url which is what we refer to as our base url, is passed as a parameter to the code snippet that I sent you earlier.  You do have to make a slight change in the above snippet:

I believe if you comment this line out:   var url = baseurl + "/" + appId + "/Connections";

and just use the "baseurl" parameter, this will work.  My logic above does work with the slight change I mentioned.  This piece is working like a charm for use when going through relay server.

Hope this helps.

Former Member
0 Kudos

Hi Jay,


As u have mentioned above that http://hostname:port/relay_server/client/rs_client.dll/FARMMBS/applicationID/Connections this is a sample end point. I want to ask you that while creating app end point in Sybase Control Center we have to give this url or in the code and please mention what is hostname, port, relay_server, Application Id, Connections and other parameter in this url as I am very new in this. If u have some code snippet for iOS native app using Odata and relay server, plz share with me as it would be much more helpful for me.

With Regards

Neha

Former Member
0 Kudos

Hi Jay,

I am trying to register my device using Relay server to get X-SMP-APPCID in Xamarin.ios/C#

i am using 2headers i.e Content-Type: application/XML and X-SMP-APPCID and Body

"<?xml version='1.0' encoding='UTF-8'?>" +

                                "<entry xmlns='http://www.w3.org/2005/Atom' xmlns:m='http://schemas.microsoft.com/ado/2007/08/dataservices/metadata' xmlns:d='http://schemas.microsoft.com/ado/2007/08/dataservices'>" +

                                "<content type='application/xml'>" +

                                "<m:properties>" +

                                "<d:DeviceType>iPad</d:DeviceType>" +

                                "</m:properties>" +

                                "</content>" +

                                "</entry>";

Method :POST

I tried using Postman extension i can generate X-SMP-APPCID easily but in c# programming am getting 200 as a status code which determines tht no device register.

please suggest me solution.

Thanks a lot

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Neha,

Could you please share the details how exactly you are connecting your app to SMP server?

Rgrds,

Jitendra

Former Member
0 Kudos

Hi Jitendra,

Please find the below code snippet:

ODPUserManager *userManager = [ODPUserManager alloc]init];

userManager = [ODPUserManager getInstance:@"AppId"];

if(![userManager isUserRegistered])

{

[userManager setConnectionProfileWithHost:@https:\\11.11.11.11:8283" port:5001 farm:@"0" error:&error];

[userManager registerUser:@"OdataUser" activationCode:@"123" error: &error isSyncFlag:YES];

}

I am using this sample odata service for creating app end point.

http://services.odata.org/NorthWind/NorthWind.svc/

Regards

Neha

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos
https:\\11.11.11.11:8283

Why are giving port here?

try with https:\\11.11.11.11 only.


8283 is the port where SCC listens.

Former Member
0 Kudos

Hi Jitendra,

I have tried with that also but no success.

Regards

Neha


midhun_vp
Active Contributor
0 Kudos

You should give only the IP address of SMP server as HOST address, ex. 11.11.11.11.

If your device/simulator is using the same network as SMP servers you can use the private IP otherwise you have to use public IP (Relay server is recommended instead of using public IP in production). The default communication port is 5001. Make sure this port is open. You can test it through a telnet in command prompt. You can test whether port is open to public here, http://www.yougetsignal.com/tools/open-ports/

Midhun VP

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

[userManager setConnectionProfileWithHost:@"11.11.11.11" port:5001 farm:@"0" error:&error];

Can you once again try with this host ip without giving https?

Former Member
0 Kudos

Hi Midhun,

My SMP server and the simulator on the mac system both are in same network.

In that case also is it required to open port 5001 on SMP server for testing the application on simulator?
Because I am not accessing the app from public network, I am just trying to test app in simulator.

With Regards

Neha Pandey

midhun_vp
Active Contributor
0 Kudos

Even you are in same network, make sure the port 5001 is accessible from your machine. You can telnet the port form your command port to check whether 5001 is accessible in your machine hence will be accessible from your simulator. (Start>cmd>telnet 11.11.11.11 5001

Midhun VP

Former Member
0 Kudos

Hi,

That User Registration error has been solved but while fetching the data I am getting Empty Url Passed error.

In sybase control center I have given the below url as app end point.

http://services.odata.org/NorthWind/NorthWind.svc/

Regards

Neha

midhun_vp
Active Contributor
0 Kudos

What is the exact error you are getting in device and server ? In which line of code you are getting the error ?

Midhun VP

Former Member
0 Kudos

Hi Midhun,

After successful user registration, when I am trying to fetch the service document or data from Odat Service, I need to fetch the Application end point from Sybase Control Center. I have given the Odata service url as application end point in sybase control center. But now when I am trying to run the app in ipad simulator it is saying that empty url passed. It could not find the app end point in sybase control center.

Regards

Neha

midhun_vp
Active Contributor
0 Kudos

You mean you are not able to get the ApplicationEndPoint? I am not an expert in IOS, but the process will be same in all OS. The code I used for android is given below. Might help you.

Ex.

// Getting application EndPoint URL and Push EndPoint URL

  AppSettings appSett = new AppSettings(conn);

  String appEndPoint = appSett.getApplicationEndPoint();

  String pushEndPoint = appSett.getPushEndPoint();

Midhun VP

Former Member
0 Kudos

Hi Midhun,

I am also trying in the same way but no success.

Is there anything wrong with this service.

With Regards

Neha

midhun_vp
Active Contributor
0 Kudos

I haven't used this service before. Double check the app name you are providing. Also check the SMP Odata library you are using in Xcode matches with the server version.

You can try with the NW gateway service from trial system too,. This is the service,https://sapes1.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/

You can read this thread to check the configuration in SCC,

Midhun VP

Former Member
0 Kudos

Hi Midhun,

When i am trying to open the service in browser it is asking for credentials like username and password. Could you please let me know the credentials.

Regards

Neha


Former Member
0 Kudos

Hi Midhun,

I am not able to open this service in this browser.

Regards

Neha

Former Member
0 Kudos

Hi Midhun,

I have resolved both the connection problems. Now I am able to fetch the application end point in my code but I am trying to get the contents of that odata service for that in my code there is one error like Forbidden Error Code-403. But that odata service is working fine in my browser.

Regards

Neha

midhun_vp
Active Contributor
0 Kudos

Can you provide how you solved the issue or solution provided worked for you.

Regarding the error with 403, try the OData url from a firefox rest client or Chrome postman and check its working. These discussions might help you too,

Midhun VP

midhun_vp
Active Contributor
0 Kudos

If you have changed the end point of the application, the new url has to be manually whitelisted. Navigate to Domians>default>Connections. Click on Connections tab.Create a new connection with Proxy as type. Give the new url and save.

Midhun VP

Former Member
0 Kudos

Hi Midhun,

For the application end point error I just Created one new security configuration as well as app end point and a different user and When i tried after that it was successful in fetching the application end point.

Regards

Neha

Former Member
0 Kudos

Hi,

I am creating a native iOS application using smp2.3. I want the application to be connected through Relay server but i am not able to understand as where to put the relay server connection properties.

I have put the below code in Appdelegate.m:

SUPConnectionProperties* props = app.connectionProperties;

    [props setServerName:self.serverName];

    [props setPortNumber:[self.serverPort intValue]];

    [props setUrlSuffix:@""];

    [props setFarmId:self.farmID];

    SUPLoginCredentials* login = [SUPLoginCredentials

                                  getInstance];

    if(self.manualRegistration)

    {

        login.username = self.connectionName;

        login.password = nil;

        props.activationCode = self.activationCode;

    } else {

    }

    props.loginCredentials = login;

    login.username = self.userName;

    login.password = [smp101vault getString:@"password"];

    props.activationCode = nil;

when I am compiling the app it is giving errors like sybase.sup.h, SUPClassMetaDataRBS.h file missing and use of undeclared identifier SUPConnectionProperties.

Please help in resolving this error.

Thanks

Neha

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert