MDS REST Bridge App: Addressing Connectivity Issues - movesense

I am trying to connect to the local server using the "MDS REST Bridge" app. My PC and mobile device are connected to the same Wi-Fi network, and I have successfully opened the main page, which is attached to this post.
however i'm unable to use any of the command which described in the preview page.
i'm sending the /Connect command to the URL (http://ip-address/Connect) but it didn't work. "Not found" error showing on page.
I have attached a screenshot of the main page I opened on the local server to this post.
I am also attaching a link to the application that I am using.
MDS_REST_Bridge_alpha_debug.apk
I am unable to find proper documentation for this application. Can you provide details on how to use the application, send commands, and receive responses?

Yes, the REST bridge is not quite there yet, when it comes to documentation. Here's the piece of python code I use to make the connection:
def _connect_sensor(self):
connect_url = "http://" + self.server_addr + ":8080/Connect"
payload = {"address":self.mac}
logger.debug("requests.post: "+ connect_url + ". payload: " + str(payload))
try:
response = requests.post(connect_url, json=payload)
except requests.exceptions.RequestException as e:
# In all connection errors etc, return false
logger.debug("REST request exception: %s" % str(e))
return False
# If response was 2xx, store Location and return true
if response.status_code < 300:
logger.debug("response.json: "+ str(response.json()))
self.connected_serial = response.json()["serial"]
logger.debug("connected_serial: "+ self.connected_serial)
return True
logger.info("REST connec request: status: %s"
% str(response))
return False
So in short:
To make the connection, send a json payload with the "address", which contains the BLE MAC-address of the device you want to connect to. The returning response will be json object which has "serial" containing the connected devices serial number.
Full disclosure: I work for the Movesense team

Related

Verifiable Credential - Presentation request gives an Internal Server Error

