Skip to main content
10-Marble
August 31, 2011
Question

Invoking windchill SOAP call from VB.NET

  • August 31, 2011
  • 7 replies
  • 2444 views
Hello All,

We deployed a SOAP call for retrieving the ECN information.

We deployed a simple java client for invoking the SOAP call and able to retrieve the ECN information. When we attempt to retrieve the information using VB.NET, we get authorization required (401) exception. We used the same username and password credentials for both the cases.

The following WSDL url

7 replies

1-Visitor
August 31, 2011

Hi,


you need to autheniticate the browser:


aBaseSession.AuthenticateBrowser(userName, userPassword)

1-Visitor
August 31, 2011

Well,


what I wrote in last email is true if you are invoking from a ProE session but if not then maybe this will be of help:


Dim myCredCache As New CredentialCache()
myCredCache.Add(New Uri("http://some.site.com"), "Basic", New NetworkCredential(userName, userPassword))
client.Credentials = myCredCache

Saravanan10-MarbleAuthor
10-Marble
August 31, 2011
Hello All,

We tried with C# also for invoke the web service call and find the below snippets. The VB code will be basically the same minus the semi-colons. Any help would be appreciated.

com.vce.plm.IESoapServlet t = new com.vce.plm.IESoapServlet();
string tFoo = t.jwsinterface("10-0891", ", ","wt.change2.WTChangeOrder2");

Thanks,
Saravanan10-MarbleAuthor
10-Marble
August 31, 2011
Hello All,

Please find the below full C# code.

com.vce.plm.IESoapServlet t = new com.vce.plm.IESoapServlet();
t.UseDefaultCredentials = true;
System.Net.NetworkCredential tCreds = (System.Net.NetworkCredential)t.Credentials;
tCreds.UserName = "ws_test";
tCreds.Password = "ws_test";
t.UseDefaultCredentials = false;
t.Credentials = tCreds;
string tFoo = t.jwsinterface("10-0891", ", ","wt.change2.WTChangeOrder2");

We get authorization required (401) exception. Any help would be appreciated.

Thanks,
12-Amethyst
September 1, 2011






HttpWebRequest request = (HttpWebRequest .Create(pubMonUrl);


UTF8Encoding

request.Headers["Authorization" .ToBase64String(credentialBuffer);





// execute the request




)request.GetResponse();





~Jamie

1-Visitor
September 2, 2011
Microsoft support site recommends two approaches for surpassing this issue.



Saravanan10-MarbleAuthor
10-Marble
September 2, 2011
Thank you for all your reply.

The below code works for me.

IESoapServlet tProxy = new IESoapServlet();

tProxy.PreAuthenticate = true;
tProxy.UseDefaultCredentials = false;
System.Net.CredentialCache cache = new System.Net.CredentialCache();
cache.Add(new Uri(tProxy.Url), "Basic", new System.Net.NetworkCredential("ws_test", "ws_test", "));
tProxy.Credentials = cache;

string tFoo = tProxy.jwsinterface("10-0891", ", ", "wt.change2.WTChangeOrder2");


Thanks,