aspose file tools*
The moose likes JDBC and the fly likes Invoking web service from pl sql, requires a nonce, but I cannot find much info on how to do it Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Invoking web service from pl sql, requires a nonce, but I cannot find much info on how to do it" Watch "Invoking web service from pl sql, requires a nonce, but I cannot find much info on how to do it" New topic
Author

Invoking web service from pl sql, requires a nonce, but I cannot find much info on how to do it

Matt Kohanek
Village Idiot
Ranch Hand

Joined: Apr 04, 2009
Posts: 483

I have many examples of invoking some of my java web services where there is no problem. However, this time I am working with a web service that requires a nonce. So I try to set up the usual logic


and here is the response I am getting:

l_http_response.status_code - 500
l_http_response.reason_phrase - Internal Server Error
v_response_text - <?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><S:Fault xmlns:ns4="http://www.w3.org/2003/05/soap-envelope"><faultcode>S:Server</faultcode><faultstring>com.sun.xml.wss.XWSSecurityException: com.sun.xml.wss.XWSSecurityException: Receiver Requirement for nonce has not been met</faultstring></S:Fault></S:Body></S:Envelope>

So I am not sure how to generate a nonce that can be used.
Like I said, I have searched and searched and have found very little useful info - it is odd - it makes me wonder if I am doing something drastically wrong here heh - even little luck on OTN:
The specified message [10118829] was not found. (this happened when I found some topics that seemed relevant while searching)

I added this to the header:
<wsse:Nonce>v_nonce_key</wsse:Nonce>

and that changes things slightly:
l_http_response.status_code - 500
l_http_response.reason_phrase - Internal Server Error
v_response_text - <?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><S:Fault xmlns:ns4="http://www.w3.org/2003/05/soap-envelope"><faultcode>S:Server</faultcode><faultstring>com.sun.xml.wss.XWSSecurityException: com.sun.xml.wss.impl.WssSoapFaultException: Authentication of Username Password Token Failed</faultstring></S:Fault></S:Body></S:Envelope>

I am sure it is because that nonce comes from a Create_Nonce() procedure we have, which is not at all related to the web service...
Do I need to generate the nonce from the web service? That does not seem to make much sense since it is that web service I am trying to connect to in the first place. I do not have a lot of experience with java services though.

So does anyone possibly have any guidance on this?
I am finding it quite tough to simply find good info online about this, which does not bode well..
My searches have been for things like 'pl sql create nonce' 'pl sql nonce' 'Receiver Requirement for nonce has not been met' etc - lol I am even willing to get suggestions on better search terms... that is how poorly research is going ha
The only semi useful info I have found has had 0 to do with pl sql - http://www.reliablesoftware.com/articles/WSESecurity.html


True wisdom is in knowing you know nothing - Socrates
Matt Kohanek
Village Idiot
Ranch Hand

Joined: Apr 04, 2009
Posts: 483

Well it was annoying but I got it to work - maybe this will help others...
Since the service wants a nonce, but also wants a plain text password, I am able to get this working by generating a nonce for each invocation, adding it to the header along with a valid timestamp and current time (getting this time right was a bit of a hassle too even, kept telling me my dates were not good for various reasons...)

So basically it goes something like this:



The nonce key generation is necessary, because you cannot use the same nonce twice.

edit
now I need to figure out how to create the timestamp portion of this correctly. I am not sure if just giving an an arbitrary expiration date is a good idea - anyone have any guidance on how this is typically set?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Invoking web service from pl sql, requires a nonce, but I cannot find much info on how to do it