on 11-22-2012 7:48 AM
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
Thanks
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!,&
"")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
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.