473,804 Members | 3,196 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help adding service reference

Hi,

I was wondering if it was possible to add a service reference to a web
service which requires an SSL certificate to authenticate? If not, if
I have the SSL certificate installed via mmc snap-in, is there another
way to send an XML payload to the web service with an SSL certificatre
attached to the request?

Appreciate any thoughts on this as I am a bit of a newbie.

Thanks
Jun 27 '08 #1
5 7723
Can I check - the issue here is adding the reference in the first
place, yes? In which case, you might try obtaining the metadata
separately; most tools such as wsdl.exe, wse3wsdl.exe (for regular
SOAP and WSE3 SOAP respectively) and svcutil.exe (for WCF) will accept
a .wsdl or .xsd (or .discomap) at the command line. It might not be as
shiny as the VS window, but it'll work (and give you more options
too).

You can normally obtain the wsdl by doing (for example) ?wsdl on an
asmx. WCF has a different protocol (mex), but if it is disabled it
shows you a help screen instead telling you how to enable it.

Marc
Jun 27 '08 #2
If I misunderstood, and the issue is *using* the SSL web-service at
runtime, then you'll need to write some code. For wse/wse3 you can add
to the ClientCertifica tes collection; for WCF (which is what I
understand for "service reference"), there
is .ClientCredenti als.ClientCerti ficate; either set .Certificate, or
call .SetCertificate (). I think you can also do this via config, but I
can't remember how exactly off-hand.

Marc
Jun 27 '08 #3
On Jun 10, 8:46 am, Marc Gravell <marc.grav...@g mail.comwrote:
If I misunderstood, and the issue is *using* the SSL web-service at
runtime, then you'll need to write some code. For wse/wse3 you can add
to the ClientCertifica tes collection; for WCF (which is what I
understand for "service reference"), there
is .ClientCredenti als.ClientCerti ficate; either set .Certificate, or
call .SetCertificate (). I think you can also do this via config, but I
can't remember how exactly off-hand.

Marc
Hi Marc,

Thanks for your replies. The web service I am trying to connect to
needs an ssl certificate otherwise I cannot connect to it. I have
tried using the code below but I keep getting "Unable to connect to
the remote server". I have also made sure that it ignores all
certifcate error but that also doesn't work.

webRequest.Clie ntCertificates. Add(GetCertific ate());

private X509Certificate GetCertificate( )
{
///Set store to LocalMachine as this is where the
certificates must be installed
X509Store store = new X509Store(Store Name.My,
StoreLocation.L ocalMachine);
store.Open(Open Flags.ReadOnly) ;
///Find certificate based on it's name
X509Certificate 2Collection certificates =
store.Certifica tes.Find(X509Fi ndType.FindBySu bjectName, this.sslName,
true);
return certificates[0];

}

The following code which is in the constructor of the class ignores
the ssl cert errors.

ServicePointMan ager.ServerCert ificateValidati onCallback =
TrustAllCertifi cateCallback;

public static bool TrustAllCertifi cateCallback(ob ject sender,
X509Certificate cert, X509Chain chain, SslPolicyErrors
errors)
{
return true;
}
Jun 27 '08 #4
Maybe I'm being daft; you mentioned SSL to authenticate, so I was
thinking client certificates; but if you actually mean an ssl (https)
certificate, then just ensure that you connect over https. WCF uses
this approach, and won't accept username/password pairs
(TransportWithM essageCredentia l) unless the transport provides
encryption.

However, most service code is very picky, and wants that certificate
to be properly trusted. Is this the issue? You don't trust the
certificate the server is issuing? In which case MMC would be your
first port of call (or get a better certificate at the server). In
fact, WCF even demands that the servers agree on the time (UTC)...

Marc
Jun 27 '08 #5
On Jun 10, 10:00 am, Marc Gravell <marc.grav...@g mail.comwrote:
Maybe I'm being daft; you mentioned SSL to authenticate, so I was
thinking client certificates; but if you actually mean an ssl (https)
certificate, then just ensure that you connect over https. WCF uses
this approach, and won't accept username/password pairs
(TransportWithM essageCredentia l) unless the transport provides
encryption.

