Page 2 of 2

Re: add record to lookup programmatically

Posted: Wed Jan 14, 2009 2:33 pm
by roteague
czentman wrote:I was able to explicity create that sps by doing Dim sps As New SoftPro.Select.Client.SelectServer(New Uri("http://localhost:8080/SelectServer"), creds) and avoid that error.

I still can't find the reference for NetworkCredential and Lookups. I tried adding other references from select and I can't seem to find it.
using SoftPro.OrderTracking.Common;
using SoftPro.OrderTracking.Client;

Re: add record to lookup programmatically

Posted: Wed Jan 14, 2009 2:37 pm
by czentman
I have ordertracking.common but which one is ordertracking.client? I can't seem to find the dll for this,

Re: add record to lookup programmatically

Posted: Wed Jan 14, 2009 2:59 pm
by czentman
Thank you. I got the ordertracking.client and can finally compile the project!

Re: add record to lookup programmatically

Posted: Wed Jan 14, 2009 3:22 pm
by czentman
When trying to run this - I get the following error:

"Invocation of command threw an exception.

Could not connect to http://localhost:8080/SelectServer/Inte ... curity.svc. TCP error 10061: No connection could be made because the target machine actively refuses it 127.0.0.1.8080."

Should I be putting something else in the code?

Dim sps As New SoftPro.Select.Client.SelectServer(New Uri("http://localhost:8080/SelectServer"), creds)

Re: add record to lookup programmatically

Posted: Wed Jan 14, 2009 3:45 pm
by czentman
I changed it to just localhost and then I more generic error - "security error".

I tried tried the url - http://localhost/SelectServer/Integrati ... curity.svc and I get the following but I don't think this really helps me.

SecurityService Service


You have created a service.

To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax:



svcutil.exe http://ts1.workgroup.madisontitle.com/S ... y.svc?wsdl

This will generate a configuration file and a code file that contains the client class. Add the two files to your client application and use the generated client class to call the Service. For example:


C#

class Test
{
static void Main()
{
AuthorizationClient client = new AuthorizationClient();

// Use the 'client' variable to call operations on the service.

// Always close the client.
client.Close();
}
}



Visual Basic

Class Test
Shared Sub Main()
Dim client As AuthorizationClient = New AuthorizationClient()
' Use the 'client' variable to call operations on the service.

' Always close the client.
client.Close()
End Sub
End Class

Re: add record to lookup programmatically

Posted: Wed Jan 14, 2009 4:28 pm
by roteague
What you see in the browser is correct. You have essentially connected to a WCF service (that's what a .svc file is). You don't need to create a client, just use the code that was provided.

Re: add record to lookup programmatically

Posted: Thu Jan 15, 2009 10:59 am
by czentman
But the code that was provided is still giving me this security error. What am I doing wrong?

Re: add record to lookup programmatically

Posted: Thu Jan 15, 2009 11:27 am
by czentman
Do you know what's supposed to go in the NetworkCredential parameters? I also tried my own userid and pwd (that I was able to log in to the db with) and it doesn't works? Any ideas here? I still have the security error. I'm also not sure what the url should be for sps New Uri - http://localhost/SelectServer or http://localhost/SelectServer/Integrati ... curity.svc or http://ts1.workgroup.madisontitle.com/S ... y.svc?wsdl. What should be here, nothing seems to work.... but it could be because of the previous statement with the network credentials not being correct.

Dim creds As New NetworkCredential("admin", "Passw0rd", "[apps\sp]")
'Dim sps As New SoftPro.Select.Client.SelectServer(New Uri("http://localhost/SelectServer"), creds)

Dim sps As New SoftPro.Select.Client.SelectServer(New Uri("http://localhost/SelectServer"), creds)

Re: add record to lookup programmatically

Posted: Thu Jan 15, 2009 11:41 am
by czentman
I got it!!! Thanks for all your help. I found another thread called "Accessing Lookups via API" where John Morris gave similar but a drop different coding for network credentials

//create the server connection
NetworkCredential credentials = new NetworkCredential("admin", "Passw0rd", Constants.SelectDomain);
SelectServer sps = new SelectServer("http://localhost/SelectServer", credentials);

with Constnacts.SelectDomain - that the code by my thread was different. Great! I'm on the right track now. Thanks to all!