How to send/select the clientcertificate in a HTTPRIO client application? - web-services

I am creating a client application from WSDL files I imported.
In Embarcadero Rad Studio 10.2 my application automatically asks which client certificate to use (from the Windows certificate store I guess). In 10.3 it doesn't.
How can I define in my HTTPRIO object to use a specific client certifate (a .p12 file)?
*Edit:
I made some progress with this line:
RIO.HTTPWebNode.InvokeOptions := [soPickFirstClientCertificate];
In Rad Studio 10.3 this will also make the application use the certificate (without asking to pick a certificate).

Related

wince 6 smart device Could not establish secure channel for SSL / TLS error

I have a web service which i need to access through https. We have a workbout pro 4 with win ce 6.0 running on it. When we were developing our app we had tested it through http. wihtout any problem. When we went live and needed access to https based server we have received the error stated on subject field under VS 2008 Smart Device Project. On the device we receive an error "could not display..." . We have tried to import the standard certificate issued by global si. We still have no success accessing the web service. We can acces the web service on phone, tablet, pc but not with Pro 4:). It would be kind if anyone can share his/her experience with https based web service access or can guide us to over come our problem.
Secure connection is not implemented on CE fully. Something to do with cert management. Here is what i am considering for my project and it gives a little more info what the issue is. http://labs.rebex.net/HTTPS
Here is some quotes from the site in case its down or something.
.NET Compact Framework does not support TLS 1.2, 1.1, SNI or SHA-2
based certificates.
.NET CF's HttpWebRequest is outdated. It does not support TLS 1.2 or
1.1, it doesn't support Server Name Identification (SNI), and it does not support SHA-2 in X509 certificates. It also suffers from several
authentication-related bugs with no known workaround. This makes it
unusable in a growing number of scenarios, and Microsoft will never
fix this because it no longer cares about these legacy platforms.
Fortunately, it's now possible to work around these shortcomings using
a beta version of Rebex HTTPS library. It features a HttpWebRequest
replacement object for .NET Compact Framework that plugs into the
existing .NET CF WebRequest API and provides the features the default
HTTP/HTTPS provider lacks. Most importantly, it adds support for TLS
1.2, TLS 1.1, SNI and SHA-2, it works even on old devices based on Windows CE 5.0 and it makes it simple to add TLS 1.2 support to
existing SOAP web service clients.
We had a similar issue on CE 7.0.
HTTPS connections using SHA1 certificates would work, however ones with SHA2 certificates would return the error
Could not establish trust relationship with remote server
If possible, try testing your code against a host that uses a SHA1 certificate to see if the issue might be related to missing SHA2 support in CE 6.0.
I should mention that we never formally approached Microsoft to get confirmation on whether SHA2 was supported or not in CE 6.0/7.0, it was just our conclusion after numerous tests that it wasn't.

How to host a Wcf service in Windows server 2008 R2?

I am toothily new to server side and I want host a web service in my newly created windows server 2008 r2 virtual machine. however i cannot get it up there. I am getting errors after such as MIME type, sometimes files get downloaded, Permission errors, protocol mapping.
Therefore, I would like to know how to host a WCf Application from the begining. Thanks in advance
Here are excellent guides you can refer to host a WCF service in Windows Server 2008 R2:
http://broomandan.blogspot.in/2011/04/how-to-configure-windows-server-2008-to.html
http://blogs.technet.com/b/meamcs/archive/2014/02/16/wcf-service-manual-deployment-on-windows-server-2008-r2.aspx

Visual Studio web reference - $metadata vs. ?wsdl

This is a legacy project that I have not touched in a while. Now the web reference is causing me trouble.
I connect to a SOAP service from a Windows Mobile 6 client. When the service host runs locally on my development box, I can point the web reference to it and it will discover the WSDL, i.e. it will attempt to pull the service description by appending ?wsdl to the endpoint URL. I can build the app and connect to the service from the emulator.
I can for some reason not point Visual Studio to the current production environment for discovery. There it appends /$metadata to the URL instead of ?wsdl. The wsdl is there and I can view it in a browser, though. The mobile app is live and has been connecting to the service for years.
The HTML document does not contain Web service discovery information.
There was an error downloading 'https://mysite/myservice.asmx/$metadata'.
The request failed with the error message:
--
<html>
<head>
<title>Request format is unrecognized for
I know that it is not possible to discover a web service on a non-standard port from Visual Studio. Does it not work with SSL, either? How does Visual Studio decide to use either method for discovery?Or do you have any other thoughts?
I still have no clue what's going wrong with your service but I can discover webservices on non standard ports adding the port to the url (and the ?wsdl as well) from within WS
http://10.177.55.13:10321/MyServices/?wsdl
If this doesn't help open the wsdl in your browser. Copy the xml code, paste it into your editor and save it as .wsdl file. In VS use the filename as url for the service.
HTH
Ruediger

Simplest Webservice in Delphi

I need to develop a minimalistic webservice.
It should have 2 functions:
senduserdata (a remote app will call "senduserdata" to send info about users, like "ID" and "amount")
sendconfirmation (a remote app will tell "all ok for proccess ID=X, notes are: NOTES)
In past I did a SOAP dll that needs IIS to run, since deployment is crucial in my case and IIS is not always available is it possible to have a standalone exe that exposes the SOAP (or REST) interface?
I succeded in a few minutes using the RemObjects trial and setting SOAP as communication protocol in a server + client project group (note: i need server only).
With a VCL EXE i can deploy much easier (i have lots of customers, and accessing their IIS to install a dll it is sometimes too hard).
Yes, you can use any TCP library for Delphi which includes a HTTP server, for example Internet Direct (Indy). With Indy, you can create a stand-alone application (or better, a windows service) without IIS.
In a RESTful web application, the senduserdata command would be implemented by a URL like
http://example.com/api/users
The clients then use a HTTP PUT or PATCH request to update the users resource.
A senduserdate call for user id 774422 would be written like
LStream := TStringStream.Create('{ "amount":100.50, "currency":"EUR" }');
try
HTTP := TIdHTTP.Create;
try
HTTP.Put('http://example.com/api/users/774422', LStream);
finally
HTTP.Free;
end;
finally
LStream.Free;
end;
In the the Delphi application for server side, a TIdHTTPServer component then listens for HTTP requests for the /rest/users resource and in the OnCommandOther event handler it would extract the request body string, parse it, and apply the changes to the user with the ID given in the resource path (/774422).

Making SASL(with GSSAPI) enabled client and server with LDAP+kerberos as authenticator? (Single Sign on SSO sytstem)

I have successfully installed ldap and kerberos. I was also able to make a simple c program with SASL/GSSAPI to search data in my ldapserver?
But I was not find any article (that I can follow easily) on how to use the the single sign on functionality in a client server system? I am not even sure how the communication between client and server happens in SSO.
How would a server know that client is a valid client?
Are there any sample examples/tutorials to make such a system?
Edit:
The server can be as simple as receiving hello from authenticated client. So client should have kerberos ticket and server should verify the ticket if it is valid or not.
I could compile gsspapi program using libs and dll provided by MIT.
the files I needed were gsskrb5.dll,gssapi32.lib,comerr32.lib
These will depend upon the version of kerberos for which they were compiled but I was successful in compiling the example given by mit http://web.mit.edu/macdev/KfM/KerberosFramework/Kerberos5/Tools/GSSExample/ using MinGW gcc compiler after few tweaks.
However I could not communicate successfully using SSPI api by microsoft (that may be due to my lack of knowledge)