Re: many threads invoking the same service

2009-03-13 Thread Alexis Midon
The thing is that in my case I have one ServiceClient *per* thread. None of
them are accessed by different threads.

Alexis


On Fri, Mar 13, 2009 at 2:35 PM, Paul French  wrote:

>  Hello Alexis,
>
> I went through the same type of questions as you on this forum a while
> back. The eventual outcome from which I did not have time to definitely
> confirm is that the service client is not thread safe. Apparently it is due
> to how axis2 is designed. I could not understand why a service client cannot
> be thread safe but never got a satisfactory answer. Anyhow I gave up and in
> the end created one AxisConfiguration for many service clients maintained in
> a commons pool.
>
> I'll be watching this thread with interest since I would like to know why a
> service client is not thread safe.
>
> Good luck.
>
> P
>
>  --
> *From:* Alexis Midon [mailto:mi...@intalio.com]
> *Sent:* 13 March 2009 21:12
> *To:* axis-user
> *Subject:* many threads invoking the same service
>
> Hey there,
>
> I have a few questions about how to use ServiceClient when many threads
> invoke the same service.
> In my scenario, multiple threads invoke the same service. The immediate
> solution is to instantiate a new ServiceClient for each call.
>
>client = new ServiceClient(); //
> [case-1]
>
> But this involves recreating expensive resources like AxisConfiguration. In
> addition to these performance considerations, this solution ruins any
> programatic configuration that could take place before and that could be
> shared among ServiceClient instances.
>
> This is why a ConfigurationContext might be passed to ServiceClient:
>
>   client = new ServiceClient(configContext, null);   // [case-2]
>
> By doing that each ServiceClient creates its own anonymous service. However
> in my case i. the service is the same for all threads and ii. extra tweaking
> is done with a ServiceBuilder. So I'd like to share a single service
> instance across ServiceClient instances to save resources:
>
>   client = new ServiceClient(configContext, myService);   // [case-3]
>
> Unfortunately, in that case, exceptions are thrown because the AxisConfig
> instance already helds a reference on the service instance.
>
> org.apache.axis2.AxisFault: Two services cannot have same name.  A service
> with the FOO name already exists in the system.
> at
> org.apache.axis2.client.ServiceClient.configureServiceClient(ServiceClient.java:172)
> at org.apache.axis2.client.ServiceClient.(ServiceClient.java:139)
>
> A way to workaround this is to create the ServiceClient with no service,
> and then explicitly assign the service:
>
>   client = new ServiceClient(configContext, null);// [case-4]
>   client.setAxisService(myService);
>
> This works pretty well, until a race condition kicks in:
>
> org.apache.axis2.AxisFault: The FOO service, which is not valid, does not
> belong to the FOO service group.
> at
> org.apache.axis2.context.ServiceGroupContext.getServiceContext(ServiceGroupContext.java:138)
>
> at
> org.apache.axis2.client.ServiceClient.setAxisService(ServiceClient.java:829)
>
>
> This race condition seems to be fixed in axis2 1.4 by getting a lock on the
> AxisConfiguration instance.
>
> So my questions are:
> a. generally speaking what are the best practices/recommendations for the
> scenario described here?
> b. case-3 and case-4 reveal that the constructor and the setAxisService
> method do not have the same behavior. The former fails if the service is
> already in the AxisConfiguration, the latter removes the service (if any)
> then adds the new service instance. Should this be considered as a bug?
> c. but in the first place, why do we need to add the service instance to
> the main AxisConfiguration? The service used by the ServiceClient might be
> considered as a local object, why should the AxisConfiguration be aware of
> it? Its "scope" should be limited and it shouldn't leak to the global
> configuration. The static counter for anonymous services [2] sounds like a
> hack to workaround a design issue. What am I missing here?
>
> Thanks in advance for your time and answers.
>
> Alexis
>
>
> [1] ServiceClient, line 175 http://tr.im/hjts
> [2] ServiceClient, method createAnonymousService, http://tr.im/hlxm
> http://markmail.org/thread/f33xvusqinzh2pm7
>


RE: many threads invoking the same service

2009-03-13 Thread Paul French
Hello Alexis,
 
I went through the same type of questions as you on this forum a while back.
The eventual outcome from which I did not have time to definitely confirm is
that the service client is not thread safe. Apparently it is due to how
axis2 is designed. I could not understand why a service client cannot be
thread safe but never got a satisfactory answer. Anyhow I gave up and in the
end created one AxisConfiguration for many service clients maintained in a
commons pool.
 
I'll be watching this thread with interest since I would like to know why a
service client is not thread safe.
 
Good luck.
 
P

  _  

From: Alexis Midon [mailto:mi...@intalio.com] 
Sent: 13 March 2009 21:12
To: axis-user
Subject: many threads invoking the same service


Hey there,

