I am new in webmethod and have some questions about the flow.
Currently I am going to handle a xml and transfer it into another format. And it need to process a value field. Actually it is a list of attributes, have names and values. And the value could be anything, number or string
if the value is number, I need to change it into a format like 1.0000000000000000E+2(for 100.0). I know it’s silly to have 16 zero afterwards, but what more ridiculous is they need it.
change the format is not that hard, the point is how to distinguish whether the value is a string or a number.
what I work on is webmethod 4.0, very old version. I think there is no logic expression in BRANCH or the other operations. I am also trying to write a small program on java, but It appears
public static final void number_handle( IData pipeline ) throws ServiceException
{
as the beginning, I am not sure how to change this. So I am totally lost here.
Yes, it throws an exception if you pass a non-number. Either catch it or verify that the value you pass is not null, empty or a non-number before calling.
Use this as the pattern: 0.000000000000E0
You won’t be able to get E+02 with this service, so you may need to do search and replace after calling this.
Also, be aware that this service uses a double data type. This can cause accuracy issues depending on what you’re doing.