cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with ws_security element in soap message

Former Member
0 Kudos

Hi!

I have to consume a web service via PB 12.5. The service has authentication but in WSDL there is not any element about ws Security.

It crushes and tell me that the security element is missing from the soap message.

I must put the ws element inside soap message. My problem seems the same with

https://groups.google.com/forum/?fromgroups=#!topic/sybase.public.powerbuilder.webservices/Y--ZJcBs_...

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

former_member190719
Active Contributor
0 Kudos

The question is what kind of authentication it requires.  For example, if it's just looking for Basic Authentication, there is a SetBasicAuthenication method on the SOAPConnection object you can use to pass that info:  There are other methods that can be used to use a certificate or windows authentication.

However, if the service is looking for full on WS-Security (as you indicate), then you'll need to look at use the WCF client in PowerBuilder.Net.  Then the issue becomes knowing what it is you need to pass.  WS-Security has a lot of options.  For example, the Amazon Web Services require that you pass an access key called "AWSAccessKeyId" and then sign and timestamp the message header using a se....  That's implemented in a WCF proxy as follows:

_client.wcfConnectionObject.SoapMessageHeader.AddMessageHeaderItem(&

          "AWSAccessKeyId",&

    "http://security.amazonaws.com/doc/2007-01-01/",&

    _accessKeyId,&

    PBWCF.WCFHMAC.NONE!,&

    "")

_client.wcfConnectionObject.SoapMessageHeader.AddMessageHeaderItem(&

          "Signature",&

    "http://security.amazonaws.com/doc/2007-01-01/",&

    _secretKey,&

    PBWCF.WCFHMAC.HMACSHA256!,&

    "")

former_member190719
Active Contributor
0 Kudos

Did this resolve your question?

If so, can you mark the question answered and indicate which responses you found helpful and/or correct.

If not, could you let us know what you still have questions about?

Answers (1)

Answers (1)

Former Member
0 Kudos

Try to update the security section in your proxy object with the following code. It should automatically build the message header items for you.

// Security

d_binding.Security =

Create PBWCF.BasicHttpSecurity


d_binding.Security.SecurityMode = PBWCF.BasicHttpSecurityMode.TRANSPORTWITHMESSAGECREDENTIAL!

   

// Transport Security


    d_binding.Security.Transport.ClientCredentialType =

PBWCF.BasicHttpMessageCredentialType.

USERNAME!

wcfConnectionObject.BasicHttpBinding = d_binding

wcfConnectionObject.ClientCredential.UserName.UserName = 'xyz'

wcfConnectionObject.ClientCredential.UserName.Password = 'abc'