I have a few questions about how to use ServiceClient when many threads
invoke the same service. 
In my scenario, multiple threads invoke the same service. The immediate
solution is to instantiate a new ServiceClient for each call.

   client = new ServiceClient(); //
[case-1]

But this involves recreating expensive resources like AxisConfiguration. In
addition to these performance considerations, this solution ruins any
programatic configuration that could take place before and that could be
shared among ServiceClient instances.

This is why a ConfigurationContext might be passed to ServiceClient: 

  client = new ServiceClient(configContext, null);   // [case-2]

By doing that each ServiceClient creates its own anonymous service. However
in my case i. the service is the same for all threads and ii. extra tweaking
is done with a ServiceBuilder. So I'd like to share a single service
instance across ServiceClient instances to save resources:

  client = new ServiceClient(configContext, myService);   // [case-3]

Unfortunately, in that case, exceptions are thrown because the AxisConfig
instance already helds a reference on the service instance.

org.apache.axis2.AxisFault: Two services cannot have same name.  A service
with the FOO name already exists in the system.
at
org.apache.axis2.client.ServiceClient.configureServiceClient(ServiceClient.j
ava:172)
at org.apache.axis2.client.ServiceClient.(ServiceClient.java:139)

A way to workaround this is to create the ServiceClient with no service, and
then explicitly assign the service:

  client = new ServiceClient(configContext, null);// [case-4]
  client.setAxisService(myService);

This works pretty well, until a race condition kicks in:

org.apache.axis2.AxisFault: The FOO service, which is not valid, does not
belong to the FOO service group. 
at
org.apache.axis2.context.ServiceGroupContext.getServiceContext(ServiceGroupC
ontext.java:138) 
at
org.apache.axis2.client.ServiceClient.setAxisService(ServiceClient.java:829)


This race condition seems to be fixed in axis2 1.4 by getting a lock on the
AxisConfiguration instance. 

So my questions are:
a. generally speaking what are the best practices/recommendations for the
scenario described here?
b. case-3 and case-4 reveal that the constructor and the setAxisService
method do not have the same behavior. The former fails if the service is
already in the AxisConfiguration, the latter removes the service (if any)
then adds the new service instance. Should this be considered as a bug?
c. but in the first place, why do we need to add the service instance to the
main AxisConfiguration? The service used by the ServiceClient might be
considered as a local object, why should the AxisConfiguration be aware of
it? Its "scope" should be limited and it shouldn't leak to the global
configuration. The static counter for anonymous services [2] sounds like a
hack to workaround a design issue. What am I missing here?

Thanks in advance for your time and answers.

Alexis


[1] ServiceClient, line 175 http://tr.im/hjts
[2] ServiceClient, method createAnonymousService, http://tr.im/hlxm
http://markmail.org/thread/f33xvusqinzh2pm7



many threads invoking the same service

2009-03-13 Thread Alexis Midon
Hey there,

I have a few questions about how to use ServiceClient when many threads
invoke the same service.
In my scenario, multiple threads invoke the same service. The immediate
solution is to instantiate a new ServiceClient for each call.

   client = new ServiceClient(); //
[case-1]

But this involves recreating expensive resources like AxisConfiguration. In
addition to these performance considerations, this solution ruins any
programatic configuration that could take place before and that could be
shared among ServiceClient instances.

This is why a ConfigurationContext might be passed to ServiceClient:

  client = new ServiceClient(configContext, null);   // [case-2]

By doing that each ServiceClient creates its own anonymous service. However
in my case i. the service is the same for all threads and ii. extra tweaking
is done with a ServiceBuilder. So I'd like to share a single service
instance across ServiceClient instances to save resources:

  client = new ServiceClient(configContext, myService);   // [case-3]

Unfortunately, in that case, exceptions are thrown because the AxisConfig
instance already helds a reference on the service instance.

org.apache.axis2.AxisFault: Two services cannot have same name.  A service
with the FOO name already exists in the system.
at
org.apache.axis2.client.ServiceClient.configureServiceClient(ServiceClient.java:172)
at org.apache.axis2.client.ServiceClient.(ServiceClient.java:139)

A way to workaround this is to create the ServiceClient with no service, and
then explicitly assign the service:

  client = new ServiceClient(configContext, null);// [case-4]
  client.setAxisService(myService);

This works pretty well, until a race condition kicks in:

org.apache.axis2.AxisFault: The FOO service, which is not valid, does not
belong to the FOO service group.
at
org.apache.axis2.context.ServiceGroupContext.getServiceContext(ServiceGroupContext.java:138)

at
org.apache.axis2.client.ServiceClient.setAxisService(ServiceClient.java:829)


This race condition seems to be fixed in axis2 1.4 by getting a lock on the
AxisConfiguration instance.

