I am using SOAP in java.
While reading from the socket, I am getting response in un-readable font/encoding.
Since I am a new user, I cant upload the image.
I am unable to understand the font/encoding of the contents or even the cause of such font/encoding.
Any ideas upon how to convert it into readable format using java?
Thanks
Related
Hi are there any frameworks or libraries in php equivalent to jpos?
I came across JAK8583 php library which can parse and generate ISO 8583 messages.
However I want a php library which can generate ISO 8583 response message for ISO 8583 request message .
Please let me know if there are any.
Hi I don't know any alternative but you can always parse the request and set the response fields on that parsed request.
You can see implementation of ISOMsg.setRespnseMTI as inspiration.
Regards
You can check out this php library for iso8583.
Please note that in general you cannot throw a request at a library and tell it to give you a response that will be useful. You need to populate the response with data that is relevant to the transaction.
So normally you would get the request, create a response from the request, populate the response with relevant data, then send it.
I'm working on a game using the LibGDX library. One part of the game involves collecting game data and sending it to a server as a JSON array to be recorded in a database. I'm using Node as my server but I'm running into an issue every time the game sends a POST request to the server. I'm using LibGDX's Http.Net library to send the request.
I keep getting a HTTP 400 error message and data isn't being recorded. Attached are screenshots of the relevant code and messages. Thank you!
Images: https://imgur.com/a/CF1U6#0
I don't have enough reputation to insert images, sorry.
I figured out the problem. I was using LibGDX's included JSON library to construct my JSON String. However, when I created Json json = new Json();, it defaults to writing minimal (I think). Names are not surrounded by double quotes in this format. See: https://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/utils/JsonWriter.OutputType.html
The solution is to set it to Json json = new Json(JsonWriter.OutputType.json);. This will format it as JSON which Express will recognize.
My main question is how can I pass JSON as well as File to post request to REST API? What needs in Spring framework to work as client and wait for response by passing post with JSON and File?
Options:
Do I need to use FileRepresentation with ClientResource? But how can I pass file as well as JSON?
By using RestTemplate for passing both JSON as well as File? How it can be used for posting JSON as well as File?
Any other option is available?
Sounds like an awful resource you're trying to expose. My suggestion is to separate them into 2 different requests. Maybe the JSON has the URI for the file to then be requested…
From a REST(ish) perspective, it sounds like the resource you are passing is a multipart/mixed content-type. One subtype will be application/json, and one will be whatever type the file is. Either or both could be base64 encoded.
You may need to write specific providers to serialize/deserialize this data. Depending on the particular REST framework, this article may help.
An alternative is to create a single class that encapsulates both the json and the file data. Then, write a provider specific to that class. You could optionally create a new content-type for it, such as "application/x-combo-file-json".
You basically have three choices:
Base64 encode the file, at the expense of increasing the data size
by around 33%.
Send the file first in a multipart/form-data POST,
and return an ID to the client. The client then sends the metadata
with the ID, and the server re-associates the file and the metadata.
Send the metadata first, and return an ID to the client. The client
then sends the file with the ID, and the server re-associates the
file and the metadata.
I'm using an API that returns a 400 error on a bad request and it includes a status code in valid xml with a nice explanation. Currently I'm using an InputStream obtained from URL and passing it to a SAXParser but this doesn't work when I get the 400 because URL.openStream() throws a FileNotFoundException. Is there anyway I can still obtain that stream from the URL and parse it?
Really depends on how you're making the connection. If you're using java.net.HttpURLConnection you can make a method call to getResponseCode(). Likewise, getErrorStream() sounds like it would be useful to you too.
http://docs.oracle.com/javase/1.4.2/docs/api/java/net/HttpURLConnection.html
I get the JSON of User Info from Facebook on Android.
And then send the JSON to my servlet (the platform is GAE).
My question is how to send it properly.
Since the JSON could be very long.
So far, I have tried this way.
But I cannot receive the entire JSON.
It always throws
Unterminated string at character 117 of
{"music":{"data":[{"created_time":"2011-05-23T16:47:21
0000","id":"176345129540","category":"Musician/band","name":"
And I print the JSON, I find that the JSON is just as above which is been cut.
Thanks in advance.
There might be a limit on the size of data you can send by Http GET, take a look at this question and rewrite your request to use Http POST.