However, most service code is very picky, and wants that certificate
to be properly trusted. Is this the issue? You don't trust the
certificate the server is issuing? In which case MMC would be your
first port of call (or get a better certificate at the server). In
fact, WCF even demands that the servers agree on the time (UTC)...

Marc
Hi,

The client SSL certificate is installed correctly and is trusted. The
web service requires that I attach the client SSL certificate with the
https request, if I don't it will not allow me to connect to their
service. I have used the code above which picks the correct
certificate from the certificate store and attaches it, however when I
send the request I get an "Unable to connect to server" message, which
is basically telling me that the certificate wasn't attached. I was
able to do something similar in VB6 using WinHTTP which worked a
treat, but I can't get it to work in C#.

Appreciate any suggestions.
Jun 27 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1364
by: John | last post by:
What si the difference between Adding a Reference and actually dragging and dropping an activeX control onto a form? Thanks John ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
2
938
by: Michael Barrido | last post by:
Greetings! I have a project that needs to access a web service. My problem is this web service is provided via CGI. I cannot do a "Web Reference" to it to add in my dotnet project. I'm planning to use instead the System.Net.WebClient to HTTP POST to this Web Service so I can retrieve any return values from it. The code bellow is what the CGI web service expect to receive from my end. How do I "HTTP POST" this to...
0
4617
by: Saumendra | last post by:
Hi guys, When I am adding a Web Reference in Visual Studio.net, I provide the url to the .vsdisco file, so that Visual Studio.net can dynamically discover all the available Web Services. Now when I do this, I get a list of all the Web Services. Next I want add reference to all these Web Service to my Visual Studio.net project, and so I hit "Add reference" button on the Add Reference dialog box. By doing this I THOUGHT all the Web...
6
5002
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing for long running reports. When the processing is complete it uses crystal reports to load a template file, populate it, and then export it to a PDF. It works fine so far....
1
1586
by: Jeff Dillon | last post by:
I'm using the webservice I've created: http://www.emergencyreporting.com/ERSWebService/ERSDispatch.asmx When building a client VB.NET app, and adding a web reference to the above file, I see that the client is creating extra methods. For my IncidentOpen method, the client is adding methods like BeginIncidentOpen and EndIncidentOpen. This is not an async web service, is there a corresponding web service setting I need to set so these...
3
5768
by: MIGUEL | last post by:
Hi all, I'm quite lost with how adding web references to a project creates proxy classes. I've developed a web service with two classes inside and that contains three references to three DLLs. After building it up, I've deployed it on the web server. From my Windows application, I then add a web reference to that web service.
1
3640
by: rgarf | last post by:
I have a web service that is consumed by a C++ application. I added a C# dll reference to the web service, When the web service calls a method on the dll, it sends back an HRESULT of E_FAIL to my C++ application. What is causing the web service to return an E_FAIL when it calls the method on the dll it added as a reference? Thanks
4
3734
by: glebur | last post by:
Hi, I'm trying to create a web service client in C# but I get stuck at one of the first steps. When adding a Web reference to the Visual Studio project; I get this error (this is a translation, the English terms might not be exact) : "Error in the custom tool : Impossible to import WebService/Schema. Impossible to import binding 'cmsserverbinding' (it's the name of the binding in my WSDL file) from namesapce 'urn:cms. Impossible to...
0
1712
by: Michael Höhne | last post by:
Hi, we're developing some web services and use the local development server of Visual Studio 2005 to create, run and debug the project. The web service methods connect to a database hosted on a dedicated server and the Microsoft CRM 3.0 server, also on a separate machine. As the CRM server installation makes changes to the Active Directory, they are located in a separate domain, while the development machines are member of the companies...
4
6914
by: =?Utf-8?B?Z3Jhenph?= | last post by:
Hello If someone can help me with this it would be greatly appreciated. I’m no web service expert but I don't think i'm trying to do anything too special. I think i must be missing something simple because i have been banging my head against a wall with this for a while now. I have created a web service and a client Win forms application to consume the web service. The problem is i don't know where the web service will be deployed...
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9579
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10578
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10332
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10321
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7620
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3820
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2991
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.