add record to lookup programmatically

Discussions related to writing and managing custom business rules.

Moderator: Phil Barton

roteague
Posts: 292
Joined: Thu Sep 25, 2008 4:49 pm
Location: Honolulu, Hawaii

Re: add record to lookup programmatically

Post by roteague » Wed Jan 14, 2009 2:33 pm

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;
Robert

czentman
Posts: 157
Joined: Tue Dec 02, 2008 12:02 pm

Re: add record to lookup programmatically

Post by czentman » Wed Jan 14, 2009 2:37 pm

I have ordertracking.common but which one is ordertracking.client? I can't seem to find the dll for this,

czentman
Posts: 157
Joined: Tue Dec 02, 2008 12:02 pm

Re: add record to lookup programmatically

Post by czentman » Wed Jan 14, 2009 2:59 pm

Thank you. I got the ordertracking.client and can finally compile the project!

czentman
Posts: 157
Joined: Tue Dec 02, 2008 12:02 pm

Re: add record to lookup programmatically

Post by czentman » Wed Jan 14, 2009 3:22 pm

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)

czentman
Posts: 157
Joined: Tue Dec 02, 2008 12:02 pm

Re: add record to lookup programmatically

Post by czentman » Wed Jan 14, 2009 3:45 pm

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

roteague
Posts: 292
Joined: Thu Sep 25, 2008 4:49 pm
Location: Honolulu, Hawaii

Re: add record to lookup programmatically

Post by roteague » Wed Jan 14, 2009 4:28 pm

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.
Robert

czentman
Posts: 157
Joined: Tue Dec 02, 2008 12:02 pm

Re: add record to lookup programmatically

Post by czentman » Thu Jan 15, 2009 10:59 am

But the code that was provided is still giving me this security error. What am I doing wrong?

czentman
Posts: 157
Joined: Tue Dec 02, 2008 12:02 pm

Re: add record to lookup programmatically

Post by czentman » Thu Jan 15, 2009 11:27 am

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)

czentman
Posts: 157
Joined: Tue Dec 02, 2008 12:02 pm

Re: add record to lookup programmatically

Post by czentman » Thu Jan 15, 2009 11:41 am

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!

Post Reply