Re: Error page returned instead of Soap Exception when WS-Security Authentication fails in Rampart

2009-10-22 Thread Ellecer Valencia
Thanks for that Chinmoy. However, I continued to get the HTML error
pages, even using the latest available nightly build of Rampart. This
happened both on Axis2-1.4 and Axis2-1.5

However, I seem to have stumbled upon a fix. I was able to get the
expected soap response messages and exceptions after I removed this
entry from axis2.xml:

module ref=rampart/   --- REMOVE

I was testing an axis webapp which contained two services:

1. an unsecured service - BankService, from Axis /samples/faulthandling/
2. and a secured service - sample03, from Rampart /samples/basic/sample03/

Now when the file /WEB-INF/conf/axis2.xml contained module
ref=rampart/, I continually got a HTML error page (as described in
my earlier post - see bottom of email), whether it was

1. (BankService - unsecured) - Sending a request that would generate
Insufficient Funds error

soapenv:Envelope
xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/;
xmlns:exam=http://example;
   soapenv:Header/
   soapenv:Body
  exam:withdraw
 exam:account88/exam:account
 exam:amount1200/exam:amount
  /exam:withdraw
   /soapenv:Body
/soapenv:Envelope

when running the /faulthandling example from command-line, this was
the equivalent of

ant run.client -Durl=http://localhost:8081/axis2/services/BankService
-Daccount=88 -Damt=1200


OR

2. (sample03 - secured) Or trying to log in with incorrect login details:

(In this sample, only bob is a valid Username. All others usernames
should throw authentication errors)

soap:Envelope xmlns:soap=http://www.w3.org/2003/05/soap-envelope;
xmlns:sam=http://sample03.samples.rampart.apache.org;
soap:Header
 wsse:Security soap:mustUnderstand=1
xmlns:wsse=http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd;
   wsse:UsernameToken wsu:Id=UsernameToken-1815911479
xmlns:wsu=http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd;
 wsse:Usernamebobx/wsse:Username
 wsse:Password
Type=http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText;bobPW/wsse:Password
  /wsse:UsernameToken
/wsse:Security
 /soap:Header
   soap:Body
  sam:echo
 !--Optional:--
 sam:param0echo this string/sam:param0
  /sam:echo
   /soap:Body
/soap:Envelope



But after removing the rampart entry from axis2.xml, things started
working as expected.

I was now getting expected results like these:

1. BankService

soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/;
   soapenv:Body
  soapenv:Fault
 faultcodesoapenv:Server/faultcode
 faultstringInsufficient funds/faultstring
 detail
ns1:InsufficientFundFault xmlns:ns1=http://example;
   ns1:account88/ns1:account
   ns1:balance1000/ns1:balance
   ns1:requestedFund1200/ns1:requestedFund
/ns1:InsufficientFundFault
 /detail
  /soapenv:Fault
   /soapenv:Body
/soapenv:Envelope


2. sample03

soapenv:Envelope xmlns:soapenv=http://www.w3.org/2003/05/soap-envelope;
   soapenv:Body
  soapenv:Fault
 soapenv:Code
soapenv:Valuesoapenv:Receiver/soapenv:Value
 /soapenv:Code
 soapenv:Reason
soapenv:Text xml:lang=en-USWSDoAllReceiver: security
processing failed/soapenv:Text
 /soapenv:Reason
 soapenv:Detail/
  /soapenv:Fault
   /soapenv:Body
/soapenv:Envelope

So either we have incorrect config instructions -
http://ws.apache.org/axis2/modules/rampart/1_0/security-module.html
says to put the rampart module entry in axis2.xml - OR there is a bug
in the way that Rampart is interacting with errors that are thrown by
services in Axis, even services that *don't* use rampart end up being
affected by it.  Bug or Not Bug?

However, when I have a web service (written code first, not generated
from WSDL) that throws an Exception, I still end up getting a HTML
error page - but this may be related to the way Axis handles
exceptions by default (?). I thought Axis would wrap exceptions in a
SoapException, but I'm not sure. Can anyone confirm this?


Ellecer


On Wed, Oct 21, 2009 at 10:08 PM, Chinmoy Chakraborty cch...@gmail.com wrote:
 I saw this error and I suppose this is fixed in 1.5..you can look at [1].

 [1]. [
 https://issues.apache.org/jira/browse/RAMPART-236?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12739525#action_12739525
 ]

 HTH,
 Chinmoy



 On Wed, Oct 21, 2009 at 12:17 PM, Ellecer Valencia elle...@gmail.com
 wrote:

 Hi,

 I'm trying to set up WS-Security (just username/password-clear-text)
 and I'm trying to get the service to return a Soap Exception when the
 user logs in with the wrong details. Should be easy, right? However, I
 keep getting HTTP 500 error pages instead of Soap Exceptions, like
 this one:

 htmlheadtitleApache Tomcat/6.0.18 - Error
 

