Invalid Token

srinivas74

New member
Joined
Jul 18, 2012
Messages
2
Programming Experience
10+
Hi
I have a third party secure webservice which i call in my internal webservice.
My internal webservice is like this when i call this i m getting invalid token, any idea what is causing it, there is no session timeout and the third party service works fine on their end.

<code>

<WebMethod()>
Public Function sstest1() As String
Dim Str As String
Dim token As String
Dim bauth As New AuthenticationAPIWebService
Dim bauthresult As New AuthenticateResult
Dim myProxy As New System.Net.WebProxy("http://91.1.15.3:8080", False)
myProxy.Credentials = New System.Net.NetworkCredential("xxp", "Vf72CwMSvB72rk", "xx.com")
bauth.Proxy = myProxy
bauthresult = bauth.Authenticate("xx", "xx")
bauth.PreAuthenticate = True
token = bauthresult.Token.TokenString

Str = "<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""XML Schema"" "
Str = Str + "xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">"
Str = Str + "<soap:Body>"
Str = Str + "<ServiceRequest_Create xmlns=""http://systems.com/ServiceRequest_Create""
Str = Str + "<token>" + token + "</token>"
Str = Str + "<objCreateServiceRequest>"
Str = Str + "<UPRN>000021089821</UPRN>"
Str = Str + "</objCreateServiceRequest></ServiceRequest_Create></soap:Body></soap:Envelope>"

Dim req As System.Net.HttpWebRequest = System.Net.WebRequest.Create("https://systems.com/wcapi.asmx")
req.ContentType = "text/xml;charset=utf-8"
req.Accept = "text/xml"
req.Method = "POST"
req.Proxy = myProxy
Using stm As Stream = req.GetRequestStream()
Using stmw As New StreamWriter(stm)
stmw.Write(Str)
End Using
End Using
Dim response As System.Net.HttpWebResponse
response = req.GetResponse()
Dim reader As New StreamReader(response.GetResponseStream())
Return reader.ReadToEnd()
End Function

</code>

Any help appreciated, The xml response which i get is "Invalid Token",
I m literally stuck, can someone let me know what is wrong in the above code.

Thanks

Srini
 
Why are you connecting to the wcapi.asmx web service using WebRequest? You should add a web reference for that.
 
thats the asmx page with all the methods and i m calling the service request create method if u see, I m posting the whole XML as string and i want the result back, The whole xml string has one node with the authentication token, so i have to get the token and then pass it with the XML

I can call the method other way but the problem is it takes parameters as collections and which i m not sure how to pass it from oracle, so i thought i can create a XML string and post it using a .net method
 
Back
Top