on 06-05-2015 6:39 PM
Hi ,
I just came cross the situation where we need to include the WebService Security (Wsse) on soap header to authenticate against the web service. But in the PowerBuilder 12.6 Classic SoapConnection object doesn't have any method to support this feature to include in Soapheader.
Anyone guide how to implement this token based authentication in the PowerBuilder 12.6 Classic. Greatly Appreciate you support.
If there is no option, then we have to PowerBuilder.NET WCF assembly
Thanks,
Balu
Is there anyway to open defect to address this issue in future release?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Finally I found solution for this.. I create my own proxy class using NVO and implement the reference proxy dll using PBWCF class..
It is working... Sample. Hope this will help our community when they have this kind of issue in PB.NET
Declaration : in NVO.
================
// General public variables
public PBWCF.WCFConnection wcfConnectionObject
// General private variables
private integer m_revision
private Sybase.PowerBuilder.WCFRuntime.Service m_service
public Sybase.PowerBuilder.WCFRuntime.PBWSEUserNameTokenHeader m_tokenheader
public PBWCF.WCFSoapMessageHeader wcfsoapheaderobject
Constructor : of NVO
===================
m_service = create Sybase.PowerBuilder.WCFRuntime.Service
// Revision Number
m_revision = 1
m_service.setRevision(m_revision)
// Assembly name
m_service.setAssemblyName("n_sso_proxy.dll")
// Class name
m_service.setClassName("n_sso_proxy.SSOLoginPortClient")
// Prefix
m_service.setPrefix("")
wcfConnectionObject = create PBWCF.WCFConnection
// EndpointAddress
PBWCF.WCFEndpointAddress d_endpoint
d_endpoint = create PBWCF.WCFEndpointAddress
d_endpoint.URL = "Endpoint URL "
wcfConnectionObject.EndpointAddress = d_endpoint
// BindingType
wcfConnectionObject.BindingType = PBWCF.WCFBindingType.BasicHttpBinding!
PBWCF.WCFBasicHttpBinding d_binding
d_binding= Create PBWCF.WCFBasicHttpBinding
d_binding.TransferMode = PBWCF.WSTransferMode.BUFFERED!
d_binding.MessageEncoding = PBWCF.WSMessageEncoding.TEXT!
d_binding.TextEncoding = PBWCF.WSTextEncoding.UTF8!
d_binding.HostNameComparisonMode = PBWCF.WCFHostNameComparisonMode.STRONGWILDCARD!
d_binding.MaxBufferPoolSize = 524288
d_binding.MaxBufferSize = 65536
d_binding.MaxReceivedMessageSize = 65536
d_binding.AllowCookies = false
//d_binding.BypassProxyOnLocal = false
// ReaderQuotas
d_binding.ReaderQuotas = Create PBWCF.WCFReaderQuotas
d_binding.ReaderQuotas.MaxArrayLength = 131072
d_binding.ReaderQuotas.MaxBytesPerRead = 32768
d_binding.ReaderQuotas.MaxDepth = 32
d_binding.ReaderQuotas.MaxNameTableCharCount = 131072
d_binding.ReaderQuotas.MaxStringContentLength = 65536
d_binding.BypassProxyOnLocal = true
// Security
d_binding.Security = Create PBWCF.BasicHttpSecurity
d_binding.Security.SecurityMode = PBWCF.BasicHttpSecurityMode.TRANSPORTCREDENTIALONLY!
//d_binding.Security.Message.ClientCredentialType =PBWCF.BasicHttpMessageCredentialType.USERNAME!
// Transport Security
d_binding.Security.Transport.ClientCredentialType = PBWCF.HttpClientCredentialType.BASIC!
d_binding.Security.Transport.Realm = ""
//d_binding.Security.SecurityMode = PBWCF.BasicHttpSecurityMode.MESSAGE!
//d_binding.Security.Message.ClientCredentialType = PBWCF.BasicHttpMessageCredentialType.USERNAME!
//d_binding.Security.Message.SecurityAlgorithm = PBWCF.SecurityAlgorithmType.DEFAULT!
wcfsoapheaderobject = create PBWCF.WCFSoapMessageHeader
wcfsoapheaderobject.AddWSEUserNameToken( "UserName", "Passowrd")
wcfConnectionObject.SoapMessageHeader = wcfsoapheaderobject
wcfConnectionObject.BasicHttpBinding = d_binding
// Proxy Security
wcfConnectionObject.ProxyServer.CredentialType = PBWCF.HttpProxyCredentialType.BASIC!
wcfConnectionObject.ProxyServer.UseDefaultWebProxy = true
m_service.setConnectionOption(wcfConnectionObject)
Destructor : of NVO
===================
destroy wcfsoapheaderobject
destroy wcfConnectionObject
destroy m_service
Function to Call Method WS method:
============================
String ls_str
//n_sso_proxy.loginRequest request
// Set Connection Object
m_service.setConnectionOption(wcfConnectionObject)
// Set Method
m_service.setMethodName("login")
// Pass Arguments
m_service.removeAllArguments()
//m_service.addArgument(request, "n_sso_proxy.login", false, false)
// Set Return Type
m_service.setReturnType("string")
// Invoke the Service
m_service.Invoke()
// Get Return Value
//n_sso_proxy.loginResponse svcReturnValue
ls_str = m_service.getReturnValue().ToString()
return ls_str
Calling Method in WCF client
WS_Call.n_sso_proxy svc
svc = create WS_Call.n_sso_proxy
try
svc.wcfConnectionObject.ClientCredential.UserName.Domain = "XXX"
svc.wcfConnectionObject.ClientCredential.UserName.UserName="UserName"
svc.wcfConnectionObject.ClientCredential.UserName.Password="Password"
st_1.Text = svc.login()
Catch (System.Exception ee)
st_1.Text = string(ee.GetBaseException() )
End try
Thanks all for giving suggestions. Appreciated!
Hi Bala,
Need your help to know, how Single sing on can be implemented in PowerBuilder(12.5) application. How to authenticate a user using Active directory?
Please, Email me the steps on sourabhjn15@gmail.com.
Thanks,
Sourabh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hope you are asking on PowerBuilder 12.5 Classic version.
1. Create the Proxy Object for the LDAP WSDL using Powerbuilder Proxy Generator Project use .Net engine method while building the proxy, because it gives some additional method for invoking the service.
2. Import the PowerBuilder .net soap objects extension from the shared folder.
3. Create a nvo object to create soap connection and initiated the soap connect with Proxy URL.
4. Call the respective method by passing usename and password and get authenticated.
5. Since you are using single sign on with Active Directory, you need to create a common id to connect the database and make sure you are encryting password in the application. We can't hard code the password in the application, since on PBD also you can view the password.
6. Authenticate against the LDAP and once it is authenticated use the common id to connect the database.
If you have any specific question, please let me know
I think you have to build your WS proxy using wsewsdl3.exe (is part of Microsoft WSE: Download Web Services Enhancements (WSE) 3.0 for Microsoft .NET from Official Microsoft Download Cen...).
So you can't build it with PB.NET.
Once you have an assembly with the proxy you can call that from Classic using a COM Callable Wrapper.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
- I would try to create your call in Visual Studio/C#.
- Compile your project as an C# Library with the ComVisible flag.
- Use your library in your PB application.
Using .NET class with PowerBuilder 12.5 Classic (version ...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If there is no option, then we have to PowerBuilder.NET WCF assembly
That's basically your only option.
Once you've created a proxy in PB.Net you can call that from Classic using a COM Callable Wrapper.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When try to generate the WCF proxy client I am getting the below error.. Could anyone you faced this issue ?
Exception: Object reference not set to an instance of an object.
Because of this proxy class is not generating in the PB.NET. I am using PB 12.6. Net
-------- Generate WCF proxy objects --------
Using Project p_wcfclient
Validating project properties...
Generating WCF client assembly: C:\PB_WORK-12.6\PBL12_Local\WebService_test_PBNET\n_nvo_proxy.dll
Using WSDL: http://spsoa-uat01v:21111/sst/runtime.asvc/com.actional.intermediary.Access_Manager_Token_Service.Ac...
Loading WCF client assembly: c:\pb_work-12.6\pbl12_local\webservice_test_pbnet\n_nvo_proxy.dll...
1 Services Added. 4 DataClasses Added.
Unloading Assembly.
Loading WCF client assembly: C:\PB_WORK-12.6\PBL12_Local\WebService_test_PBNET\n_nvo_proxy.dll...
Deleting 0 existing proxy objects in proxy.pbl (C:\PB_WORK-12.6\PBL12_Local\WebService_test_PBNET)...
0 proxy objects deleted.
Generating proxy object code in proxy.pbl (C:\PB_WORK-12.6\PBL12_Local\WebService_test_PBNET)...
Exception: Object reference not set to an instance of an object.
Unloading Assembly.
-------- WCF proxy generation finished --------
Can you verify with something like SoapUI that the service is working?
User | Count |
---|---|
79 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.