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. MTOM

MTOM

Scheduled Pinned Locked Moved C#
xmlwcfhelpquestionannouncement
3 Posts 2 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.
  • J Offline
    J Offline
    JustRonald
    wrote on last edited by
    #1

    Hi, I have a Windows Application which should send data to a Webservice. I've added the URL of the Webservice (Add Web Reference...) to my project. I've also added the .cs file of the Webservice in my project. This is from the Webservice:

    POST /webservices/MTomTest/Mtomdummy.asmx HTTP/1.1
    Host: secret.nl
    Content-Type: application/soap+xml; charset=utf-8
    Content-Length: length

    <?xml version="1.0" encoding="utf-8"?>
    <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
    soap12:Body
    <AddFile xmlns="http://www.secret.nl/MTOMTest/v1">
    <request>
    <EmailAddress>string</EmailAddress>
    <Filename>string</Filename>
    <FileData>base64Binary</FileData>
    </request>
    </AddFile>
    </soap12:Body>
    </soap12:Envelope>

    Based on what he needs (EmailAddress, Filename, FileData) I wrote the following:

    /* DECALRATIE */
    string EmailAddress;
    string Filename;
    string FileDataBase64Binary;
    SoapBase64Binary base64Binary;
    MTOMDummy AddFileService;

    /* INITIALISATIE */
    EmailAddress = "email@secret.nl";
    Filename = "TestDeclaratie.zip";
    FileDataBase64Binary = "AgMFBws=";
    base64Binary = SoapBase64Binary.Parse(FileDataBase64Binary);
    AddFileService = new MTOMDummy();

    AddFileRequestType request = new AddFileRequestType();
    //request.EmailAddress ;
    //requestFilename = ;
    //request.FileData = ;

    /* CODE */
    //AddFileService.AddFile(AddFileRequestType request);
    //AddFileService.AddFile(?????????);

    The webmethod is called "AddFile" which I can call by using: AddFileService.AddFile(); I only need to know what should give as parameters for the "AddFile" webmethod? Any help would be greatly appriciated. Regards, Ronald

    A 1 Reply Last reply
    0
    • J JustRonald

      Hi, I have a Windows Application which should send data to a Webservice. I've added the URL of the Webservice (Add Web Reference...) to my project. I've also added the .cs file of the Webservice in my project. This is from the Webservice:

      POST /webservices/MTomTest/Mtomdummy.asmx HTTP/1.1
      Host: secret.nl
      Content-Type: application/soap+xml; charset=utf-8
      Content-Length: length

      <?xml version="1.0" encoding="utf-8"?>
      <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
      soap12:Body
      <AddFile xmlns="http://www.secret.nl/MTOMTest/v1">
      <request>
      <EmailAddress>string</EmailAddress>
      <Filename>string</Filename>
      <FileData>base64Binary</FileData>
      </request>
      </AddFile>
      </soap12:Body>
      </soap12:Envelope>

      Based on what he needs (EmailAddress, Filename, FileData) I wrote the following:

      /* DECALRATIE */
      string EmailAddress;
      string Filename;
      string FileDataBase64Binary;
      SoapBase64Binary base64Binary;
      MTOMDummy AddFileService;

      /* INITIALISATIE */
      EmailAddress = "email@secret.nl";
      Filename = "TestDeclaratie.zip";
      FileDataBase64Binary = "AgMFBws=";
      base64Binary = SoapBase64Binary.Parse(FileDataBase64Binary);
      AddFileService = new MTOMDummy();

      AddFileRequestType request = new AddFileRequestType();
      //request.EmailAddress ;
      //requestFilename = ;
      //request.FileData = ;

      /* CODE */
      //AddFileService.AddFile(AddFileRequestType request);
      //AddFileService.AddFile(?????????);

      The webmethod is called "AddFile" which I can call by using: AddFileService.AddFile(); I only need to know what should give as parameters for the "AddFile" webmethod? Any help would be greatly appriciated. Regards, Ronald

      A Offline
      A Offline
      atuldeore
      wrote on last edited by
      #2

      If I understtod your question correctly, you are unable to figure out the object to be passed to the AddFile() method. You have to pass object of AddFileRequestType. MTOMDummy AddFileService; /* INITIALISATIE */ AddFileService = new MTOMDummy(); AddFileRequestType request = new AddFileRequestType(); request.EmailAddress = "email@secret.nl"; requestFilename = "TestDeclaratie.zip"; request.FileData = ; AddFileService.AddFile(request);

      Every bit counts

      J 1 Reply Last reply
      0
      • A atuldeore

        If I understtod your question correctly, you are unable to figure out the object to be passed to the AddFile() method. You have to pass object of AddFileRequestType. MTOMDummy AddFileService; /* INITIALISATIE */ AddFileService = new MTOMDummy(); AddFileRequestType request = new AddFileRequestType(); request.EmailAddress = "email@secret.nl"; requestFilename = "TestDeclaratie.zip"; request.FileData = ; AddFileService.AddFile(request);

        Every bit counts

        J Offline
        J Offline
        JustRonald
        wrote on last edited by
        #3

        Yes...I suppose you understand me. I did figure the following out:

        /* DECALRATIE */
        string EmailAddress;
        string Filename;
        string FileDataBase64Binary;
        SoapBase64Binary base64Binary;
        MTOMDummy AddFileService;

        /* INITIALISATIE */
        EmailAddress = "email@secret.nl";
        Filename = "declaratie1.zip";
        FileDataBase64Binary = "AgMFBws=";
        base64Binary = SoapBase64Binary.Parse(FileDataBase64Binary);
        AddFileService = new MTOMDummy();

        AddFileRequestType request = new AddFileRequestType();
        request.EmailAddress = EmailAddress;
        request.Filename = Filename;
        request.FileData = base64Binary;

        /* CALLING WEBSERVICE */
        AddFileService.AddFile(request);

        Now is the object "request" filled with the email address, filename but not the filedata. The code above gives me the following error: Cannot implicitly convert type 'System.Runtime.Remoting.Metadata.W3cXsd2001.SoapBase64Binary' to 'byte[]' Any idea how to fill the "request.FileData" in the correct way?

        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