Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
new to WSDL SOAP using SSL in vb.net Application, having trouble integrating.

What I have tried:

Hi, I am new to WSDL and soap, I need to integrate a device, we were provided a WSDL file and a .jks file which I think is for SSL certificate. I have successfully referenced the WSDL, but after that I don't have any idea what to do especially like where do I put the IP address and port of the device and all. How do I send it using SSL?

Any help would be very much appreciated.

Thanks
Posted
Updated 8-Nov-16 0:29am
v2

1 solution

First of all...I do not think .NET can handle jks files as source of certificate... you need pfx files...
See here one options how to convert between the two or connect the device vendor for one... Create a PKCS12 (.pfx / .p12) from a JKS / JAVA keystore[^]

As for the WSDL...The moment you referenced[^] VS created a wrapper class using the name you assigned to the reference...
Using that class name you can create an object and call all the exposed methods of the web server...
C#
WebReference service = new WebReference();

X509Certificate2 cert = new X509Certificate2();
cert.Import("client_cert.pfx", "[the password]", DefaultKeySet);

service.Url = "[the actual server address]";

service.ClientCertificates.Add(cert);

service.Method();


(Sorry. Just realized you asked for VB.NET... The difference is only in the language syntax...)

[EDIT]
According to your comments...
You can reference a WSDL in two ways: Web Reference (older) and Service Reference (newer)... In each case there are different ways to set the target address...
For Web Reference:
C#
WebReference.OSAccessService oA = new WebReference.OSAccessService( );
oA.Url = "address-goes-here";

For Service Reference:
C#
ServiceReference.OSAccessClient oB = new ServiceReference.OSAccessClient( );
oB.Endpoint.Address = new System.ServiceModel.EndpointAddress( "address-goes-here" );
 
Share this answer
 
v3
Comments
sampos 9-Nov-16 4:09am    
Hello, thanks for the quick reply.
Itried your solution problem is "service.url" and "service.ClientCertificates.Add(cert)" of web reference is recongized, is it possible there is something wrong with the WSDL file that they gave me?
Kornfeld Eliyahu Peter 9-Nov-16 4:12am    
Not likely... Maybe the way you referenced it is wrong?
Can we point us to the WSDL? Is it public?
sampos 9-Nov-16 21:37pm    
No, it's local WSDL file that they gave me. Is there a way for me to send the file to you privately?

Thanks
sampos 13-Nov-16 21:52pm    
Hi again, this is the link to the file: https://dl.dropboxusercontent.com/u/18176784/Client.wsdl

Hope you can check it and provide a feedback on what am I doing wrong.
Thanks again.
Kornfeld Eliyahu Peter 14-Nov-16 3:19am    
The WSDL perfectly OK... It seems you used it as a Service Reference, while I used it as a Web Reference...
See updated answer for differences...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900