Hi All, Thank U
here I am calling wsdl dynamically.I am not getting error here and the status code is 200. Now I want to know how can get the returned string from GetUsername in the responseStream ??
ASMX code below
<%@ WebService Language="VB" Class="WebServiceDNNUser" %> Imports System.Web Imports System.Web.Services Imports System.Web.Services.Protocols Imports DotNetNuke.Entities.Users <WebService(Namespace:="http://www.xxx.com/")> _<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _ Public Class WebServiceDNNUser Inherits System.Web.Services.WebService #Region "GetUsername()"<WebMethod> _ Public Function GetUsername() As String Dim strUsername As String = "" ' Get the current user Dim objUserInfo As UserInfo = UserController.GetCurrentUserInfo() ' If the user is not -1 they are logged in If objUserInfo.UserID > -1 Then strUsername = objUserInfo.Username End If Return strUsername End Function #End Region End Class
code behind
Dim soap As String = "<?xml version=""1.0"" encoding=""utf-8""?><soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/""><soap:Body> <GetUsername xmlns=""http://www.xxx.om/"" /> </soap:Body></soap:Envelope>" Dim req As HttpWebRequest = DirectCast(WebRequest.Create("http://xxx.om/WebServiceDNNUser.asmx"), HttpWebRequest) req.Headers.Add("SOAPActionhttp://www.xxx.om/GetUsername") req.ContentType = "text/xml;charset=""utf-8""" req.Accept = "text/xml" req.Method = "POST" Using stm As Stream = req.GetRequestStream() Using stmw As New StreamWriter(stm) stmw.Write(soap) End Using End Using Dim response As WebResponse = req.GetResponse() Dim responseStream As Stream = response.GetResponseStream()