Is there any builtin services available in webMethods to convert string formate to binary data(1’s and 0’s).
wmPublic/pub.string.stringToBytes is that wht you want? if so plz check the Built-In Services before you post something like that.
Pavan,
There is no builtIn service to convert string to binary data, you have to write a java service for that. Just google it and you will find several sample codes for it.
do you have any idea about how to convert string into binary(1’s and 0’s) data
A string is already binary data…
we are getting xml file we need to convert whole file into binary data(1’s and 0’s).we have developed code which will convert string into binary but it is working for small string whenever we are passing huge data we are getting number formate exception.
please share your experience.
Please use the build-in service:pub:stringtobytes.
We have no idea that stringToBytes is what pavankumar wants.
I’m still confused by the requirement. As I said, a string is already ones and zeros.
Various ways to understand the requirement:
- Equivalent of Java String.toByteArray() or String.toCharArray()
- Equivalent of Java Integer.parseInt(String), Long.parseLong(String) etc.
That is, “40” converts to a native type with value of 40. - As (2.), but convert the result into a string of "1"s and "0"s.
That is “5” converts to the string “101” - And many more…
Let’s really understand the requirement before prescribing solutions.
Thanks for your response
service:pub:stringtobytes this service returns bytes not binary data.
I need binary data 1’s and 0’s.
I am getting Like purchase order in xml file
i need to convrt that purchase order into binary formate 1’s and 0’s.
U got my requirement in 3 rd step.(above)
please let me know if need any information
OK, so what you are asking, is how to convert a number encoded as a decimal string, into a number encoded in a binary string.
String subject=“5”;
Long num = Long.parseLong(subject);
String binaryString = Long.toString(num,2);
System.out.println(binaryString);
Prints ‘101’.
It’s a very unusual requirement and an extremely inefficient way of storing values. May I ask why you need it?
read the xml file and convert it into EBCDIC number formate you will get it in hexadecimal form next convert it into binary but you have to read the data twice which is time consuming
Might this be a language issue? You keep referring to needing “binary data” but a byte is binary data.
Are you talking about converting numbers represented as strings in an XML purchase order to a numeric data type? For example, getting the string “10” converted to the integer 10? Or a date string converted to a Date object?