views:

87

answers:

1

It is written

byte[][] getImagesForFields(java.lang.String[] fieldnames) 

Gets an array of images for the given fields.

On the other hand, as long as I use the method in the web application project built on asp.net 2.o using c#;

the provided web method declared above, returns sbyte; Have a look my code below;

  formClearanceService.openSession(imageServiceUser);
  formClearanceService.prepareInstance(formId);
  byte[][] fieldImagesList = formClearanceService.getImagesForFields(fieldNames);
  formClearanceService.closeSession();

thus I get the following error: Cannot implicitly convert type 'sbyte[]' to 'byte[][]'

So now, 1- should I ask the web service provider what is going on? or 2- any other way that can use the sbyte as I was suppose to use byte[][] like following using: byte[] ssss = fieldImagesList [0]..

+1  A: 

Java has signed bytes, so that part is correct in some ways (although unsigned bytes are more natural) - but it is vexing that it is returning a single array rather than a jagged array. I expect you're going to have to compare some data to see what you have received vs what you expected.

But changing between signed and unsigned can be as simple as:

sbyte[] orig = ...
byte[] arr = Array.ConvertAll(orig, b => (byte)b);

or (faster) simply:

sbyte[] orig = ...
byte[] arr = new byte[orig.Length];
Buffer.BlockCopy(orig, 0, arr, 0, orig.Length);
Marc Gravell
@Marc it is right, the web service is java based and the web application side is built on asp.net platform using c#.
blgnklc