Skip to Content
avatar image
Former Member

PowerBuilder 12.6 will support Web Service Security on SoapConnection

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    avatar image
    Former Member
    Jun 09, 2015 at 02:51 PM

    Is there anyway to open defect to address this issue in future release?

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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!

  • Jun 05, 2015 at 05:57 PM


    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 06, 2015 at 12:08 PM

    - 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 ...

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Ben;

        For the interim I think that your suggestion is the best. I'm not hopeful that PB.Net based on VS 2010 is now robust enough to build leading edge web services. The other aspect that's getting  my spidey senses tingling is if the PB.Net IDE will even continue.

      Regards .. Chris

  • Jun 08, 2015 at 06:21 AM

    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 Center).

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 17, 2015 at 04:10 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Balu,

      I am able to call the webservice but I am getting message 'No security header in message but required by policy'. Looks like It is expecting a header to be passed in request. Could you please let me know how to create an header and pass it in request.