I am trying to use protobuf (https://github.com/stepancheg/rust-protobuf) with TMQ (https://github.com/cetra3/tmq) and am having some issues with byte serialization/deserialization for sending over the wire.
I've looked over the documentation, but it's not obvious to me which methods or traits would allow me to convert a protobuf Message a type that would be acceptable by tmq::dealer::Dealer::send(). Any help would be greatly appreciated, thanks!
Related
I am implementing protobuf recently in our kotlin project.
I am receiving the binary data and deserialising it to Proto object using the proto file.
But I would like have that converted to data class.
I could not find any supporting information about how to do this.
Is it possible to get data class from binary data or from deserialized proto object??
One solution might be to use pb-and-k which has the kotlin code generator and will generate data classes for you based off of the .proto files
If you have know the structure of the data and can write your data classes upfront, you might want to have a look at kotlinx.serialization. It is an official Kotlin project and supports protobuf out-of-the-box.
I work in tool theos projects and i want convert an object into JSON.
I need a easy to use library with examples for converting NSObjects to JSON and back again
I check a lot of question like this but i can't use them.
I use JSONModel library but i have a lot of errors.
Anybody body have a good tutorial or a sample code to convert NSObject to JSON?
I don't have any idea whether I can created a json or not.
How can I fix this?
Look at my library - https://github.com/DimasSup/BaseMangedObjectModel
With it you can serialize/deserialize any your class. aslo can save it to SQLite database if needed. Also there are NetworkHelper class which help you send/receive your classes from remote server.
Is there any easy way to load and pass/set the KnownTypes for the serializer? Meaning that without 1). adding [KnownType] attribute to the types 2). Or passing Type[]. Any help would be greatly appreciated.
After searching and checking for the other available .NET JSON serializer/de-serializer, i liked the way fastJSON & ServiceStack helped. Like DataContractResolver in DataContractSerializer(), fastJSON preserves the TYPE and ServiceStack is nice and clean at serialization time.
So for BOTH the libraries we no need to set [KnownType] attribute to the classes/types Or passing Type[] to the conversion method.
Here is a link about fastJSON in CodeProject: http://www.codeproject.com/Articles/159450/fastJSON
For ServiceStack : http://www.servicestack.net/
And also I have checked some other articles about the .NET JSON serializer's benchmark. Here I have listed only 2 of them:
1). http://theburningmonk.com/2012/11/json-serializers-benchmark-updated-including-mongodb-driver/
2). http://www.servicestack.net/benchmarks/
I am beginner to iphone. My requirement is to invoke the sap webservice in iphone.I got the result data which is in xml form.The result is to be in NSString which is of Xml form.Then how to get that result into the array in xcode.Please help me.
Here is a great library on GitHub-XML to NSDictionary
It isn't quite an NSArray but xml files are rarely just Arrays, so this provides an intermediate, dictionaries when needed, arrays if possible.
1. You can use NSXMLParser for this purpose, read through the delegate methods in https://developer.apple.com/library/ios/documentation/cocoa/reference/NSXMLParserDelegate_Protocol/Reference/Reference.html
2. This question is pretty repetitive, you could have just googled "Parsing the Xml data in iPhone" or "Parsing the Xml data using xCode" you would have got loads of results. Go trhough this ->
http://www.xcode-tutorials.com/parsing-xml-files/
and maybe this-> http://www.edumobile.org/iphone/iphone-programming-tutorials/parsing-an-xml-file/
3. Next time please do search.
Your question is quite general and it's difficult to give you a specific answer.
Here some guidelines to consume web services in iOS.
First, you need to have a mechanism that helps you to consume the ws. To do it, you can use NSUrlConnection class (see NSURLConnection Class) or use a the ASIHttpRequest framework (see ASIHTTPRequest). In this manner you can make requests and dowload response messages.
Since you use soap messages, you have first to create the request message manually. You can use class method of NSString stringWithFormat or use ASIFormDataRequest class of ASIHttpRequest framework.
Finally, if you receive a message that is like the following you posted in your comment, you need to parse it. Remember that is a soap message and it doesn't have only your tags. To do it, you can use NSXMLParser class (see NSXMLParser Class) or use GDataXML parser (see how-to-read-and-write-xml-documents-with-gdataxml).
Out there there are plenty of tutorials or posts on how to "consume web services on iOS". You can find them. In addition, there are also some kits that, taken the your service, create class wrappers to consume your services. In this case you don't need to create or parse manually masseges.
A last remark. When you need to consume data taken from a service, maybe a REST architecture could be easier to set up.
Hope it helps.
I recently moved to using the binary serializer to send messages with NServiceBus. My messages are all defined as interfaces and are instantiated using
bus.Send<MessageType>(msg => msg.Property = someValue)
This leads to an exception being thrown from NServiceBus stating that
Cannot create an instance of an
interface
I can see from the stack trace that the SimpleMessageMapper is being used, and after looking in the source can see it's making a call to Activator.CreateInstance.
I can't find anything in the documentation stating that it's not possible to do what I'm trying to do, is there a way to fix this?
Thanks,
Matt
I only just started playing with nServiceBus, so all I can offer you is theory :).
Are you defining the implementation classes for your message interfaces, or is nServiceBus generating classes on its own? If the former, make sure you still have a default constructor and that the class and all fields/events are marked as [Serializable] or [NonSerialized]. If the latter, it's possible that nServiceBus doesn't know how to generate members which may be needed for (de)serialization. You may have to write and map the implementation class yourself.