on 02-12-2014 4:24 PM
Regardless of the changes i make to the application code the config file generated on deployment remains the same. If i make modifications to the config file from a text editor,those changes are overwritten upon deployment. How does PB.net 12.5 tie in the application with the configuration file???I have tried deleting the configuration file and the application doesn't seem to be affected in any drastic way.
Andre Reid wrote:
Regardless of the changes i make to the application code the config file generated on deployment remains the same. If i make modifications to the config file from a text editor,those changes are overwritten upon deployment. How does PB.net 12.5 tie in the application with the configuration file???I have tried deleting the configuration file and the application doesn't seem to be affected in any drastic way.
Unlike VS.Net, PB.Net does *not* use the settings in the web.config file to customize the behavior of the web service. PB.Net ignores that file with regard to web services. You need to add the security configuration via PowerScript.
See, for example, the last code example on the first page of this article:
Creation and Consumption of Web Services with PowerBuilder | PowerBuilder Journal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your reply Bruce it is much appreciated. I have read the article quite a few times. I am however a bit confused as to how security configuration utilizing certificates can be added with PowerScript. I've created a service in PB 12.5.net certificates added and successfully called the service with a .NET client but and i am creating the PB.net client now. As you can see from the other post i made i cant seem to get the security configuration correct for a certificate form the PB.net client. A bit of guidance please.
FYI The error i receive is
"The client certificate is not provided. Specify a client certificate in ClientCredentials. " |
Take a look at this earlier thread:
It gets into the basics of how to start setting up WS-Security, except that case is a username / password example.
Look at the WCFClientCredential class, and you'll see there is ClientCertificate option as well:
And here's specs on how to use the ClientCertificateCredential class, which is how you populate ClientCertificate.
I have tired what you said above over and over many times,created a new project and tried again same result. I have also read that topic many times as well.This forum was my last resort. Take a look at the images below and you will see the certificate is set but the exception is still thrown
I set the certificate in code here.
You can see the certificate is set here in ClientCredentials
For extra measure i set for the proxy server as well
But the same exception is thrown
And the inner exception
After days and weeks now i have the same exception.
The only place i see where the certificate is not set is here
If this the source of all my troubles how do i set the certificate there?
I missed the fact (despite your having put it in the subject) that you were trying to pass a certificate for WS-Security. The example I gave you was for authentication. For WS-Security, try the following:
BasicHttpSecurity security
security = create BasicHttpSecurity()
security.SecurityMode = BasicHttpSecurityMode.TRANSPORTWITHMESSAGECREDENTIAL!
security.Message.ClientCredentialType = BasicHttpMessageCredentialType.CERTIFICATE!
WCFBasicHttpBinding binding ;
binding = create WCFBasicHttpBinding()
binding.Security = security ;
client.wcfConnectionObject.BasicHttpBinding = binding ;
client.wcfConnectionObject.BindingType = WCFBindingType.BasicHttpBinding!
ClientCertificateCredential cert ;
cert = create ClientCertificateCredential()
cert.SubjectName = <subject of your certificate>
cert.StoreLocation = CertStoreLocation.CurrentUser!
cert.StoreName = CertStoreName.My!
WCFClientCredential credential ;
credential = create WCFClientCredential()
credential.ClientCertificate = cert
client.wcfConnectionObject.ClientCredential = credential
Thanks once more for your reply Bruce. Your code above would have a few contradictions to my set up. One of which i see as the binding. I am using WS Security with wsHttpBinding. Here is the auto generated code from the constructor of my code of the WCF Client Proxy. I can post the .config of the service if that will help.
m_service = create Sybase.PowerBuilder.WCFRuntime.Service
// Revision Number
m_revision = 1
m_service.setRevision(m_revision)
// Assembly name
m_service.setAssemblyName("assembly_testclient.dll")
// Class name
m_service.setClassName("assembly_testclient.n_customnonvisualClient")
// Prefix
m_service.setPrefix("")
wcfConnectionObject = create PBWCF.WCFConnection
// EndpointAddress
PBWCF.WCFEndpointAddress d_endpoint
d_endpoint = create PBWCF.WCFEndpointAddress
d_endpoint.URL = "http://itu-supr-anl-06.cojamaica.com/_wcfservice/n_customnonvisual.svc"
// Identity
d_endpoint.Identity = create PBWCF.WCFEndpointIdentity
d_endpoint.Identity.Type = PBWCF.WCFEndpointIdentityType.DNS!
d_endpoint.Identity.IdentityValue = "localhost"
wcfConnectionObject.EndpointAddress = d_endpoint
// Timeout
wcfConnectionObject.Timeout = "00:10:00"
// BindingType
wcfConnectionObject.BindingType = PBWCF.WCFBindingType.wsHttpBinding!
// Binding
PBWCF.WCFwsHttpBinding d_binding
d_binding= Create PBWCF.WCFwsHttpBinding
d_binding.MessageEncoding = PBWCF.WSMessageEncoding.TEXT!
d_binding.TextEncoding = PBWCF.WSTextEncoding.UTF8!
d_binding.TransactionFlow = FALSE
d_binding.MaxBufferPoolSize = 524288
d_binding.MaxReceivedMessageSize = 65536
d_binding.AllowCookies = false
d_binding.BypassProxyOnLocal = false
d_binding.HostNameComparisonMode = PBWCF.WCFHostNameComparisonMode.STRONGWILDCARD!
// ReliableSession
d_binding.ReliableSession = Create PBWCF.WCFReliableSession
d_binding.ReliableSession.Enabled = false
d_binding.ReliableSession.Ordered = true
d_binding.ReliableSession.Duration = 600
// ReaderQuotas
d_binding.ReaderQuotas = Create PBWCF.WCFReaderQuotas
d_binding.ReaderQuotas.MaxArrayLength = 16384
d_binding.ReaderQuotas.MaxBytesPerRead = 4096
d_binding.ReaderQuotas.MaxDepth = 32
d_binding.ReaderQuotas.MaxNameTableCharCount = 16384
d_binding.ReaderQuotas.MaxStringContentLength = 8192
// Security
d_binding.Security = Create PBWCF.wsHttpSecurity
d_binding.Security.SecurityMode = PBWCF.wsSecurityMode.MESSAGE!
// Message Security
d_binding.Security.Message.ClientCredentialType = PBWCF.MessageCredentialType.CERTIFICATE!
d_binding.Security.Message.SecurityAlgorithm = PBWCF.SecurityAlgorithmType.DEFAULT!
d_binding.Security.Message.EstablishSecurityContext = FALSE
d_binding.Security.Message.NegotiateServiceCredential = FALSE
wcfConnectionObject.wsHttpBinding = d_binding
// Proxy Security
wcfConnectionObject.ProxyServer.CredentialType = PBWCF.HttpProxyCredentialType.NONE!
wcfConnectionObject.ProxyServer.UseDefaultWebProxy = TRUE
m_service.setConnectionOption(wcfConnectionObject)
Your code above would have a few contradictions to my set up. One of which i see as the binding. I am using WS Security with wsHttpBinding.
All I can give you is general guidance. You'll have to fine tune it for the specific configuration. There are just too many options available in WS-Security for me to give you a script that would work with every configuration.
Hello Andre,
Did you customize your security settings in the right file (e.g. web_customtrust.config and not web.config)?
Read this link for more details:
Applying Code Access Security in PowerBuilder .NET Applications | PowerBuilder Journal
HTH,
Jacob
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Jacob ZITTOUN wrote:
Hello Andre,
Did you customize your security settings in the right file (e.g. web_customtrust.config and not web.config)?
Read this link for more details:
Applying Code Access Security in PowerBuilder .NET Applications | PowerBuilder Journal
HTH,
Jacob
That article has nothing to do with applying WS-Security to a web service.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.