UtilWebPostXmlHttpRequest(String, XDocument, ActionHttpWebRequest) Method
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 XDocument PostXmlHttpRequest(
string url,
XDocument xml,
Action<HttpWebRequest> request
)
Public Shared Function PostXmlHttpRequest (
url As String,
xml As XDocument,
request As Action(Of HttpWebRequest)
) As XDocument
Dim url As String
Dim xml As XDocument
Dim request As Action(Of HttpWebRequest)
Dim returnValue As XDocument
returnValue = UtilWeb.PostXmlHttpRequest(url,
xml, request)
public:
static XDocument^ PostXmlHttpRequest(
String^ url,
XDocument^ xml,
Action<HttpWebRequest^>^ request
)
static member PostXmlHttpRequest :
url : string *
xml : XDocument *
request : Action<HttpWebRequest> -> XDocument
No code example is currently available or this language may not be supported.
- url String
-
The server url.
- 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)
XDocument
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 =
PostXmlHttpRequest("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.