HTTP Authentication with Web References

Posted by Thor on Stack Overflow See other posts from Stack Overflow or by Thor
Published on 2009-05-28T20:34:59Z Indexed on 2010/05/01 13:07 UTC
Read the original article Hit count: 598

Filed under:
|

I have a web reference created from the WSDL, but I'm not allowed to call the function unless I pass in the username / password; the original code for the XML toolkit was:

Set client = CreateObject("MSSOAP.SOAPClient30")
URL = "http://" & host & "/_common/webservices/Trend?wsdl"

client.mssoapinit (URL)

client.ConnectorProperty("WinHTTPAuthScheme") = 1
client.ConnectorProperty("AuthUser") = user
client.ConnectorProperty("AuthPassword") = passwd

On Error GoTo err
Dim result1() As String

result1 = client.getTrendData(expression, startDate, endDate, 
              limitFromStart, maxRecords

How do I add the AuthUser/AuthPassword to my new code?

New code:

    ALCServer.TrendClient tc = new WindowsFormsApplication1.ALCServer.TrendClient();

    foreach(string s in tc.getTrendData(textBox2.Text, "5/25/2009", "5/28/2009", false, 500))
        textBox1.Text+= s;

© Stack Overflow or respective owner

Related posts about soap-client

Related posts about authentication