So my questions are:
a. generally speaking what are the best practices/recommendations for the
scenario described here?
b. case-3 and case-4 reveal that the constructor and the setAxisService
method do not have the same behavior. The former fails if the service is
already in the AxisConfiguration, the latter removes the service (if any)
then adds the new service instance. Should this be considered as a bug?
c. but in the first place, why do we need to add the service instance to the
main AxisConfiguration? The service used by the ServiceClient might be
considered as a local object, why should the AxisConfiguration be aware of
it? Its "scope" should be limited and it shouldn't leak to the global
configuration. The static counter for anonymous services [2] sounds like a
hack to workaround a design issue. What am I missing here?

Thanks in advance for your time and answers.

Alexis


[1] ServiceClient, line 175 http://tr.im/hjts
[2] ServiceClient, method createAnonymousService, http://tr.im/hlxm
http://markmail.org/thread/f33xvusqinzh2pm7


Re: Error in installation of axis 1.4: Cannot instantiate ModelMBean

2009-03-13 Thread Sagara Gunathunga
 This [1] may  help you.

[1] - 
http://aleph-null.tv/article/20080327-0118-335.xml/Tomcat-5.5-On-Debian:-AccessControlException-for-logging.properties

Thanks ,



On Sat, Mar 14, 2009 at 12:23 AM, Jean-Paul Bouchet
 wrote:
> Hello
> I am trying to install axis 1.4 on a Debian server (Lenny distribution).
> Tomcat5.5 has been installed successfully (applications manager and admin
> work correctly). We use version1.6 of Java.
> Axis is my first application installed in /usr/share/tomcat5.5/webapps.
> When I start tomcat5.5 I get the following errors:
>
> 13 mars 2009 18:56:04 org.apache.commons.modeler.Registry registerComponent
> SEVERE: Error registering
> Catalina:type=Valve,name=StandardContextValve,path=/axis,host=localhost
> javax.management.MBeanException: Cannot instantiate ModelMBean of class
> org.apache.commons.modeler.BaseModelMBean
>      at
> org.apache.commons.modeler.ManagedBean.createMBean(ManagedBean.java:385)
>      at
> org.apache.commons.modeler.Registry.registerComponent(Registry.java:835)
> ...
> Caused by: java.security.AccessControlException: access denied
> (java.io.FilePermission
> /var/lib/tomcat5.5/webapps/axis/WEB-INF/classes/logging.properties read)
>      at
> java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
>      at
> java.security.AccessController.checkPermission(AccessController.java:546)
>      at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
>      at java.lang.SecurityManager.checkRead(SecurityManager.java:871)
> ...
> 13 mars 2009 18:56:04 org.apache.catalina.core.StandardPipeline
> registerValve
> INFO: Can't register valve
> org.apache.catalina.core.StandardContextValve[/axis]
> javax.management.MBeanException: Cannot instantiate ModelMBean of class
> org.apache.commons.modeler.BaseModelMBean
>      at
> org.apache.commons.modeler.ManagedBean.createMBean(ManagedBean.java:385)
>      at
> org.apache.commons.modeler.Registry.registerComponent(Registry.java:835)
> ...
> Caused by: java.security.AccessControlException: access denied
> (java.io.FilePermission
> /var/lib/tomcat5.5/webapps/axis/WEB-INF/classes/logging.properties read)
>      at
> java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
>      at
> java.security.AccessController.checkPermission(AccessController.java:546)
> ...
> 13 mars 2009 18:56:04 org.apache.commons.modeler.Registry registerComponent
> SEVERE: Error registering Catalina:type=Manager,path=/axis,host=localhost
> javax.management.MBeanException: Cannot instantiate ModelMBean of class
> org.apache.commons.modeler.BaseModelMBean
>      at
> org.apache.commons.modeler.ManagedBean.createMBean(ManagedBean.java:385)
>      at
> org.apache.commons.modeler.Registry.registerComponent(Registry.java:835)
> ...
> Caused by: java.security.AccessControlException: access denied
> (java.io.FilePermission
> /var/lib/tomcat5.5/webapps/axis/WEB-INF/classes/logging.properties read)
>      at
> java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
>      at
> java.security.AccessController.checkPermission(AccessController.java:546)
>
> I have checked all the read-write permissions for user tomcat55.
> The file /var/lib/tomcat5.5/webapps/axis/WEB-INF/classes/logging.properties
> didn't exist. I have created one with the following content:
> handlers=java.util.logging.FileHandler, java.util.logging.ConsoleHandler
> .level=INFO
> java.util.logging.FileHandler.pattern=%t/axis.log
>
> I have modified both /etc/tomcat5.5/catalina.policy and
> /etc/tomcat5.5/policy.d/04webapps.policy by adding:
> grant codeBase "file:${catalina.home}/webapps/axis/WEB-INF/lib/-" {
>     permission java.security.AllPermission;
>     permission java.io.FilePermission
> "/usr/share/tomcat5.5/webapps/axis/WEB-INF/classes/logging.properties",
> "read";
> };
> (Due to symbolic links /usr/share/tomcat5.5/webapps is the same as
> var/lib/tomcat5.5/webapps)
>
> Has someone any ideas about the origin of this error and about  the way to
> solve it ?
> Thanks in advance
>
> Jean-Paul Bouchet
> Institut National de la Recherche Agronomique - Centre d'Avignon
> UR 1052  - Génétique et Amélioration des
> Fruits et Légumes
> Domaine Saint-Maurice - BP 94 - F-84143 Montfavet cedex - France
> E-mail : 
> Phone : +33-(0)4-3272-2723 - Fax : +33-(0)4-3272-2702
> 
>
>
>



-- 
Sagara Gunathunga

Blog - http://ssagara.blogspot.com
Web - http://sagaras.awardspace.com/


Re: Axis2 firsts steps

2009-03-13 Thread Sagara Gunathunga
Hi Simon,

You have several ways to deploy your Axis2 web services.

 1. if you going to use axis2.war distribution , you need to deploy it
on a app server like Tomcat ,then you can use axis2 management console
to deploy your new services.

2. If you have download the axis2 standard binary distribution you
don't need any extra server  to test your services , when you execute
axis2server.bat Axis2's SimpleHTTPServer will run and there is no page
in  "http://localhost:8080/axis2";  URL,
"http://localhost:8080/axis2/services/ "  is the default page of
SimpleHTTPServer . It will list all of your services, so you already
in the right track .


[1] is a relay good resources to get start with Axis2 development ,
try to follow that tutorial , but i like to add small modification to
that tutorial . I guess you are on latest version of Axis2 if so in
"Step 4" of that tutorial you don't  required to create a separate
repository you can use the default repository available with standard
version , once you have your SimpleService.aar created , just put it
in to the "[axis2-1.4.1xxx]\repository\services" directory and execute
axis2server.bat to deeply your services.

[1] - http://wso2.org/library/95


Thanks ,


On Sat, Mar 14, 2009 at 12:30 AM, Simon Côté  wrote:
> Hi,
> I'm sorry to write you, but at this point you are my last hope.  I'm a newbe
> in the WS world.  A collegue have suggest me to use your product Axis2 for
> easily create wsdl code from my Java class.  I'm trying to go through the
> installation guide.  I don't have a real server, so I have installed the
> Axis2 standalone installation.  I'm at point that I should install Axis2 in
> a Servlet Container.  There my first question:
>
> 1)  Do we consider the axis2 installation like a Servlet Container?  Do I to
> put the axis2.war file just created in the webapp folder of my Axis2
> installation folder?
>
> The problem at the base of me email is that I don't have the "Axis web
> application home page".  After have called the axis2server.bat executable, I
> try to reach the home page by the url "http://localhost:8080/axis2";, by I'm
> instantly redirected to the page "http://localhost:8080/axis2/services/"  ??
>
> Thanks for any explication,
>
> Have a nice day
>
> Simon



-- 
Sagara Gunathunga

Blog - http://ssagara.blogspot.com
Web - http://sagaras.awardspace.com/


Axis2 firsts steps

2009-03-13 Thread Simon Côté
Hi,
I'm sorry to write you, but at this point you are my last hope.  I'm a newbe in 
the WS world.  A collegue have suggest me to use your product Axis2 for easily 
create wsdl code from my Java class.  I'm trying to go through the installation 
guide.  I don't have a real server, so I have installed the Axis2 standalone 
installation.  I'm at point that I should install Axis2 in a Servlet Container. 
 There my first question:

1)  Do we consider the axis2 installation like a Servlet Container?  Do I to 
put the axis2.war file just created in the webapp folder of my Axis2 
installation folder?

The problem at the base of me email is that I don't have the "Axis web 
application home page".  After have called the axis2server.bat executable, I 
try to reach the home page by the url "http://localhost:8080/axis2";, by I'm 
instantly redirected to the page "http://localhost:8080/axis2/services/";  ??

Thanks for any explication,

Have a nice day

Simon 

Error in installation of axis 1.4: Cannot instantiate ModelMBean

2009-03-13 Thread Jean-Paul Bouchet

Hello
I am trying to install axis 1.4 on a Debian server (Lenny distribution).
Tomcat5.5 has been installed successfully (applications manager and 
admin work correctly). We use version1.6 of Java.

Axis is my first application installed in /usr/share/tomcat5.5/webapps.
When I start tomcat5.5 I get the following errors:

13 mars 2009 18:56:04 org.apache.commons.modeler.Registry registerComponent
SEVERE: Error registering 
Catalina:type=Valve,name=StandardContextValve,path=/axis,host=localhost
javax.management.MBeanException: Cannot instantiate ModelMBean of class 
org.apache.commons.modeler.BaseModelMBean
  at 
org.apache.commons.modeler.ManagedBean.createMBean(ManagedBean.java:385)
  at 
org.apache.commons.modeler.Registry.registerComponent(Registry.java:835)

...
Caused by: java.security.AccessControlException: access denied 
(java.io.FilePermission 
/var/lib/tomcat5.5/webapps/axis/WEB-INF/classes/logging.properties read)
  at 
java.security.AccessControlContext.checkPermission(AccessControlContext.java:323) 

  at 
java.security.AccessController.checkPermission(AccessController.java:546)
  at 
java.lang.SecurityManager.checkPermission(SecurityManager.java:532)

  at java.lang.SecurityManager.checkRead(SecurityManager.java:871)
...
13 mars 2009 18:56:04 org.apache.catalina.core.StandardPipeline 
registerValve
INFO: Can't register valve 
org.apache.catalina.core.StandardContextValve[/axis]
javax.management.MBeanException: Cannot instantiate ModelMBean of class 
org.apache.commons.modeler.BaseModelMBean
  at 
org.apache.commons.modeler.ManagedBean.createMBean(ManagedBean.java:385)
  at 
org.apache.commons.modeler.Registry.registerComponent(Registry.java:835)

...
Caused by: java.security.AccessControlException: access denied 
(java.io.FilePermission 
/var/lib/tomcat5.5/webapps/axis/WEB-INF/classes/logging.properties read)
  at 
java.security.AccessControlContext.checkPermission(AccessControlContext.java:323) 

  at 
java.security.AccessController.checkPermission(AccessController.java:546)

...
13 mars 2009 18:56:04 org.apache.commons.modeler.Registry registerComponent
SEVERE: Error registering Catalina:type=Manager,path=/axis,host=localhost
javax.management.MBeanException: Cannot instantiate ModelMBean of class 
org.apache.commons.modeler.BaseModelMBean
  at 
org.apache.commons.modeler.ManagedBean.createMBean(ManagedBean.java:385)
  at 
org.apache.commons.modeler.Registry.registerComponent(Registry.java:835)

...
Caused by: java.security.AccessControlException: access denied 
(java.io.FilePermission 
/var/lib/tomcat5.5/webapps/axis/WEB-INF/classes/logging.properties read)
  at 
java.security.AccessControlContext.checkPermission(AccessControlContext.java:323) 

  at 
java.security.AccessController.checkPermission(AccessController.java:546)


I have checked all the read-write permissions for user tomcat55.
The file 
/var/lib/tomcat5.5/webapps/axis/WEB-INF/classes/logging.properties 
didn't exist. I have created one with the following content:

handlers=java.util.logging.FileHandler, java.util.logging.ConsoleHandler
.level=INFO
java.util.logging.FileHandler.pattern=%t/axis.log

I have modified both /etc/tomcat5.5/catalina.policy and 
/etc/tomcat5.5/policy.d/04webapps.policy by adding:

grant codeBase "file:${catalina.home}/webapps/axis/WEB-INF/lib/-" {
 permission java.security.AllPermission;
 permission java.io.FilePermission 
"/usr/share/tomcat5.5/webapps/axis/WEB-INF/classes/logging.properties", 
"read";

};
(Due to symbolic links /usr/share/tomcat5.5/webapps is the same as 
var/lib/tomcat5.5/webapps)


Has someone any ideas about the origin of this error and about  the way 
to solve it ?

Thanks in advance

Jean-Paul Bouchet
Institut National de la Recherche Agronomique - Centre d'Avignon
UR 1052  - Génétique et Amélioration 
des Fruits et Légumes

Domaine Saint-Maurice - BP 94 - F-84143 Montfavet cedex - France
E-mail : 
Phone : +33-(0)4-3272-2723 - Fax : +33-(0)4-3272-2702





Re: Example for WS-SecurityPolicy in WSDL?

2009-03-13 Thread Nandana Mihindukulasooriya
Hi Dennis,
Can you post the WSDL you are code generating against ?

thanks,
nandana

On Fri, Mar 13, 2009 at 3:09 AM, Dennis Sosnoski  wrote:

> I've been trying to use the client-side code generation support for
> WS-SecurityPolicy in WSDL, with Axis2 1.4.1 and Rampart 1.4. I've tried
> several variations of where I place the policy in the WSDL, including
> using reference and embedding it directly in the , but
> each time I get:
>
>[java] Exception in thread "main"
> org.apache.axis2.wsdl.codegen.CodeGenerationException:
> org.apache.axis2.wsdl.codegen.CodeGenerationException:
> java.lang.RuntimeException: can't serialize the policy
> ..
>[java] at
> org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:271)
>
>
>[java] at
> org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
>[java] at
> org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
>[java] Caused by:
> org.apache.axis2.wsdl.codegen.CodeGenerationException:
> java.lang.RuntimeException: can't serialize the policy
> ..
>[java] at
> org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.emitStub(AxisServiceBasedMultiLanguageEmitter.java:534)
>
>
>[java] at
> org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:260)
>
>
>[java] ... 2
> more
>[java] Caused by: java.lang.RuntimeException: can't serialize the
> policy ..
>[java] at
> org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.getInputElement(AxisServiceBasedMultiLanguageEmitter.java:2732)
>
>
>[java] at
> org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.generateMethodElement(AxisServiceBasedMultiLanguageEmitter.java:2261)
>
>
>
>[java] at
> org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.loadOperations(AxisServiceBasedMultiLanguageEmitter.java:2151)
>
>
>[java] at
> org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.createDOMDocumentForInterface(AxisServiceBasedMultiLanguageEmitter.java:1207)
>
>
>[java] at
> org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.writeInterface(AxisServiceBasedMultiLanguageEmitter.java:1163)
>
>
>[java] at
> org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.emitStub(AxisServiceBasedMultiLanguageEmitter.java:492)
>
>
>[java] ... 3
> more
>[java] Java Result: 1
>
> Has anyone been able to get the client-side generation for
> WS-SecurityPolicy in WSDL to work? If so, can you supply an example WSDL?
>
> Thanks,
>
>  - Dennis
>
> --
> Dennis M. Sosnoski
> SOA and Web Services in Java
> 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
>
>
>


Re: Applying policies at binding hierarchy in Apache Axis2 1.4.1/Rampart 1.4

2009-03-13 Thread Nandana Mihindukulasooriya
Hi Alexis,
 Sorry for the delay. I was busy with other projects I could write a
proper sample. But I tested with these two samples [1] where the policy is
in the WSDL with Axis2 1.4.1 and Rampart 1.4 and both of them seem to work
fine. I was able to invoke it successfully. WSDL11ToAxisServiceBuilder seems
to correctly attach the policies to the corresponding policy subjects. I
wonder whether AXIS2-4233 [2] is the issue.

thanks,
nandana

P.S. : I couldn't attach a proper sample but you can see my services.xml and
the WSDL in the samples.

[1] - http://people.apache.org/~nandana/policy-issue/binding-level/
   http://people.apache.org/~nandana/policy-issue/service-level/
[2] - https://issues.apache.org/jira/browse/AXIS2-4233

On Mon, Mar 9, 2009 at 11:08 PM, Alexis Midon  wrote:

> Hello guys,
>
> would you have a working sample of policies embedded in a wsdl, please?
> thanks in advance for your answers.
>
> Alexis
>
>
>
> On Thu, Mar 5, 2009 at 3:09 PM, Alexis Midon  wrote:
>
>> Hi Nandana,
>>
>> did you have a chance to look at it?
>>
>> Alexis
>>
>>
>>
>> On Fri, Feb 20, 2009 at 1:05 PM, Alexis Midon  wrote:
>>
>>> The wsdl is also available here : http://gist.github.com/67691
>>> Just in case the attachement did not make it through.
>>>
>>> Alexis
>>>
>>>
>>>
>>> On Fri, Feb 20, 2009 at 1:02 PM, Alexis Midon  wrote:
>>>
 Hi Nandana,

 sorry for the late answer. Here is attached the wsdl I used.
 And the code to create the AxisService is here [1]

 [1]
 http://github.com/matthieu/apache-ode/blob/085025ab3639c7aa0255bbb9b905210ff6caf295/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisService.java#L80

 Thanks a lot for your help.

 Alexis


 2009/2/16 Nandana Mihindukulasooriya 

  Hi Alexis,
>   can you post the WSDL you used  ?
>
> thanks,
> nandana
>
>
> On Mon, Feb 16, 2009 at 9:06 AM, Alexis Midon wrote:
>
>> I can't wait for your feedback, and may be a working sample ;)
>>
>> Thanks a lot Nandana!
>>
>> Alexis
>>
>>
>>
>> On Sun, Feb 15, 2009 at 3:49 PM, Nandana Mihindukulasooriya <
>> nandana@gmail.com> wrote:
>>
>>> Hi Alexis,
>>>Sorry I just saw the mail. I will have a look at your
>>> WSDL11ToAxisServiceBuilder and see why the policy is not being attached
>>> correctly.
>>>
>>> thanks,
>>> nandana
>>>
>>>
>>>
>>> On Thu, Feb 12, 2009 at 10:21 AM, Alexis Midon wrote:
>>>
 (forwarding to the rampart folks)

 Alexis



 -- Forwarded message --
 From: Alexis Midon 
 Date: Tue, Feb 10, 2009 at 5:50 PM
 Subject: Applying policies at binding hierarchy in Apache Axis2
 1.4.1/Rampart 1.4
 To: axis-user@ws.apache.org



 Hi everyone,

 based on this article: http://wso2.org/library/3786, I wrote my own
 (simple) wsdl with a policy attached to the soap binding.
 I load that wsdl with a WSDL11ToAxisServiceBuilder [1]. My issue is
 that when I invoke the service the following AxisFault is thrown:

 org.apache.axis2.AxisFault: Must Understand check failed for header
 http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd:
  Security
 at
 org.apache.axis2.engine.AxisEngine.checkMustUnderstand(AxisEngine.java:102)
 at
 org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:166)
 at
 org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)


 After a debugging session, it appears that the policy map of the
 AxisService holds a policy reference, but the policy include and 
 subject do
 not. And the policy is never accessed by the RampartReceiver.

 Could you tell what I'm missing and/or point me to a working sample
 of embedded policy (I did not find any in Rampart repo)?

 Thanks in advance,

 Alexis

 [1]
 http://github.com/matthieu/apache-ode/blob/085025ab3639c7aa0255bbb9b905210ff6caf295/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisService.java#L80



>>>
>>>
>>> --
>>> Nandana Mihindukulasooriya
>>> WSO2 inc.
>>>
>>> http://nandana83.blogspot.com/
>>> http://www.wso2.org
>>>
>>
>>

>>>
>>
>


Re: Adding security header to STSClient in rahas

2009-03-13 Thread Nandana Mihindukulasooriya
Can you post the SOAP message ? In the case of symmetric binding username
token header is encrypted.

thanks,
nandana

On Thu, Mar 12, 2009 at 5:06 PM, Håkon Sagehaug
wrote:

>
>
> -- Forwarded message --
> From: Håkon Sagehaug 
> Date: 2009/3/12
> Subject: Re: Adding security header to STSClient in rahas
> To: rampart-...@ws.apache.org
>
>
> Hi
>
> what I read out of the code is that if username and password is set in
> options it should be picked up, but I set it in option and still no
> unsername token header.
>
> Here is my policy, if anyone sees something wrong it's highly appreciated
>
>  xmlns:wsu="
> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd
> "
> xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"; xmlns:sp="
> http://schemas.xmlsoap.org/ws/2005/07/securitypolicy";>
> 
> 
> 
> 
> 
>  sp:IncludeToken="
> http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never";>
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>  xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy
> ">
> 
>  sp:IncludeToken="
> http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient";
> />
> 
> 
> 
> 
> 
> http://schemas.xmlsoap.org/ws/2005/07/securitypolicy";>
> 
> 
> 
> 
> 
> 
> 
> http://ws.apache.org/rampart/policy";>
> client
> service
> 
> PWCBHandler
> 
> 
>  provider="org.apache.ws.security.components.crypto.Merlin">
>  name="org.apache.ws.security.crypto.merlin.keystore.type">JKS
>  name="org.apache.ws.security.crypto.merlin.file">
>clientTrustStore.jks
> 
> 
>  
> name="org.apache.ws.security.crypto.merlin.keystore.password">pass
> 
> 
> 
> 
> 
>
> 2009/3/11 Martin Gainty 
>
>
>>/**
>> * Sets the crypto information required to process the RSTR.
>> *
>> * @param cryptoCrypto information
>> * @param cbHandler Callback handler to provide the private key
>> password to
>> *  decrypt
>> */
>>public void setCryptoInfo(Crypto crypto, CallbackHandler cbHandler) {
>>this.crypto = crypto;
>>this.cbHandler = cbHandler;
>>}
>>
>> Test Harness from RampartUtil:
>> public static String getToken(RampartMessageData rmd, OMElement
>> rstTemplate,
>>String issuerEpr, String action, Policy issuerPolicy) throws
>> RampartException {
>>
>>try {
>>//First check whether the user has provided the token
>>MessageContext msgContext = rmd.getMsgContext();
>>String customTokeId = (String) msgContext
>>
>>  .getProperty(RampartMessageData.KEY_CUSTOM_ISSUED_TOKEN);
>>if(customTokeId != null) {
>>return customTokeId;
>>} else {
>>
>>Axis2Util.useDOOM(false);
>>
>>STSClient client = new STSClient(rmd.getMsgContext()
>>.getConfigurationContext());
>>// Set request action
>>client.setAction(action);
>>
>>client.setRstTemplate(rstTemplate);
>>
>>// Set crypto information
>>Crypto crypto =
>> RampartUtil.getSignatureCrypto(rmd.getPolicyData().getRampartConfig(),
>>
>>  rmd.getMsgContext().getAxisService().getClassLoader());
>>CallbackHandler cbh = RampartUtil.getPasswordCB(rmd);
>>client.setCryptoInfo(crypto, cbh);
>>
>> which is called from BindingBuilder:
>>  protected WSSecUsernameToken addUsernameToken(RampartMessageData rmd)
>> throws RampartException {
>>
>>log.debug("Adding a UsernameToken");
>>
>>RampartPolicyData rpd = rmd.getPolicyData();
>>
>>//Get the user
>>//First try options
>>Options options = rmd.getMsgContext().getOptions();
>>String user = options.getUserName();
>>if(user == null || user.length() == 0) {
>>//Then try RampartConfig
>>if(rpd.getRampartConfig() != null) {
>>

Re: How to change Axis2 response character encoding

2009-03-13 Thread Andreas Veithen
The message builder receives the raw stream from the transport and
returns the corresponding Axiom tree. This is the right place to tweak
the character encoding. Message builders are implementations of
org.apache.axis2.builder.Builder and are configured in axis2.xml (in
the messageBuilders section). In your case you will probably have to
implement an alternative SOAPBuilder. The problem is that message
builders are selected by Content-Type alone. You need to take this
into account if your code access services other than the one having
the encoding issue.

Andreas

On Fri, Mar 13, 2009 at 06:57, Sanat Mastan Kumar  wrote:
> Hi Andreas,
> The service we are accessing is Omniture Sitecatalyst webservice, which i
> think we (atleast i) dont have any control over them. they are claiming that
> they are sending data in UTF-8 format, i accept it is we who are sending
> these invalid characters(because our site has multi language support ) to
> omniture which Omniture is storing in its database, but omniture should
> takecare of normalizing them when sending data back in UTF-8 format.
>
> I added following code to my client handler to bring required stream, i put
> this handler in clients InFlow Address phase,
>
>         ByteArrayOutputStream byteOutStr = new ByteArrayOutputStream();
>     SOAPEnvelope se = msgContext.getEnvelope();
>     OMOutputFormat outputFormat = new OMOutputFormat();
>     outputFormat.setCharSetEncoding("ISO-8859-1"); //Also tried with
> differnt formats
>         try{
>         se.serializeAndConsume(byteOutStr, outputFormat);
>         }catch (Exception e){
>             e.printStackTrace();
>         }
>
> i got the byte stream but it is copy of the actual stream, the problem with
> this is msgContext.getEnvelope() contains data until it reached invalid
> UTF-8 character, so the same has been copied to ByteArrayOutputStream
> because of this wehave only partial response, As soon as stream is coming
> from the service axis2 is reading it using UTF8Reader as per below exception
> stracktrace. so if we can somehow get the control of reading the actual
> stream this will help us in normalizing the invalid characters before
> converting it into a streamreader, can you please show how we can read raw
> stream from message builder?
>
> Thanks
> Sanat.
>
>
> 
>
>
> The only place where you have access to the raw stream is in the
> message builder.
>
> I'm just curious: what is preventing you from having the issue fixed
> by the people who implemented the service?
>
> Andreas
>
>
> On Thu, Mar 12, 2009 at 11:33 AM, Sanat Mastan Kumar 
> wrote:
>>
>> Hi Andreas thanks for your response,
>>
>> can you please suggest how we can take the raw response steam from axis2
>> with out any char encoding applying to it?
>>
>> Sanat,
>>
>> It is the responsibility of the service to choose the encoding it
>> wants to use in its response, and the service is expected to indicate
>> the encoding in the Content-Type and then to use that encoding in the
>> response. In your case the service fails to do so (unless you have
>> discovered a very rare bug in Axis2) and violates the SOAP specs. You
>> should collect the evidence for this by inspecting the response using
>> TCPMon or Wireshark and tell the people who developed this service to
>> fix it.
>>
>> Andreas
>>
>> On Wed, Mar 11, 2009 at 18:16, yskm  wrote:
>> >
>> > Hi,
>> >
>> > i am consuming a webservice (dont know the implementation of the
>> > service)
>> > for this i have written my client using axis2 1.4 and rampart 1.4, this
>> > client is working fine under normal response payload, if response
>> > contains
>> > any special characters like "Hello world ai? " i.e invalid UTF-8
>> > characters
>> > myclient is breaking... following is the stacktrace
>> >
>> > org.apache.axis2.AxisFault: Error in extracting message properties
>> > � � � �at
>> >
>> > org.apache.rampart.handler.RampartReceiver.setFaultCodeAndThrowAxisFault(RampartReceiver.java:166)
>> > � � � �at
>> >
>> > org.apache.rampart.handler.RampartReceiver.invoke(RampartReceiver.java:99)
>> > � � � �at org.apache.axis2.engine.Phase.invoke(Phase.java:317)
>> > � � � �at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:264)
>> > � � � �at
>> > org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:163)
>> > � � � �at
>> >
>> > org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:363)
>> > � � � �at
>> >
>> > org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:416)
>> > � � � �at
>> >
>> > org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
>> > � � � �at
>> >
>> > org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
>> > � � � �at
>> >
>> > org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:548)
>> > � � � �at
>> >
>> > org.apache.axis2.clie

Re: [Axis2 1.4] WS-Policy in WSDL 1.1 vs WSDL2.0 using wsdl2java utility

2009-03-13 Thread Pradeep Fernando
Hi Leon,


> However, when I tried to do the same with a service that I had
> written, the generated
> service stub did not include the ws-policy information.

no surprises. currently it is under the TODO list. but I would like to
fix this. can you please raise a JIRA issue
regarding this.

cheers,
Pradeep Fernando.