Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Loosing Bytes in byte[][] while using WSE3 without MTOM

Loosing Bytes in byte[][] while using WSE3 without MTOM

Scheduled Pinned Locked Moved C#
helpsysadmindata-structureslounge
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DanielWehrle
    wrote on last edited by
    #1

    Hello, I wrote a little Server and run it under Win 2003 and Win 2008, [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1, EmitConformanceClaims = true)] [WebService(Namespace="http://www.pyramid.de", Description="Pyramid")] public class WormRaid : System.Web.Services.WebService { [WebMethod(MessageName="WriteBytes")] public long WriteBytes (byte[][] memData) { return (memData[0].Length + memData[1].Length); } } Now my problem is that the second byte array in a byte[][] is always received as 0 bytes, when the first byte[] length is a odd multiple of 1024 (1024, 3072 or ...). This error occurs only without MTOM, with MTOM everything works fine (see attached code). The error is probably in the server side because the same error can be produced with a GSoap Client (also without MTOM). Here my Client Code: internal static int Main (string[] args) { long fsize1; long fsize2; long byteswritten; byte[][] ba; WormRaid wr; Random rand = new Random(); try { fsize1 = 1024L;//only odd multiple of 1024 will not work fsize2 = 512L; Console.WriteLine(" (" + fsize1 + "), (" + fsize2 + ")\n"); // Create the data to send ba = new byte[2][]; ba[0] = new byte[(int)fsize1]; rand.NextBytes(ba[0]); ba[1] = new byte[(int)fsize2]; rand.NextBytes(ba[1]); //Create Stub wr = new WormRaid(); wr.Url = "http://localhost/WSE3Test/WSE3Test.asmx"; //First Test will work always Console.WriteLine("WSE3 MTOM:"); wr.RequireMtom = true; byteswritten = wr.WriteBytes(ba); if (byteswritten != fsize1 + fsize2) { Console.WriteLine("!!! ERROR LENGTH !!!\nWritten: " + byteswritten + ", expected: " + (fsize1 + fsize2)); } else { Console.WriteLine("OK\n"); } //This test will fail Console.WriteLine("WSE3 without MTOM:"); wr.RequireMtom = false; byteswritten = wr.WriteBytes(ba); if (byteswritten != fsize1 + fsize2) { Console.WriteLine("!!! ERROR LENGTH !!!\nWritten: " + byteswritten + ", expected: " + (fsize1 + fsize2));

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups