This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 224990

Summary: SecureCalculatorApp sample app does not seem to work
Product: webservices Reporter: Kenneth Ganfield <kganfield>
Component: WSITAssignee: Denis Anisimov <ads>
Status: REOPENED ---    
Severity: normal CC: cirovladimir, pjiricka
Priority: P4    
Version: 8.2   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:

Description Kenneth Ganfield 2013-01-16 19:10:35 UTC
The SecureCalculatorApp sample created in the New Project window does not appear to work.

1. Create SecureCalculatorApp Web Services sample project.
2. Run SecureCalculatorApp
3. Run SecureCalculatorClientApp

When app opens in browser, click Get Result.
In server log you can see that authentication failed.

INFO: SEC5046: Audit: Authentication refused for [wsitUser].
INFO: SEC1201: Login failed for user: wsitUser

The sample should run pretty much out of the box. If additional configuration is necessary it is not clear what it is.
Comment 1 Kenneth Ganfield 2013-01-16 19:11:20 UTC
Product Version: NetBeans IDE 7.3 RC1 (Build 201301102100)
Java: 1.7.0_10-ea; Java HotSpot(TM) 64-Bit Server VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_10-ea-b16
System: Mac OS X version 10.8.2 running on x86_64; US-ASCII; en_US (nb)
Comment 2 Denis Anisimov 2013-01-18 06:36:24 UTC
The sample works fine for me.
There could be general issue with WS access.
Does endpoint WS work in your case at all ?
F.e. please check the URL "http://localhost:8080/CalculatorApp/CalculatorWSService?wsdl".
Comment 3 Kenneth Ganfield 2013-01-18 13:17:20 UTC
(In reply to comment #2)
> The sample works fine for me.
> There could be general issue with WS access.
> Does endpoint WS work in your case at all ?
> F.e. please check the URL
> "http://localhost:8080/CalculatorApp/CalculatorWSService?wsdl".

The CalculatorApp and Client run fine for me and I can see the wsdl above and the service works as it should and the result is displayed. So basic WS works correctly.

On the SecureCalculatorApp I can also see the following URL:
http://localhost:8080/SecureCalculatorApp/CalculatorWSService?wsdl
And the SecureCalculatorClientApp builds and deploys fine, but when I try to use the service the result is not displayed.

The GF server logs show the following problem with authentication:


INFO: WEB0671: Loading application [SecureCalculatorClientApp] at [/SecureCalculatorClientApp]
INFO: SecureCalculatorClientApp was successfully deployed in 734 milliseconds.
INFO: WSP5018: Loaded WSIT configuration from file: file:/Users/nb/Documents/nbtemp-project/73-temp5/SecureCalculator/SecureCalculatorClientApp/build/web/WEB-INF/classes/META-INF/wsit-client.xml.
INFO: SEC5046: Audit: Authentication refused for [wsitUser].
INFO: SEC1201: Login failed for user: wsitUser
SEVERE: WSS1408: UsernameToken Authentication Failed
SEVERE: WSITPVD0035: Error in Verifying Security in Inbound Message.
com.sun.xml.wss.impl.WssSoapFaultException: Invalid Security Header
	at com.sun.xml.ws.security.opt.impl.util.SOAPUtil.newSOAPFaultException(SOAPUtil.java:159)
	at 
[...]


SEVERE: WSITPVD0035: Error in Verifying Security in Inbound Message.
com.sun.xml.wss.impl.PolicyViolationException: ERROR: No security header found in the message
	at com.sun.xml.wss.impl.policy.verifier.MessagePolicyVerifier.verifyPolicy(MessagePolicyVerifier.java:138)
	at 
[...]


WARNING: StandardWrapperValve[ClientServlet]: PWC1406: Servlet.service() for servlet ClientServlet threw exception
javax.xml.ws.WebServiceException: Cannot validate response for {http://calculator.me.org/}CalculatorWSPort
	at com.sun.enterprise.security.webservices.ClientSecurityPipe.processSecureRequest(ClientSecurityPipe.java:215)
	at 
[...]
	at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:151)
	at $Proxy200.add(Unknown Source)
	at org.me.calculator.client.ClientServlet.processRequest(ClientServlet.java:72)
	at org.me.calculator.client.ClientServlet.doGet(ClientServlet.java:95)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)

[...]

Caused by: javax.xml.ws.WebServiceException: WSITPVD0035: Error in Verifying Security in Inbound Message.
	at com.sun.xml.wss.provider.wsit.WSITClientAuthContext.validateResponse(WSITClientAuthContext.java:481)
	at com.sun.xml.wss.provider.wsit.WSITClientAuthContext.validateResponse(WSITClientAuthContext.java:415)
	at com.sun.enterprise.security.webservices.ClientSecurityPipe.processSecureRequest(ClientSecurityPipe.java:211)
	... 40 more

Caused by: javax.xml.ws.soap.SOAPFaultException: Invalid Security Header
	at com.sun.xml.wss.provider.wsit.WSITAuthContextBase.getSOAPFaultException(WSITAuthContextBase.java:1706)
	at com.sun.xml.wss.provider.wsit.WSITAuthContextBase.getSOAPFaultException(WSITAuthContextBase.java:1722)
	... 43 more
Comment 4 AndyDearden 2014-06-08 15:22:59 UTC
I'm having the same problem with teh secure calculator.
It's throwing:
javax.xml.ws.WebServiceException: Cannot validate response for {http://calculator.me.org/}CalculatorWSPort 

The tutorial doesn't seem to show us how to align the client app's security attributes so that they match the provider's security attributes. It is very frustrating when you are trying to learn how this stuff works that the tutorials are plain wrong.
Comment 5 AndyDearden 2014-06-08 15:49:44 UTC
(In reply to AndyDearden from comment #4)
> I'm having the same problem with teh secure calculator.
> It's throwing:
> javax.xml.ws.WebServiceException: Cannot validate response for
> {http://calculator.me.org/}CalculatorWSPort 
> 
> The tutorial doesn't seem to show us how to align the client app's security
> attributes so that they match the provider's security attributes. It is very
> frustrating when you are trying to learn how this stuff works that the
> tutorials are plain wrong.

I should say: I'm using the samples in Netbeans 8.0 on Windows 7
Comment 6 AndyDearden 2014-06-08 18:09:18 UTC
There's a full account of the same problem here
https://www.java.net/forum/topic/glassfish/metro-and-jaxb/wss1925-no-ciphervalue-found-cipherdata
Comment 7 marouncorbane 2017-05-06 04:03:07 UTC
I am having the same problem with Netbeans 8.2

Can someone please fix this issue one and for all or guide us through a workaround because this example doesn't seem to work at all!!

Thanks