UtilWebPostXmlHttpRequest(Uri, String, 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(
Uri uri,
string xmlContent,
Action<HttpWebRequest> request
)
Public Shared Function PostXmlHttpRequest (
uri As Uri,
xmlContent As String,
request As Action(Of HttpWebRequest)
) As XDocument
Dim uri As Uri
Dim xmlContent As String
Dim request As Action(Of HttpWebRequest)
Dim returnValue As XDocument
returnValue = UtilWeb.PostXmlHttpRequest(uri,
xmlContent, request)
public:
static XDocument^ PostXmlHttpRequest(
Uri^ uri,
String^ xmlContent,
Action<HttpWebRequest^>^ request
)
static member PostXmlHttpRequest :
uri : Uri *
xmlContent : string *
request : Action<HttpWebRequest> -> XDocument
No code example is currently available or this language may not be supported.
- uri Uri
-
The server Uri.
- xmlContent String
-
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(New Uri("http://converter.telerik.com/service.asmx"), xml.ToString(),
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.