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