Deployment of Axis2: SOAP server using AxisServlet or standalone servlet?

2009-10-22 Thread sandeep_khurana

I have developed a simple temperature conversion webservice through eclipse
using the tutorials available on net. My query is regarding the type of
webservice I have developed. Is it a SOAP server that uses the AxisServlet
or is it a standalone servlet?
-- 
View this message in context: 
http://www.nabble.com/Deployment-of-Axis2%3A-SOAP-server-using-AxisServlet-or-standalone-servlet--tp26004906p26004906.html
Sent from the Axis - User mailing list archive at Nabble.com.



Re: Error page returned instead of Soap Exception when WS-Security Authentication fails in Rampart

2009-10-22 Thread Chinmoy Chakraborty
If you want to enable WS-security you need to engage RAMPART module. So
disengaging RAMPART module is not the solution if you want WS-Security. If
you don't need WS-Security then its fine.

So it's a bug and that's why it is in JIRA. If you are getting the same
error using latest code please comment on that JIRA entry.

Chinmoy


On Thu, Oct 22, 2009 at 12:06 PM, Ellecer Valencia elle...@gmail.comwrote:

 Thanks for that Chinmoy. However, I continued to get the HTML error
 pages, even using the latest available nightly build of Rampart. This
 happened both on Axis2-1.4 and Axis2-1.5

 However, I seem to have stumbled upon a fix. I was able to get the
 expected soap response messages and exceptions after I removed this
 entry from axis2.xml:

 module ref=rampart/   --- REMOVE

 I was testing an axis webapp which contained two services:

 1. an unsecured service - BankService, from Axis /samples/faulthandling/
 2. and a secured service - sample03, from Rampart /samples/basic/sample03/

 Now when the file /WEB-INF/conf/axis2.xml contained module
 ref=rampart/, I continually got a HTML error page (as described in
 my earlier post - see bottom of email), whether it was

 1. (BankService - unsecured) - Sending a request that would generate
 Insufficient Funds error

 soapenv:Envelope
 xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/;
 xmlns:exam=http://example;
   soapenv:Header/
   soapenv:Body
  exam:withdraw
 exam:account88/exam:account
 exam:amount1200/exam:amount
  /exam:withdraw
   /soapenv:Body
 /soapenv:Envelope

 when running the /faulthandling example from command-line, this was
 the equivalent of

 ant run.client -Durl=http://localhost:8081/axis2/services/BankService
 -Daccount=88 -Damt=1200


 OR

 2. (sample03 - secured) Or trying to log in with incorrect login details:

 (In this sample, only bob is a valid Username. All others usernames
 should throw authentication errors)

 soap:Envelope xmlns:soap=http://www.w3.org/2003/05/soap-envelope;
 xmlns:sam=http://sample03.samples.rampart.apache.org;
soap:Header
 wsse:Security soap:mustUnderstand=1
 xmlns:wsse=
 http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd
 
   wsse:UsernameToken wsu:Id=UsernameToken-1815911479
 xmlns:wsu=
 http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd
 
 wsse:Usernamebobx/wsse:Username
 wsse:Password
 Type=
 http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText
 bobPW/wsse:Password
  /wsse:UsernameToken
/wsse:Security
 /soap:Header
   soap:Body
  sam:echo
 !--Optional:--
 sam:param0echo this string/sam:param0
  /sam:echo
   /soap:Body
 /soap:Envelope



 But after removing the rampart entry from axis2.xml, things started
 working as expected.

 I was now getting expected results like these:

 1. BankService

 soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/
 
   soapenv:Body
  soapenv:Fault
 faultcodesoapenv:Server/faultcode
 faultstringInsufficient funds/faultstring
 detail
ns1:InsufficientFundFault xmlns:ns1=http://example;
   ns1:account88/ns1:account
   ns1:balance1000/ns1:balance
   ns1:requestedFund1200/ns1:requestedFund
/ns1:InsufficientFundFault
 /detail
  /soapenv:Fault
   /soapenv:Body
 /soapenv:Envelope


 2. sample03

 soapenv:Envelope xmlns:soapenv=http://www.w3.org/2003/05/soap-envelope;
   soapenv:Body
  soapenv:Fault
 soapenv:Code
soapenv:Valuesoapenv:Receiver/soapenv:Value
 /soapenv:Code
 soapenv:Reason
soapenv:Text xml:lang=en-USWSDoAllReceiver: security
 processing failed/soapenv:Text
 /soapenv:Reason
 soapenv:Detail/
  /soapenv:Fault
   /soapenv:Body
 /soapenv:Envelope

 So either we have incorrect config instructions -
 http://ws.apache.org/axis2/modules/rampart/1_0/security-module.html
 says to put the rampart module entry in axis2.xml - OR there is a bug
 in the way that Rampart is interacting with errors that are thrown by
 services in Axis, even services that *don't* use rampart end up being
 affected by it.  Bug or Not Bug?

 However, when I have a web service (written code first, not generated
 from WSDL) that throws an Exception, I still end up getting a HTML
 error page - but this may be related to the way Axis handles
 exceptions by default (?). I thought Axis would wrap exceptions in a
 SoapException, but I'm not sure. Can anyone confirm this?


 Ellecer


 On Wed, Oct 21, 2009 at 10:08 PM, Chinmoy Chakraborty cch...@gmail.com
 wrote:
  I saw this error and I suppose this is fixed in 1.5..you can look at [1].
 
  [1]. [
 
 

Re: Regarding XMLBeans generation Of files

2009-10-22 Thread Dennis Sosnoski
Certainly you can do this - XMLBeans is open source code, so get a copy 
of the source and modify it to generate the kind of class structure you 
want in your own custom version.


Otherwise, follow Amila's suggestion and go with another data binding 
approach. ADB is very easy to use with Axis2 and provides good support 
for schema. JAXB's data model isn't quite as nice as ADB's, but probably 
has been more thoroughly tested with all kinds of schema variations. 
JiBX lets you customize the data model, and works especially well with 
modular schemas where different groups are using different subsets of 
the overall schema, but currently requires you to generate the data 
model separately from the Axis2 linkage code and doesn't support all 
features of schema (with xsi:type the most significant lack).


Unfortunately (from your point of view), all of these other data 
bindings use simpler models than those generated by XMLBeans, so you're 
going to need to make changes to your application code to work with the 
other bindings. On the plus side, your application code should be 
significantly simpler once you've made the changes (and will also run 
somewhat faster).


 - Dennis

--
Dennis M. Sosnoski
Java XML and Web Services
Axis2 Training and Consulting
http://www.sosnoski.com - http://www.sosnoski.co.nz
Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117



sri ram wrote:

Can some one look into this .


--- On *Fri, 16/10/09, sri ram /pinnamaraju_sri...@yahoo.co.in/* wrote:


From: sri ram pinnamaraju_sri...@yahoo.co.in
Subject: Re: Regarding XMLBeans generation Of files
To: axis-user@ws.apache.org
Date: Friday, 16 October, 2009, 12:02 PM

Since we have already done an extensive coding using this
databinding .
Its highly unlikely to revert back.
So now we are trying to improvise the generator itself :(

Hmm  ... is there no other way to achieve the below queries.

-Sriram


--- On *Fri, 16/10/09, Amila Suriarachchi
/amilasuriarach...@gmail.com/* wrote:


From: Amila Suriarachchi amilasuriarach...@gmail.com
Subject: Re: Regarding XMLBeans generation Of files
To: axis-user@ws.apache.org
Date: Friday, 16 October, 2009, 11:56 AM

can you try another data binding frame work like adb or jaxbri.

thanks,
Amila.

On Thu, Oct 15, 2009 at 2:51 PM, sri ram
pinnamaraju_sri...@yahoo.co.in wrote:

Attaching the files

--- On *Thu, 15/10/09, sri ram
/pinnamaraju_sri...@yahoo.co.in/* wrote:


From: sri ram pinnamaraju_sri...@yahoo.co.in
Subject: Regarding XMLBeans generation Of files
To: axis-user@ws.apache.org
Date: Thursday, 15 October, 2009, 2:50 PM


Hi all,

As we know that XMLbeans generates a lot of file
reading the schema.
I have tried my best to modify the schema to best
known format to reduce the number of files.
And I have been succesfull in doing that .

What I see is that  there are a lot of unused methods
that are getting generated in  files that  are
generated .Unused in my code of implementation.
For example there are a lot of overloaded parse
methods that are generated ,which are
 public and static  and hence need to be loaded in the
memory even if they are used or not.
So my concern is can we suppress the generation of
these methods
by using some options in the command line (while
compiling the schema).
Else can we change the source code of the XMLBeans
generator to get the required methods. If yes what are
jars that   we can modify without violating any of the
rules of open source code .

I have attached two files to show the  number of
methods that are actually in use.
And  what we want to achieve.

The number of files that are generated are 4029  .
The number of line we want to reduce is 50 line in
each file .
ie approx 50 * 4000= 200,000

Our schema is ever increasing  with every version.
It will allow my application to work better and faster.

Can someone quickly respond to it.

Thanks in advance


-Sriram




Now, send attachments up to 25MB with Yahoo! India
Mail. Learn how

http://in.rd.yahoo.com/tagline_galaxy_2/*http://in.overview.mail.yahoo.com/photos.




Axis 2 Webservice on Eclipse

2009-10-22 Thread Bharath_Nabble

I am new to webservices. I am trying to follow a document in creating a
webservice.
This is the document which I am following,
http://www.eclipse.org/webtools/community/tutorials/BottomUpAxis2WebService/bu_tutorial.html

When I follow the document and deploy Axis2 Servlet is deployed (point no
18), I am getting the Axis 2 home page but I could also see a error in the
tomcat console with the following error



Oct 22, 2009 4:18:46 PM org.apache.catalina.core.AprLifecycleListener
lifecycleEvent
INFO: The Apache Tomcat Native library which allows optimal performance in
production environments was not found on the java.library.path: C:\Program
Files\Java\jre1.5.0_06\bin;.;C:\WINNT\system32;C:\WINNT;C:/Program
Files/Java/jre1.5.0_06/bin/client;C:/Program
Files/Java/jre1.5.0_06/bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Program
Files\Windows Imaging\;C:\Program Files\Java\jdk1.5.0_06\bin
Oct 22, 2009 4:18:46 PM org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Oct 22, 2009 4:18:46 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 781 ms
Oct 22, 2009 4:18:47 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Oct 22, 2009 4:18:47 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.28
Oct 22, 2009 4:18:47 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
[INFO] Clustering has been disabled
[ERROR] StandardWrapper.Throwable
java.lang.NoClassDefFoundError: javax/jws/WebService
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at
org.apache.axis2.deployment.AxisConfigBuilder.processDeployers(AxisConfigBuilder.java:397)
at
org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(AxisConfigBuilder.java:260)
at
org.apache.axis2.deployment.DeploymentEngine.populateAxisConfiguration(DeploymentEngine.java:707)
at
org.apache.axis2.deployment.WarBasedAxisConfigurator.init(WarBasedAxisConfigurator.java:157)
at
org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:525)
at 
org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:443)
at 
org.apache.axis2.webapp.AxisAdminServlet.init(AxisAdminServlet.java:56)
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1139)
at 
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966)
at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3996)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4266)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at 
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at 
org.apache.catalina.core.StandardService.start(StandardService.java:448)
at 
org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
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.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
[ERROR] Servlet /Axis2WSTest threw load() exception
java.lang.NoClassDefFoundError: javax/jws/WebService
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at
org.apache.axis2.deployment.AxisConfigBuilder.processDeployers(AxisConfigBuilder.java:397)
at
org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(AxisConfigBuilder.java:260)
at
org.apache.axis2.deployment.DeploymentEngine.populateAxisConfiguration(DeploymentEngine.java:707)
at
org.apache.axis2.deployment.WarBasedAxisConfigurator.init(WarBasedAxisConfigurator.java:157)
at
org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:525)
at 
org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:443)

ArrayStoreException: org.apache.axis.encoding.ser.ArrayDeserializer$ArrayListExtension

2009-10-22 Thread Frank Otto

Hi,

I use axis 1.4 and get following exception:

java.lang.ArrayStoreException: 
org.apache.axis.encoding.ser.ArrayDeserializer$ArrayListExtension


I have one Webservice with 2 methods, which returns an array of a bean. 
For example:



public MyBean1[] getMyBeans1();
public MyBean2[] getMyBeans2();


If I call the getMyBeans2() method after getMyBean1(), getMyBeans2() 
throws the exception. On getMyBean1() after getMyBean2(), getMyBean1() 
throws the exception.


I think there is an error in array deserialisation.

The two method calls will be work, if I reinitialise my Webservice after 
the first method.


Has someone an idea?


kind regards,

Frank



Re: Retrieving faultString message

2009-10-22 Thread m4rkuz
Somebody?
the thing is that the application is being installed in many different and
distant places, and every installation comes to different security
configuration errors, not registered ips, bad user/pass credentials, not
registered users etc, and all this errors generate correct coherent fault
string that can help to solve them, but all I get is an SOAP HEADER MISSING
error that don't help me to give support to the users.

How can I get this faultstring for show in my App.
___
Marcus Sánchez Díaz.
Enterprise Developer.
SCJP - SCWCD.


On Wed, Oct 21, 2009 at 11:01 AM, m4rkuz m4r...@gmail.com wrote:


 Hi Everyone,

 Got a question for you all, I have an application that uses Axis2 +
 Rampart, to consume some Secure Webservices, but I'm having troubles to
 display all the info in the errors the server returns, to ilustrate this I
 show the SOAP I recive from the server:

 ?xml version=1.0 encoding=UTF-8 standalone=no?
 SOAP-ENV:Envelope xmlns:SOAP-ENV=
 http://schemas.xmlsoap.org/soap/envelope/;
 SOAP-ENV:Body
 SOAP-ENV:Fault
 faultcode xmlns:p=http://schemas.oblix.com/ws/2003/08/Faults
 p:Client.AuthenticationFault/faultcode
 faultstring*La autenticación contra el LDAP Falló*/faultstring
 detail/
 /SOAP-ENV:Fault
 /SOAP-ENV:Body
 /SOAP-ENV:Envelope

 This happens because the user/password does not match, in my client app I
 wish to take this exact message (the one in bold, in the faultstring tag)
 but I only can get an Axis2 SOAP header missing error that says nothing to
 my final users...

 How can I capture this error message?

 (excuse my English, if better explanation is required, just ask)




 ___
 Marcus Sánchez Díaz.
 Enterprise Developer.
 SCJP - SCWCD.



How do I see the request XML in my Axis/Apache logs?

2009-10-22 Thread laredotornado

Hi,

I'm using Axis 2 and a Java 1.5 client to interface with a web service I
have running locally.  The client generation code is below.  My question is,
how do I get the XML request that the client sent to appear in the Axis
logs?  Right now, I can see parts of my request, like 

DEBUG [org.apache.axiom.om.impl.builder.StAXOMBuilder,
resin-tcp-connection-*:8080-657 2009-10-22 08:49:26,011]:
CHARACTERS: [1968]

But it would be really useful to me if I could see the entire request sent.

Thanks,  - Dave



==The client code generation -- maven.xml ===
project  xmlns:j=jelly:core xmlns:ant=jelly:ant

  preGoal name=java:compile

ant:property name=downloadedWSDL value=target/MatchingService.wsdl
/
ant:get
src=http://localhost:8080//apps/dor/dmv/driver/matching//services/MatchingService?wsdl;
 dest=${downloadedWSDL}
 username=dalvarado
 password=password /
ant:mkdir dir=${maven.build.dir}/src /
java classname=org.apache.axis2.wsdl.WSDL2Java fork=true
classpathref=maven.dependency.classpath
  arg line=-uri ${downloadedWSDL} /
  arg line=-or /
  arg line=-d adb /
  arg line=-o target/ /
/java

ant:javac
  debug=true
  debuglevel=vars,lines,source
  destdir=${maven.build.dest}
  excludes=**/package.html
  srcdir=${basedir}/target/src 
 ant:classpath
  ant:path refid=maven.dependency.classpath /
 /ant:classpath
/ant:javac
  /preGoal

/project
-- 
View this message in context: 
http://www.nabble.com/How-do-I-see-the-request-XML-in-my-Axis-Apache-logs--tp26011823p26011823.html
Sent from the Axis - User mailing list archive at Nabble.com.



Axis 2 (1.5) - Unable to find service for POJO

2009-10-22 Thread mule_user

New to Axis2. Using the POJO guide for exposing service found in link:

http://ws.apache.org/axis2/1_5/pojoguide.html

I can see the wsdl in the browser, but cannot see the service. The service
apparaently was not found.  Any suggestion will be appreciated.

Following are the steps that I have taken.

Axis2Weather (it is web project containing WebContent)
|
src
|  |
|   sample.pojo.data
|  |   |
|  |Weather.java
|  |
|   sample.pojo.service
|  |
|   WeatherService.java
|
WebContent
 |
  WEB-INF
|
|
 lib (has all jars from Axis2, version 1.5)
| 
 services
| |
|  WeatherService
|   |
|META-INF
| |
| 
services.xml
|
 web.xml
///
services.xml:

service name=WeatherService scope=application
description
Weather POJO Service
/description
messageReceivers
messageReceiver 
mep=http://www.w3.org/2004/08/wsdl/in-only;
class=org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver/
messageReceiver
mep=http://www.w3.org/2004/08/wsdl/in-out;
class=org.apache.axis2.rpc.receivers.RPCMessageReceiver/
/messageReceivers
parameter name=ServiceClass
sample.pojo.service.WeatherService
/parameter
/service


web.xml:

?xml version=1.0 encoding=UTF-8?
web-app id=WebApp_ID version=2.4
xmlns=http://java.sun.com/xml/ns/j2ee;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;
display-name
Axis2Weather/display-name

servlet
display-nameApache-Axis Servlet/display-name
servlet-nameAxisServlet/servlet-name

servlet-classorg.apache.axis2.transport.http.AxisServlet/servlet-class
load-on-startup1/load-on-startup
/servlet
servlet
display-name
Axis Admin Servlet/display-name
servlet-nameAdminServlet/servlet-name
servlet-class
org.apache.axis.transport.http.AdminServlet/servlet-class
load-on-startup100/load-on-startup
/servlet

servlet-mapping
servlet-nameAxisServlet/servlet-name
url-pattern/servlet/AxisServlet/url-pattern
/servlet-mapping
servlet-mapping
servlet-nameAxisServlet/servlet-name
url-pattern*.jws/url-pattern
/servlet-mapping
servlet-mapping
servlet-nameAxisServlet/servlet-name
url-pattern/services/*/url-pattern
/servlet-mapping
servlet-mapping
servlet-nameAdminServlet/servlet-name
url-pattern/servlet/AdminServlet/url-pattern
/servlet-mapping
/web-app

//

package sample.pojo.data;

public class Weather {
float temperature;
String forecast;
boolean rain;
float howMuchRain;

public void setTemperature(float temp){
temperature = temp;
}

public float getTemperature(){
return temperature;
}

public void setForecast(String fore){
forecast = fore;
}

public String getForecast(){
return forecast;
}

public void setRain(boolean r){
rain = r;
}

public boolean getRain(){
return rain;
}

public void setHowMuchRain(float howMuch){
howMuchRain = howMuch;
}

public float getHowMuchRain(){
return howMuchRain;
}
}

//

package sample.pojo.service;

import sample.pojo.data.Weather;

public class WeatherService{

 Weather weather;

public void setWeather(Weather weather){
this.weather = weather;
}

public Weather getWeather(){
return this.weather;
}
}

/

The context root of the application is: Axis2Weather

Axis2Weather successfully gets deployed in the application server (WebSphere
in this case) as an EAR file and the Axis2Weather application successfully
gets started in the application server. 

But when I enter the URL: http://localhost:9081/Axis2Weather/services , I
get error as:

org.apache.axis2.AxisFault: The service cannot be found for the endpoint
reference (EPR) /Axis2Weather/services/ 

Re: Error page returned instead of Soap Exception when WS-Security Authentication fails in Rampart

2009-10-22 Thread Ellecer Valencia
But this is where we seem to be doing different things. I'm getting
the error, but only if I have a rampart entry in axis2.xml. Once I
remove it, I don't get the HTML error page anymore. I get the Soap
Faults I was expecting. It looks like WS-Security is actually enabled,
even without the axis2.xml entry.

I find the instructions a bit ambiguous on this:

Since rampart module inserts handlers in the system specific
pre-dispatch phase, it must be engaged globally. But it is possible to
activate rampart module for the inflow or the outflow when required by
the service or the clients.

Now what does this actually mean? Should the module reference always
be present in axis2.xml or not?  The second sentence seems to imply
that it doesn't. Later on, the instructions say:

At the server it is possible to provide security on a per service
basis. The configuration parameters should be set in the service.xml
file of the service. The client side config parameters should be set
in the axis2.xml of the client's Axis2 repository.

So isn't this saying if you are a *client* of a WS-Security enabled
service, you need the entry in your axis2.xml, but if you are running
a service, you can either have rampart enabled globally in the
axis2.xml, or inside individual services, in their service.xml?  Could
we get some feedback from people involved in Rampart (and rewrite some
parts of that page if needed)?

As I showed in my previous post, I was able to get a Soap Fault from
sample03 service when authentication failed. I didn't have an entry
for rampart in axis2.xml. I only had it in the service.xml file for
sample03.  The fact that the auth details were processed means Rampart
*is* enabled.


Ellecer


On Thu, Oct 22, 2009 at 6:26 PM, Chinmoy Chakraborty cch...@gmail.com wrote:
 If you want to enable WS-security you need to engage RAMPART module. So
 disengaging RAMPART module is not the solution if you want WS-Security. If
 you don't need WS-Security then its fine.

 So it's a bug and that's why it is in JIRA. If you are getting the same
 error using latest code please comment on that JIRA entry.

 Chinmoy

 On Thu, Oct 22, 2009 at 12:06 PM, Ellecer Valencia elle...@gmail.com
 wrote:

 Thanks for that Chinmoy. However, I continued to get the HTML error
 pages, even using the latest available nightly build of Rampart. This
 happened both on Axis2-1.4 and Axis2-1.5

 However, I seem to have stumbled upon a fix. I was able to get the
 expected soap response messages and exceptions after I removed this
 entry from axis2.xml:

 module ref=rampart/   --- REMOVE

 I was testing an axis webapp which contained two services:

 1. an unsecured service - BankService, from Axis /samples/faulthandling/
 2. and a secured service - sample03, from Rampart /samples/basic/sample03/

 Now when the file /WEB-INF/conf/axis2.xml contained module
 ref=rampart/, I continually got a HTML error page (as described in
 my earlier post - see bottom of email), whether it was

 1. (BankService - unsecured) - Sending a request that would generate
 Insufficient Funds error

 soapenv:Envelope
 xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/;
 xmlns:exam=http://example;
   soapenv:Header/
   soapenv:Body
      exam:withdraw
         exam:account88/exam:account
         exam:amount1200/exam:amount
      /exam:withdraw
   /soapenv:Body
 /soapenv:Envelope

 when running the /faulthandling example from command-line, this was
 the equivalent of

 ant run.client -Durl=http://localhost:8081/axis2/services/BankService
 -Daccount=88 -Damt=1200


 OR

 2. (sample03 - secured) Or trying to log in with incorrect login details:

 (In this sample, only bob is a valid Username. All others usernames
 should throw authentication errors)

 soap:Envelope xmlns:soap=http://www.w3.org/2003/05/soap-envelope;
 xmlns:sam=http://sample03.samples.rampart.apache.org;
    soap:Header
             wsse:Security soap:mustUnderstand=1

 xmlns:wsse=http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd;
               wsse:UsernameToken wsu:Id=UsernameToken-1815911479

 xmlns:wsu=http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd;
                 wsse:Usernamebobx/wsse:Username
                 wsse:Password

 Type=http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText;bobPW/wsse:Password
              /wsse:UsernameToken
            /wsse:Security
         /soap:Header
   soap:Body
      sam:echo
         !--Optional:--
         sam:param0echo this string/sam:param0
      /sam:echo
   /soap:Body
 /soap:Envelope



 But after removing the rampart entry from axis2.xml, things started
 working as expected.

 I was now getting expected results like these:

 1. BankService

 soapenv:Envelope
 xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/;
   soapenv:Body
      soapenv:Fault
         faultcodesoapenv:Server/faultcode
         faultstringInsufficient funds/faultstring
         

Problems using XPath in Axiom when namespaces are involved

2009-10-22 Thread Robert Baldock
Hi -

I'm having problems getting my head round the use of XPath in Axiom,
especially when using namespaces.

With an XML snippet like this:

?xml version=1.0 encoding=utf-16?
X
 Y
Ztest/Z
 /Y
/X

And a code snippet like this:

String xpathString = /X/Y/Z;
AXIOMXPath xpathExpression = new AXIOMXPath(xpathString);
OMElement element = (OMElement)xpathExpression.selectSingleNode(root);

I can retrieve the element from the XML without any problem.

However, with XML like this:

?xml version=1.0 encoding=utf-16?
X xmlns:xsi=A  xmlns:xsd=B xmlns=C
 Y
Ztest/Z
 /Y
/X

OMNamespace namespace = documentElement.getNamespace();
String prefix = namespace.getPrefix();
String uri = namespace.getNamespaceURI();

AXIOMXPath xpathExpression = new AXIOMXPath(xpathString);
xpathExpression.addNamespace(prefix, uri);
OMElement element = (OMElement)xpathExpression.selectSingleNode(root);

I get no results.

Can anyone spot why this might be?

Any advice would be much appreciated.


Robert




Re: Problems using XPath in Axiom when namespaces are involved

2009-10-22 Thread Andreas Veithen
Robert,

My guess is that the issue is related to the fact that you are trying
to define a default namespace for the XPath expression. Can you check
in the Jaxen documentation if it says something about this?

Note that defining a default namespace for an XPath expression is not
a good idea anyway, because it will prevent you from matching elements
or attributes in the null namespace. The reason is that the null
namespace can only be used as default namespace (i.e. xmlns:p= is
illegal). Therefore if you declare a different default namespace, you
can't refer to the null namespace in your XPath expression.

That is the reason why for example the XSLT specification defines the
namespace context of an XPath expression as follows: the set of
namespace declarations are those in scope on the element which has the
attribute in which the expression occurs; [...] the default namespace
(as declared by xmlns) is not part of this set

Andreas

On Thu, Oct 22, 2009 at 19:09, Robert Baldock robert.bald...@pfiks.com wrote:
 Hi -

 I'm having problems getting my head round the use of XPath in Axiom,
 especially when using namespaces.

 With an XML snippet like this:

 ?xml version=1.0 encoding=utf-16?
 X
  Y
    Ztest/Z
  /Y
 /X

 And a code snippet like this:

 String xpathString = /X/Y/Z;
 AXIOMXPath xpathExpression = new AXIOMXPath(xpathString);
 OMElement element = (OMElement)xpathExpression.selectSingleNode(root);

 I can retrieve the element from the XML without any problem.

 However, with XML like this:

 ?xml version=1.0 encoding=utf-16?
 X xmlns:xsi=A  xmlns:xsd=B xmlns=C
  Y
    Ztest/Z
  /Y
 /X

 OMNamespace namespace = documentElement.getNamespace();
 String prefix = namespace.getPrefix();
 String uri = namespace.getNamespaceURI();

 AXIOMXPath xpathExpression = new AXIOMXPath(xpathString);
 xpathExpression.addNamespace(prefix, uri);
 OMElement element = (OMElement)xpathExpression.selectSingleNode(root);

 I get no results.

 Can anyone spot why this might be?

 Any advice would be much appreciated.


 Robert





Re: Axis 2 (1.5) - Unable to find service for POJO

2009-10-22 Thread Amila Suriarachchi
On Thu, Oct 22, 2009 at 9:42 PM, mule_user s...@aol.com wrote:


 New to Axis2. Using the POJO guide for exposing service found in link:

 http://ws.apache.org/axis2/1_5/pojoguide.html

 I can see the wsdl in the browser, but cannot see the service. The service
 apparaently was not found.  Any suggestion will be appreciated.

 Following are the steps that I have taken.

 Axis2Weather (it is web project containing WebContent)
 |
 src
 |  |
 |   sample.pojo.data
 |  |   |
 |  |Weather.java
 |  |
 |   sample.pojo.service
 |  |
 |   WeatherService.java
 |
 WebContent
 |
  WEB-INF
|
|
 lib (has all jars from Axis2, version 1.5)
|
 services
| |
|  WeatherService
|   |
|META-INF
| |
|
 services.xml
|
 web.xml
 ///
 services.xml:

 service name=WeatherService scope=application
description
Weather POJO Service
/description
messageReceivers
messageReceiver
mep=http://www.w3.org/2004/08/wsdl/in-only;
class=org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver/
messageReceiver
mep=http://www.w3.org/2004/08/wsdl/in-out;
class=org.apache.axis2.rpc.receivers.RPCMessageReceiver/
/messageReceivers
parameter name=ServiceClass
sample.pojo.service.WeatherService
/parameter
 /service

 
 web.xml:

 ?xml version=1.0 encoding=UTF-8?
 web-app id=WebApp_ID version=2.4
 xmlns=http://java.sun.com/xml/ns/j2ee;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee
 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;
display-name
Axis2Weather/display-name

servlet
display-nameApache-Axis Servlet/display-name
servlet-nameAxisServlet/servlet-name

  servlet-classorg.apache.axis2.transport.http.AxisServlet/servlet-class
load-on-startup1/load-on-startup
/servlet
servlet
display-name
Axis Admin Servlet/display-name
servlet-nameAdminServlet/servlet-name
servlet-class
org.apache.axis.transport.http.AdminServlet/servlet-class
load-on-startup100/load-on-startup
/servlet

servlet-mapping
servlet-nameAxisServlet/servlet-name
url-pattern/servlet/AxisServlet/url-pattern
/servlet-mapping
servlet-mapping
servlet-nameAxisServlet/servlet-name
url-pattern*.jws/url-pattern
/servlet-mapping
servlet-mapping
servlet-nameAxisServlet/servlet-name
url-pattern/services/*/url-pattern
/servlet-mapping
servlet-mapping
servlet-nameAdminServlet/servlet-name
url-pattern/servlet/AdminServlet/url-pattern
/servlet-mapping
 /web-app

 //

 package sample.pojo.data;

 public class Weather {
float temperature;
String forecast;
boolean rain;
float howMuchRain;

public void setTemperature(float temp){
temperature = temp;
}

public float getTemperature(){
return temperature;
}

public void setForecast(String fore){
forecast = fore;
}

public String getForecast(){
return forecast;
}

public void setRain(boolean r){
rain = r;
}

public boolean getRain(){
return rain;
}

public void setHowMuchRain(float howMuch){
howMuchRain = howMuch;
}

public float getHowMuchRain(){
return howMuchRain;
}
 }

 //

 package sample.pojo.service;

 import sample.pojo.data.Weather;

 public class WeatherService{

 Weather weather;

public void setWeather(Weather weather){
this.weather = weather;
}

public Weather getWeather(){
return this.weather;
}
 }

 /

 The context root of the application is: Axis2Weather

 Axis2Weather successfully gets deployed in the application server
 (WebSphere
 in this case) as an EAR file and the Axis2Weather application successfully
 gets started in the application server.

 But when I enter the URL: http://localhost:9081/Axis2Weather/services , I


try http://localhost:9081/Axis2Weather/services/listServices

thanks,
Amila.

get error as:

 org.apache.axis2.AxisFault: The