Microsoft Entra, a new Home of Microsoft Verifiable Credential is really new and nice feature. While I am playing around the items, I found an issue which I am not sure is an issue from my code rather Its more from the platform.
To give you little detail:
Company A: I have one Microsoft Verifiable Account to create the credentials for Company A employee.
Company B: I have one Microsoft Verifiable Account to verify (who likes to give a discount to those employees who are from Company A).
Step 1: using Company A, I have created the Verifiable Credential and It is stored in my Microsoft Authenticator App successfully.
Step 2: Coming to the next part of the story, Company B generates the presentation request where It likes to verify Company A employees' identity. I am able to create that presentation request and QR code for that as well.
Issue comes: Now, when I scan that presentation QR code using the authenticator app, It finds my stored crednetial is matching with this request. so, It gives me an option to share that credential against this presentation reuqest which is good and correct. But the moment I press "Share" it wait for a second and gives me an error message.
The error message is user friendly: Oops, failed to connect.
It seems there is a problem with one of our services connecting to your device. Check your network connection and try again.
But in technical detail, It says:
Error Code: internalServerError
Error Details: A generic error has occurred on the server.; Not Found; Not Found
TimeStamp: Dec1, 2022 10:02:48 AM EST
Request ID: 438395be97f20bbcc31511351121bbaa
Correlation ID: 3sg46/0ARha0zS/XHYKGfA.6.4
It also gives an option to see the track which is way long and can not be copy in mobile clipboard. But I took a part of that and that is below:
2022-11-30 17:49:33,560 INFO/Broker: [com.microsoft.identity.common.internal.result.MsalBrokerResultAdapter:authenticationResultFromBundle][2022-11-30 17:49:33 - thread_name: pool-27-thread-2, correlation_id: b27725eb-c6fc-4a0f-bdd5-dd5f3f74270b - Android 30] Broker Result returned from Bundle, constructing authentication result ThreadPoolExecutor$Worker.run()#641 [pool-14-thread-1]
2022-11-30 17:49:33,562 INFO/App: MSAL acquire token silently success: com.microsoft.identity.client.AuthenticationResult#5709e74 MsalTokenRefreshManager$getTokenSilentlyAsync$4$1$onTaskCompleted$acquireTokenSilentParameters$1.onSuccess()#567 [main]
2022-11-30 17:49:33,563 INFO/Broker: [com.microsoft.identity.common.java.result.LocalAuthenticationResult][2022-11-30 17:49:33 - thread_name: pool-27-thread-2, correlation_id: b27725eb-c6fc-4a0f-bdd5-dd5f3f74270b - Android 30] Id Token type: IdToken ThreadPoolExecutor$Worker.run()#641 [pool-14-thread-1]
2022-11-30 17:49:33,563 INFO/Broker: [com.microsoft.identity.common.java.result.LocalAuthenticationResult][2022-11-30 17:49:33 - thread_name: pool-27-thread-2, correlation_id: b27725eb-c6fc-4a0f-bdd5-dd5f3f74270b - Android 30] Constructing LocalAuthentication result, AccessTokenRecord null: false, AccountRecord null: false, RefreshTokenRecord null or empty: false, IdTokenRecord null: false ThreadPoolExecutor$Worker.run()#641 [pool-14-thread-1]
2022-11-30 17:49:33,564 INFO/App: Token result: Success AadRemoteNgcAuthCheckUseCase$checkForAuth$2.invokeSuspend()#88 [DefaultDispatcher-worker-5]
2022-11-30 17:49:33,564 INFO/Broker: [CommandDispatcher:submitSilent][2022-11-30 17:49:33 - thread_name: pool-27-thread-2, correlation_id: b27725eb-c6fc-4a0f-bdd5-dd5f3f74270b - Android 30] Completed silent request as owner for correlation id : **b27725eb-c6fc-4a0f-bdd5-dd5f3f74270b, with the status : COMPLETED is cacheable : true ThreadPoolExecutor$Worker.run()#641 [pool-14-thread-1]
2022-11-30 17:49:33,564 INFO/App: ListSessionsUseCase request with client request ID: 09871643-7561-4d9a-8e43-567c4d0480cb RemoteAuthenticationManager.listSessions()#201 [DefaultDispatcher-worker-5]
Just to troubleshoot:
I have tried to restart my phone.
Connected with wi-fi and data card.
I tried to check the previous Company A issuer Credential flow is still working and giving me the credential and all are working.
So, it is not an issue from my device and neither is the issue with authenticator connectivity issue from my side.
I think your implementation is based on the following Azure sample.
If so, please comment out the line on VerifierController.cs file under PresentationCallback() method which has a statement like //payload = presentationResponse["issuers"].ToString(). The data in the incoming request payload doesn't have "issuers". Instead of commenting out, you can also use the following:
payload = presentationResponse["verifiedCredentialsData"][0]["issuer"];

Building a Restful CRUD API with Node.js with Mongodb

i get the error:
{
"message": "Note content can not be empty"
}
The MongoDB is running and if i start $ node server.js, i get the messages:
Server is listening on port 3000
Successfully connected to the database
if i delete the following lines in note.controller.js. The Response-Status are 200-OK :
//return res.status(400).send({
// message: "Note content can not be empty"
// });
but the 'titel' contains the default content: "title": "Untitled Note".
I guess, it's a problem with the Middleware/ Mongooseenter code here.
Does anyone have a solution?
So, this error occurred to me when I followed the same tutorial, and the reason being that I was not experienced in using the Postman application.
The issue occurs when you choose the body as raw in the POST method by keeping the format of body as Text
For it to work properly, since the date should be in JSON format to be written into MongoDB as per the server configuration, we need to choose the raw body format as Json, as shown in the image below.

Getting error while accessing rally using rally-rest-api-2.1.2.jar

