Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --MIMEBoundary_199ca6b7114b9acca5deb2047d25d5841d4afb7f68281379
- Content-Type: application/xop+xml; charset=utf-8; type="text/xml"
- Content-Transfer-Encoding: binary
- Content-ID: <0.099ca6b7114b9acca5deb2047d25d5841d4afb7f68281379@apache.org>
- <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header><StateHeader xmlns="http://www.statemef.com/StateGatewayService"><MessageID>12345201704200009962</MessageID><RelatesTo>12345201704200009962</RelatesTo><Action>GetNewAcks</Action><Timestamp>2017-02-11T01:54:51.676-05:00</Timestamp><TestIndicator>T</TestIndicator></StateHeader></soapenv:Header><soapenv:Body><GetNewAcksResponse xmlns="http://www.statemef.com/StateGatewayService"><MoreAvailable>true</MoreAvailable><AcknowledgementListAttachmentMTOM><xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:299ca6b7114b9acca5deb2047d25d5841d4afb7f68281379@apache.org"></xop:Include></AcknowledgementListAttachmentMTOM></GetNewAcksResponse></soapenv:Body></soapenv:Envelope>
- --MIMEBoundary_199ca6b7114b9acca5deb2047d25d5841d4afb7f68281379
- Content-Type: application/octet-stream
- Content-Transfer-Encoding: binary
- Content-ID: <299ca6b7114b9acca5deb2047d25d5841d4afb7f68281379@apache.org>
- public static MimeEntity Load (ParserOptions options, ContentType contentType, Stream content, CancellationToken cancellationToken = default (CancellationToken));
- public static MimeEntity Load (ContentType contentType, Stream content, CancellationToken cancellationToken = default (CancellationToken));
- MimeEntity ParseMultipartFormData (HttpWebResponse response)
- {
- var contentType = ContentType.Parse (response.ContentType);
- return MimeEntity.Parse (contentType, response.GetResponseStream ());
- }
- int i = 1;
- foreach (var attachment in multipart.OfType<MimePart> ()) {
- string fileName = string.Format ("attachment.{0}.dat", i++);
- using (var stream = File.Create (fileName))
- attachment.ContentObject.DecodeTo (stream);
- }
- HttpWebRequest request = CreateWebRequestGetAcks();
- CookieContainer myContainer = new CookieContainer();
- request.PreAuthenticate = true;
- request.CookieContainer = myContainer;
- String username = user;
- String password = pwd;
- String encoded = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(username + ":" + password));
- request.Credentials = CredentialCache.DefaultCredentials;
- request.Headers.Add("Authorization", " Basic " + encoded);
- using (Stream stream = request.GetRequestStream())
- {
- soapEnvelopeXml.Save(stream);
- }
- using (WebResponse response = request.GetResponse())
- {
- using (StreamReader rd = new StreamReader(response.GetResponseStream()))
- {
- string _soapResult = rd.ReadToEnd();
- }
- }
- public static HttpWebRequest CreateWebRequestGetAcks()
- {
- HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create("https://xxxxxxxxxx");
- webRequest.Headers.Add(@"SOAP:Action");
- webRequest.ContentType = "text/xml;charset="utf-8"";
- webRequest.Host = "some thing";
- webRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 4.0.30319.34209)";
- webRequest.Method = "POST";`
- return webRequest;
- }
- MIME-Version: 1.0 content-type: multipart/related; type="application/xop+xml";start="<http://tempuri.org/0>";boundary="MIMEBoundary_someuniqueID";start-info="text/xml"
- Server: Microsoft-IIS/10.0
- X-Powered-By: ASP.NET
- Content-Length:24371900
- --MIMEBoundary_someuniqueID
- Content-Type: application/xop+xml; charset=utf-8; type="text/xml" Content-Transfer-Encoding: binary
- Content-ID: <http://tempuri.org/0>
- <soap:Envelope>
- <someWrapperElt>
- <xop:Include href="cid:uri_of_content"></xop:Include>
- </someWrapperElt>
- </soap:Envelope>
- --MIMEBoundary_someuniqueID
- Content-Type: application/octet-stream
- Content-Transfer-Encoding: binary
- Content-ID: <uri_of_content>
- ...start.b1n@ry-content-here-etc.fckZ8990832d...
- --MIMEBoundary_someuniqueID
- XmlDictionaryReader mtomReader = XmlDictionaryReader.CreateMtomReader(ms, Encoding.UTF8, XmlDictionaryReaderQuotas.Max);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement