Log in or register to post comments

Fail with java sample codes on PostNewTarget

November 20, 2015 - 4:30am #1

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;

Fail with java sample codes on PostNewTarget

September 9, 2016 - 11:10am #13

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?

If you prefer to keep that private, please upload to a file share service and PM me the link.

Thanks

Fail with java sample codes on PostNewTarget

September 8, 2016 - 9:43am #12

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.

https://library.vuforia.com/articles/Solution/How-To-Interperete-VWS-API-Result-Codes

I will continue to investigate.

Thanks.


Fail with java sample codes on PostNewTarget

September 2, 2016 - 10:12pm #11

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

Fail with java sample codes on PostNewTarget

September 1, 2016 - 5:20pm #10

@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.

Thanks

Fail with java sample codes on PostNewTarget

August 31, 2016 - 9:17pm #9

@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"}

Created target with id:

GET

d41d8cd98f00b204e9800998ecf8427e

]

Fail with java sample codes on PostNewTarget

August 31, 2016 - 2:23pm #8

Hello,

What response code to you receive from our service when you run your code?

Thanks

Fail with java sample codes on PostNewTarget

August 30, 2016 - 8:55pm #7

@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!

Fail with java sample codes on PostNewTarget

August 30, 2016 - 11:01am #6

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


Fail with java sample codes on PostNewTarget

August 30, 2016 - 10:37am #5

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!

Fail with java sample codes on PostNewTarget

August 10, 2016 - 3:50am #4

How do you solve this problem?

Fail with java sample codes on PostNewTarget

November 24, 2015 - 2:06am #3
Yes with target manager and php we can load the same images

Fail with java sample codes on PostNewTarget

November 23, 2015 - 6:33pm #2

Are you able to upload the same image successfully using the Target Manager?

Log in or register to post comments