If you log into the Axis Admin page (something like http://localhost:8080/axis2/axis2-admin/) does it list "addressing", "rahas" and "rampart" as available modules? [ September 25, 2008: Message edited by: Ulf Dittmer ]
Thanks in advance I have deployed my service and its working and also i have that rampart and rahas module live in modules seen in admin page. When i execute that client service it shows the err
Exception in thread "main" org.apache.axis2.AxisFault: Connection refused: connect at org.apache.axis2.AxisFault.makeFault(AxisFault.java:417) at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:195) at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:77) at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:327) at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:206) at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:396) at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:374) at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163) at tutorial.rampart.client.SecureServiceStub.add(SecureServiceStub.java:179) at tutorial.rampart.client.SecureServiceCGClient.main(SecureServiceCGClient.java:34) Caused by: java.net.ConnectException: Connection refused: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(Unknown Source) at java.net.PlainSocketImpl.connectToAddress(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSocket(ReflectionSocketFactory.java:139) at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:124) at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:706) at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1321) at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:386) at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346) at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:520) at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:191) ... 9 more
please help me
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35249
7
posted
0
So the exact same service (at the exact same URL) works fine if you access it without WS-Security, but is giving this exception if you access it with WS-Security?
Are there any error messages on the server side? [ September 26, 2008: Message edited by: Ulf Dittmer ]
karthic panneer
Ranch Hand
Joined: Sep 22, 2008
Posts: 57
posted
0
i managed to get rid of previous error now i am getting this err
Exception in thread "main" org.apache.axis2.AxisFault: Unable to engage module : rampart
where to put the rampart module for client side;
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35249
7
posted
0
Is that the only message? Generally, before or after such a message there are other exceptions or messages that explain why the module can't be engaged.
karthic panneer
Ranch Hand
Joined: Sep 22, 2008
Posts: 57
posted
0
Exception in thread "main" org.apache.axis2.AxisFault: Unable to engage module : rampart at org.apache.axis2.client.ServiceClient.engageModule(ServiceClient.java:339) at org.apache.axis2.client.ServiceClient.engageModule(ServiceClient.java:324) at tutorial.rampart.client.SecureServiceCGClient.main(SecureServiceCGClient.java:25)
but i can see modules in admin page listing
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35249
7
posted
0
That's just part of the stack trace of the exception. I was asking for other messages/exceptions.
Is this a client-side error? Rampart needs to be available on both sides, so the fact that it is displayed correctly on the admin page (which is on the server) doesn't mean that it's available on the client. [ September 26, 2008: Message edited by: Ulf Dittmer ]
karthic panneer
Ranch Hand
Joined: Sep 22, 2008
Posts: 57
posted
0
yes this is client side exceptions where to find the server side exceptions its not in log folder of tomcat folder
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35249
7
posted
0
Server error messages would be in catalina.out in the Tomcat logs folder. But if the client side throws an exception, then it's likely that the service requests never reaches the server, so there couldn't be any message, error or otherwise.
To be crystal clear, there are absolutely, positively no other client-side error messages or exceptions? Just the one you posted, nothing before it and nothing after it? No one-line messages either?
karthic panneer
Ranch Hand
Joined: Sep 22, 2008
Posts: 57
posted
0
nothing this is the err also there is no catalina.out
i got one doubt i went thru the axis2.xml there is no config for rampart[but i engaged in my services.xml] is it right?
karthic panneer
Ranch Hand
Joined: Sep 22, 2008
Posts: 57
posted
0
The error might be at the line where i engage the module
sc.engageModule("rampart");
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35249
7
posted
0
i went thru the axis2.xml there is no config for rampart
That's correct. Modules are added by putting them into the "modules" directory.
sc.engageModule("rampart");
Why are you doing this? You do not need to add any code to make WS-Security work. All the required configuration would happen in the client.axis2.xml file (or whatever it's called in your setup).
karthic panneer
Ranch Hand
Joined: Sep 22, 2008
Posts: 57
posted
0
"You do not need to add any code to make WS-Security work"
Without sc.engagemodule() will rampart come into action?
if i comment the engage statement then this err appears
Exception in thread "main" org.apache.axis2.AxisFault: Read timed out at org.apache.axis2.AxisFault.makeFault(AxisFault.java:417) at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:72) at org.apache.axis2.transport.http.AxisRequestEntity.writeRequest(AxisRequestEntity.java:84) at org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:495) at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:1973) at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:993) at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397) at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346) at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:520) at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:191) at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:77) at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:327) at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:206) at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:396) at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:374) at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163) at tutorial.rampart.client.SecureServiceStub.add(SecureServiceStub.java:179) at tutorial.rampart.client.SecureServiceCGClient.main(SecureServiceCGClient.java:34) Caused by: com.ctc.wstx.exc.WstxIOException: Read timed out at com.ctc.wstx.sw.BaseStreamWriter.flush(BaseStreamWriter.java:313) at org.apache.axiom.om.impl.MTOMXMLStreamWriter.flush(MTOMXMLStreamWriter.java:118) at org.apache.axiom.om.impl.llom.OMNodeImpl.serializeAndConsume(OMNodeImpl.java:422) at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:68) ... 19 more Caused by: java.net.SocketTimeoutException: Read timed out at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(Unknown Source) at com.sun.net.ssl.internal.ssl.InputRecord.readFully(Unknown Source) at com.sun.net.ssl.internal.ssl.InputRecord.read(Unknown Source) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(Unknown Source) at com.sun.net.ssl.internal.ssl.AppOutputStream.write(Unknown Source) at java.io.BufferedOutputStream.flushBuffer(Unknown Source) at java.io.BufferedOutputStream.flush(Unknown Source) at java.io.FilterOutputStream.flush(Unknown Source) at org.apache.commons.httpclient.ChunkedOutputStream.flush(ChunkedOutputStream.java:190) at com.ctc.wstx.io.UTF8Writer.flush(UTF8Writer.java:99) at com.ctc.wstx.sw.BufferingXmlWriter.flush(BufferingXmlWriter.java:214) at com.ctc.wstx.sw.BaseStreamWriter.flush(BaseStreamWriter.java:311)
karthic panneer
Ranch Hand
Joined: Sep 22, 2008
Posts: 57
posted
0
Thanks for the support so far
if you can't trace out the error then forward me a sample service to me with which i can check mine
[provide directory structure also.]
please contact me quickly
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35249
7
posted
0
Without sc.engagemodule() will rampart come into action?
Yes
Caused by: java.net.SocketTimeoutException: Read timed out at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(Unknown Source) at com.sun.net.ssl.internal.ssl.InputRecord.readFully(Unknown Source) at com.sun.net.ssl.internal.ssl.InputRecord.read(Unknown Source) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
So the root cause is an inability to make an HTTPS connection. Does it work if you use HTTP instead of HTTPS? Can you make HTTPS connections to any host from the client using Java?
(As an aside, WS-Security can perform encryption, so there should be no need to use HTTPS.)
For a ready-to-run example of how to use WS-Security/Rampart check out this article I wrote in the JavaRanch Journal: Web Services Authentication with Axis 2 [ September 26, 2008: Message edited by: Ulf Dittmer ]
karthic panneer
Ranch Hand
Joined: Sep 22, 2008
Posts: 57
posted
0
sorry for the delayed reply your tutorial is simple and very useful thanks a lot i executed successfully and got idea about it.
But you don't provide information to build keys if you could please post that also because you are presenting simple and powerfull
thanks thanks a lot karthic.p
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35249
7
posted
0
I don't have a writeup about doing encryption with Rampart. I'm working on one, though, which might get published in the next couple of weeks.
karthic panneer
Ranch Hand
Joined: Sep 22, 2008
Posts: 57
posted
0
Once again i want your guide
Please refer me online guide or ebook or tutorial that covers the rampart in detail from the introduction itself(from basic itself).
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35249
7
posted
0
To my knowledge no such a tutorial/book exists.
karthic panneer
Ranch Hand
Joined: Sep 22, 2008
Posts: 57
posted
0
Now i got another problem, noticed very lately when i run that fibonaci series service and client the communicated messages are not encrypted why?
My example doesn't handle encryption. For starters, the <items> tag needs an "Encrypt" in it, but you need to set up a few more things as well. Sample code #5 that comes with Rampart demonstrates the various pieces needed for encryption to work in both directions.
karthic panneer
Ranch Hand
Joined: Sep 22, 2008
Posts: 57
posted
0
where is that sample code#5 is it in rampart tutorial
Waiting
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35249
7
posted
0
It's part of the binary Rampart distribution. Not the module, but the actual distribution.
By the way, I wouldn't close a post with "Waiting". It gives the message an impatient, and even a bit demanding, tone. Better to avoid that.
karthic panneer
Ranch Hand
Joined: Sep 22, 2008
Posts: 57
posted
0
Sorry for that it came with flow.
karthic panneer
Ranch Hand
Joined: Sep 22, 2008
Posts: 57
posted
0
another problem
i used that rampart tutorial sample5 but i got the error
Exception in thread "main" org.apache.axis2.AxisFault: WSHandler: Encryption: error during message processingorg.apache.ws.security.WSSecurityException: General security error (Unexpected number of X509Data: for Encryption) at org.apache.rampart.handler.WSDoAllSender.processMessage(WSDoAllSender.java:67) at org.apache.rampart.handler.WSDoAllHandler.invoke(WSDoAllHandler.java:72) at org.apache.axis2.engine.Phase.invoke(Phase.java:292) at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:212) at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:377) at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:374) at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163) at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:528) at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:508) at com.tps.test.CalculatorServiceClient.Calculate(CalculatorServiceClient.java:53) at com.tps.test.CalculatorServiceClient.main(CalculatorServiceClient.java:62) Caused by: org.apache.ws.security.WSSecurityException: WSHandler: Encryption: error during message processingorg.apache.ws.security.WSSecurityException: General security error (Unexpected number of X509Data: for Encryption) at org.apache.ws.security.action.EncryptionAction.execute(EncryptionAction.java:64) at org.apache.ws.security.handler.WSHandler.doSenderAction(WSHandler.java:192) at org.apache.rampart.handler.WSDoAllSender.processBasic(WSDoAllSender.java:201) at org.apache.rampart.handler.WSDoAllSender.processMessage(WSDoAllSender.java:64) ... 11 more
what is that error about? I dont have any idea about it. Thanks
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35249
7
posted
0
Before applying encryption to your code I'd make sure that you can run the example without problems. Then you can selectively copy over bits of the files and keystores that you know are working.
karthic panneer
Ranch Hand
Joined: Sep 22, 2008
Posts: 57
posted
0
Thats right i am working purely with examples alone but that too makes error
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35249
7
posted
0
This doesn't look like a stack trace from any Rampart example:
karthic panneer
Ranch Hand
Joined: Sep 22, 2008
Posts: 57
posted
0
This is the error i got when i did it with the rampart sample
Exception in thread "main" org.apache.axis2.AxisFault: WSHandler: Encryption: error during message processingorg.apache.ws.security.WSSecurityException: General security error (Unexpected number of X509Data: for Encryption) at org.apache.rampart.handler.WSDoAllSender.processMessage(WSDoAllSender.java:67) at org.apache.rampart.handler.WSDoAllHandler.invoke(WSDoAllHandler.java:72) at org.apache.axis2.engine.Phase.invoke(Phase.java:292) at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:212) at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:377) at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:374) at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163) at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:528) at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:508) at com.tps.ramp.Client.main(Client.java:46) Caused by: org.apache.ws.security.WSSecurityException: WSHandler: Encryption: error during message processingorg.apache.ws.security.WSSecurityException: General security error (Unexpected number of X509Data: for Encryption) at org.apache.ws.security.action.EncryptionAction.execute(EncryptionAction.java:64) at org.apache.ws.security.handler.WSHandler.doSenderAction(WSHandler.java:192) at org.apache.rampart.handler.WSDoAllSender.processBasic(WSDoAllSender.java:201) at org.apache.rampart.handler.WSDoAllSender.processMessage(WSDoAllSender.java:64) ... 10 more
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35249
7
posted
0
Aside from renaming the package of the client, are you using the sample files (build.xml, service aar file, client key store, client config file etc.) exactly as they were shipped? Or did you make any other changes?
karthic panneer
Ranch Hand
Joined: Sep 22, 2008
Posts: 57
posted
0
yes i shipped all but i don't use that build.xml is that needed.
Also i have an doubt. I tried to .jks files with java keytool is that right, and that too cause error
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35249
7
posted
0
I tried to .jks files with java keytool is that right, and that too cause error
I don't understand what you're trying to say here (a verb seems to be missing). Not knowing what you were doing and what the exact error was it's impossible to advise on this.
karthic panneer
Ranch Hand
Joined: Sep 22, 2008
Posts: 57
posted
0
I saw that in manual, that error unexpected number of x509 data is due to wrong alias name and alias password.
where the alias name and password are used in the rampart tutorial upto to my knowledge alias and passwords are in client.properties file PWHandler.java just assigning password is there any other place to use alias?
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35249
7
posted
0
You shouldn't have to change any passwords or IDs whatsoever - the example comes ready to run, along with the keystore files. The supplied build.xml file makes this easy, as all the targets are predefined. If you think that you need to change anything, you're likely to be doing something incorrectly.
karthic panneer
Ranch Hand
Joined: Sep 22, 2008
Posts: 57
posted
0
After a long time i am back to disturb you sir dont mistake me
I copied the rampart sample5 and simply used it without any alterations but i got this error
Exception in thread "main" org.apache.axis2.AxisFault: org.apache.ws.security.components.crypto.Merlin cannot create instance at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:486) at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:343) at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:389) at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163) at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:528) at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:508) at org.apache.rampart.samples.sample05.Client.main(Client.java:45)
karthic panneer
Ranch Hand
Joined: Sep 22, 2008
Posts: 57
posted
0
This may be a late reply, how ever i want to thank and report the solution.
The previous error[merlin cannot create instance] is due to a bug in axis2.1 i got this in a website.