UtilWebPostXmlHttpRequestAsync(Uri, XDocument, ActionHttpWebRequest) Method
Asynchronously posts an XML HTTP request to the specified server with default encoding (UTF8), and returns the response.
Namespace: DevCase.Core.Networking.CommonAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
public static Task<XDocument> PostXmlHttpRequestAsync(
Uri uri,
XDocument xml,
Action<HttpWebRequest> request
)
Public Shared Function PostXmlHttpRequestAsync (
uri As Uri,
xml As XDocument,
request As Action(Of HttpWebRequest)
) As Task(Of XDocument)
Dim uri As Uri
Dim xml As XDocument
Dim request As Action(Of HttpWebRequest)
Dim returnValue As Task(Of XDocument)
returnValue = UtilWeb.PostXmlHttpRequestAsync(uri,
xml, request)
public:
static Task<XDocument^>^ PostXmlHttpRequestAsync(
Uri^ uri,
XDocument^ xml,
Action<HttpWebRequest^>^ request
)
static member PostXmlHttpRequestAsync :
uri : Uri *
xml : XDocument *
request : Action<HttpWebRequest> -> Task<XDocument>
No code example is currently available or this language may not be supported.
- uri Uri
-
The server Uri.
- xml XDocument
-
A XDocument that represents the XML content to POST to the server.
- request ActionHttpWebRequest
-
A HttpWebRequest object that represents the request parameters and custom header values.
(It is not necessary to set the Method and ContentLength properties)
TaskXDocument
The resulting response returned by the server.
This is a code example that demonstrates how to POST a XmlHttpRequest to http://converter.telerik.com/service.asmx service.
No code example is currently available or this language may not be supported.
Dim xml As XDocument =
<?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>
<ConvertToCS xmlns="http://converter.telerik.com">
<vbCode>Dim str As String = "Hello World"</vbCode>
</ConvertToCS>
</soap12:Body>
</soap12:Envelope>
Dim result As XDocument =
Await PostXmlHttpRequestAsync(New Uri("http://converter.telerik.com/service.asmx"), xml,
Sub(req As HttpWebRequest)
req.Method = "POST"
req.Host = "converter.telerik.com"
req.ContentType = "application/soap+xml; charset=utf-8"
req.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1"
req.Credentials = New NetworkCredential()
req.KeepAlive = False
End Sub)
Dim ns As XNamespace = result.Root.Name.Namespace
Dim el As XElement = result.Element(ns + "Envelope").Element(ns + "Body")
Console.WriteLine(el.Value)
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.