I am getting an authentication error for API key in rally. Even api key is given full access.
java.io.IOException: HTTP/1.1 401 Full authentication is required to access this resource
at com.rallydev.rest.client.HttpClient.executeRequest(HttpClient.java:163)
at com.rallydev.rest.client.HttpClient.doRequest(HttpClient.java:145)
at com.rallydev.rest.client.ApiKeyClient.doRequest(ApiKeyClient.java:37)
at com.rallydev.rest.client.HttpClient.doGet(HttpClient.java:221)
at com.rallydev.rest.RallyRestApi.query(RallyRestApi.java:168)
This is The code :
String wsapiVersion = "v2.0";
restApi.setWsapiVersion(wsapiVersion);
restApi.setApplicationName(projectname);
QueryRequest testCaseRequest = new QueryRequest("Testsets");
if(null !=workspace && ""!=workspace)
testCaseRequest.setWorkspace(workspace);
QueryResponse testCaseQueryResponse = restApi.query(testCaseRequest);
What is wrong here ?
One of the things I would check for is whether you are inside a corporate network that uses authenticated proxy servers. Unless you configure the connection correctly, the proxy will reject your request before it even gets to Rally.
Second thing I just thought of is, whether you are setting the right field in the header to enable the use of an APIKey. The Rally servers expect the ZSESSIONID to be set to the APIKey, I believe.

CodenameOne: problems using REST PATCH call

I am trying to use the Rest.patch call in CodenameOne but I am getting nothing back. If I use a REST client like ARC I get a response code of 200 and I can see the change has been made.
The Network Monitor in the CN1 Simulator shows the request being sent but shows no reply either.
Here is the code I use in CN1, Rest.post and Rest.get work well elsewhere in the code, it is Rest.patch that I am having a problem with?
bodyString= "{\"Exported\":\"1\"," +
"\"Notes\":\"Order sent\"}";
Response<Map> jsonData = Rest.patch(URL + "Orders(%27" + orderNumber + "%27)").
jsonContent().
header("Authorization", authorisation).
header("Alias", alias).
body(bodyString).
getAsJsonMap();
int responseCode = jsonData.getResponseCode();
If I send a Rest.put or Rest.post request instead, I get a 404 error, this is from either ARC or CN1.

Smack's FileTransferManager.createOutgoingFileTransfer only accepts full JIDs. How can I determine the full JID of a user in Smack?

After hours of debugging and trying to find out why the file transfer was not working using aSmack, while normal messaging was, I finally managed to pin it down to this.
The Openfire server is sending the Rosters' JID missing the / at the end when I follow the method given in the Smack documentation to get a user's Roster list.
Collection<RosterEntry> entries = roster.getEntries();
for (RosterEntry r : entries) {
Log.v("Gabriel","Receiving: " + r.getUser());
}
For example if I receive a message from the user gabriel, I get the "From" as:
gabriel#dragonov/Smack
But the r.getUser() returns to the user as
gabriel#dragonov
Even
connection.getRoster().getPresence(contactName).getFrom()
is returning is as "gabriel#dragonov".
This is causing the File transfer to fail, but oddly not the regular messaging. However when I manually add the /Smack at the end of
OutgoingFileTransfer transferr = manager.createOutgoingFileTransfer(contactJID+"/Smack");
it works.
My question is, how can I receive the full JID with the resource part included or configure the file transfer so that it doesn't fail when using a bare JID?
Edit:
I have tried the following method:
Log.v("Gabriel", entries.size() + " buddy(ies):");
for (RosterEntry r : entries) {
Log.v("Pat","adding: " + r.getType() + " " + r.getName());
contacts.add(r.getUser());
}
for (String contact : contacts){
Iterator<org.jivesoftware.smack.packet.Presence> presences = connection.getRoster().getPresences(contact);
Log.v("Gabriel", contact+" has: ");
while(presences.hasNext()){
Log.v("Gabriel",presences.next().getFrom());
}
}
But I am still getting the bare ID.
The output:
gabriel#dragonov has:
gabriel#dragonov
Use Iterator<Presence> Roster.getPresences(String user) to get the presence information from all known resources of a user. For this Presence instances getFrom() should return a full JID which you can use in FileTransferManager.createOutgoingFileTransfer().
I have created SMACK-430, regarding the use of a full JID in createOutgoingFileTranfer(). It really should throw an exception so that smack users don't have to debug hours to find the reason (although it's stated in the method javadoc). SMACK-430 also explains why FileTransferManager needs a full JID and can not be used with a bare JID.