"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

Fail with java sample codes on PostNewTarget

Vuforia veritabanımıza resim upload etmek için hazır java sınıflarınızı kullanmak istedik fakat çözemediğimiz bir sorun var.

DeleteTarget, GetAllTargets, GetTarget fonksiyonlarını çalıştırıyoruz ama  PostNewTarget ve UpdateTarget fonksiyonlarını çalıştırdığımızda aşağıdaki gibi bir hata alıyoruz.

 

We try to upload images to cloud database with java samples from vuforia developer web site. 

With same samples we can run DeleteTarget, GetAllTargets, GetTarget  functions but can not run PostNewTarget and UpdateTarget functions.

We get following error: 

run:

POST

a59cc9dcfdcb1b59cd7a4ef543602445

application/json

Thu, 19 Nov 2015 15:21:17 GMT

/targets

Respons Body:  {"result_code":"Fail","transaction_id":"4f24e8b41b764494bc3a25c88716b308"}

Created target with id:

BUILD SUCCESSFUL (total time: 13 seconds)

 

Here is the list of libraries we added:

java.io.File;

import java.io.IOException;

import java.net.URI;

import java.net.URISyntaxException;

import java.util.Date;

import org.apache.commons.codec.binary.Base64;

import org.apache.commons.io.FileUtils;

import org.apache.http.HttpResponse;

import org.apache.http.client.ClientProtocolException;

import org.apache.http.client.HttpClient;

import org.apache.http.client.methods.HttpPost;

import org.apache.http.client.methods.HttpUriRequest;

import org.apache.http.entity.StringEntity;

import org.apache.http.impl.client.DefaultHttpClient;

import org.apache.http.impl.cookie.DateUtils;

import org.apache.http.message.BasicHeader;

import org.apache.http.util.EntityUtils;

import org.json.JSONException;

import org.json.JSONObject;

brainbreaker

Tue, 08/30/2016 - 17:37

Facing the same issue every time I try to post a new target using Java. Here is the code: http://pastebin.com/wDSgrYbq

Tried posting via Target Manager, it works but not with this code.

Can anyone help who has faced the same issue?

Thanks in Advance!

Hello,

Your link does not work - the post was removed.

That's OK because we have sample Java code available for download for the VWS APIs:

https://developer.vuforia.com/downloads/samples

Thanks

brainbreaker

Wed, 08/31/2016 - 03:55

@medabit Sorry, Here's the new link to the code: http://pastebin.com/wDSgrYbq
And yes, I am using the PostNewTarget.java from official samples only.
 

Thanks!

brainbreaker

Thu, 09/01/2016 - 04:17

@medabit, this is the complete response

[ POST
c5b1038322a7e0bf6815bcfa08e372ec
application/json
Tue, 30 Aug 2016 17:14:07 GMT
/targets
{"result_code":"Fail","transaction_id":"b89b9970ff5841baa53252d1c7767f6e"}

@brainbreaker - What happens if you use our unmodified sample code? Do you get the same failure?

I'm trying to isolate if this is an issue with your code, your network connection, or our service. At this time I have no evidence that it is the latter.

brainbreaker

Sat, 09/03/2016 - 05:12

Yes, I get the same failure. I have to modify the source code with image path and server access keys. Also, I tried with the test metadata given in the samples too, it throws same error

Hello,

This is puzzling. We tried running this in our environment and it works fine.

The result code is basically a catch-all and really doesn't provide any feedback as to the actual issue.

Hello,

We believe this is related to the JSON schema being incorrect.

For this case, the `image` and `application_metadata` are not sent as String JSON objects? Can you send the body of the request in raw form as you are sending for further evaluation?