Re: axis2 and mtom

2006-03-13 Thread Brian Shields

Thanks Thilina,
MTOM was obviously not switched by default in my deployment.
I will explore Secure MTOM, it seems perfect for my needs.
Regards,
Brian.

Thilina Gunarathne wrote:


Hi Brian,
See my comments below...
 
On 3/12/06, *Brian Shields* [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] wrote:


Hi all,
I am having some trouble sending attachments with axis2 messages.
Until
now I have been sending a large xml string as a parameter of a web
service call. I recently applied security to this and I am getting
a lot
of errors when the string parameter goes beyond a certain size. What I
am exploring as a work around is sending the xml file as an
attachment
using MTOM. From some v quick research i think this is the best
approach
when security is involved.

 
You can also consider using Secure MTOM directly if you r going for 
encryption... An encrypted payload(cipher value) is a binary content. 
Normally in the context of web services people encode the 
payloadcipher value using base64 and send it..Now with MTOM we can 
directly send the encrypted payload as an binary attachment. Axis2 
provides secure MTOM support...


My problem is on the parsing of this message. I am getting a
ContentID
is null message. Is this because I have not specified the MIME
type in
the Client? 

 
AFAIK this does not matter a lot when using data handlers...


My client code looks like...

OMElement value = fac.createOMElement(Text, omNs);
DataHandler dh = new DataHandler(new ByteArrayDataSource(
s.getBytes()));
OMText text = fac.createText(dh, true);
value.addChild(text);
where s is a String.

The server code to parse this looks like...
OMElement binaryElement = element.getFirstElement();
OMText binaryNode = (OMText) binaryElement.getFirstOMChild();

 
 binaryNode.setOptimize(true);


DataHandler actualDH = (DataHandler)binaryNode.getDataHandler();

 
Do u have MTOM enabled in the client side. MTOM is switched ON by 
default , but it's worth checking... You can use HttpTracer (aka 
TCPMON) to see the wire level message. For me it seems ur message 
still transmits without MTOM optimisation.
 
You can try doing a hack by adding this line in between the 3d and 4th 
lines in the above given server code...

binaryNode.setOptimize(true);
 
I don't recomend this usage in the long run.. But give it a try.. If 
it does not give the same error, then it means ur message was not 
optimized earlier...
 
 
~Thilina



--
May the SourcE be with u
http://webservices.apache.org/~thilina/ 
http://webservices.apache.org/%7Ethilina/
http://thilinag.blogspot.com/ 
http://www.bloglines.com/blog/Thilina  



--
Brian Shields BSc. MSc.,
PhD Candidate,
Department of Information Technology,
National University of Ireland,
Galway,
Ireland.


Re: [Axis2] EchoNonBlockingDualClient problem

2006-03-13 Thread Brian Shields

Tony,
Apologies for jumping into this thread on an unrelated issue but i 
notice you have axis2 deployed on JBoss 4.0. I am about to undertake 
this task and was wondering if there was any resources on the web to 
help in it. I dont have a lot of experience with JBoss so not looking 
forward to it!!

Regards,
Brian

Antony Wilson wrote:



I have not been able to get the EchonNonBlockingDualClient example to 
work as described in the documentation.  In my setup, I have Axis2 
deployed to JBoss 4.0.3 and I have modified the 
userguide.example1.MyService to delay for about 10 seconds before 
responding (leaving the 'echo' method).  After packaging and deploying 
the MyService.aar to Axis2, I run EchoNonBlockingDualClient 
example...slightly modified to add a print statement within the while 
loop...like so


   public static void main(String[] args) {
   try {
   OMElement payload = ClientUtil.getEchoOMElement();

   Options options = new Options();
   options.setTo(targetEPR);
   options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
   options.setUseSeparateListener(true);

   //Callback to handle the response
   Callback callback = new Callback() {
   public void onComplete(AsyncResult result) {
   try {
   StringWriter writer = new StringWriter();
   
result.getResponseEnvelope().serialize(XMLOutputFactory.newInstance()

   .createXMLStreamWriter(writer));
   writer.flush();
   System.out.println(writer.toString());


   } catch (XMLStreamException e) {
   onError(e);
   }
   }

   public void onError(Exception e) {
   e.printStackTrace();
   }
   };

   //Non-Blocking Invocation
   ServiceClient sender = new ServiceClient();
   sender.setOptions(options);
   sender.sendReceiveNonblocking(payload, callback);

   //Wait till the callback receives the response.
   while (!callback.isComplete()) {
   System.out.println(waiting...);
   Thread.sleep(1000);
   }
   //Need to close the Client Side Listener.

We I run it the code appears to block/wait at the 
sender.sendRecieveNonBlocking(...) line for about 10 seconds. When 
the program continues,  I never see any print statements since the 
callback.isComplete() is true by the time it gets to that point in 
the code.  The really bizarre part is that if I use 
options.setUseSeparateListener(false)...the behavior is exactly what 
I was originally expecting...I see several waiting... print 
statements before the callback's onComplete is invoked.  My 
operational scenario requires a dual channel transport since my 
webservice calls can be really long...therefore using a single two-way 
transport (e.g., options.setUseSeparateListener(false)) is not a 
viable option.


Bottomline, I can't seem to get the two-way dual channel stuff 
(EchoNonBlockingDualClient) to work for me.  I must be missing 
something obvious...but I don't see what it is.  Any help would be 
appreciated.


Thanks,
Tony




--
Brian Shields BSc. MSc.,
PhD Candidate,
Department of Information Technology,
National University of Ireland,
Galway,
Ireland.


Axis2 and JBoss 4.0

2006-03-13 Thread Brian Shields

Hi All,
I am currently using Axis2 and WSS4J as a test environment for some 
secure services. I want to now deploy these secure services on a JBoss 
4.0 AS. My experience with JBoss is limited, this work has been carried 
out by another member of the group. We have an ejb application which 
uses a stateless session bean to implement the web services interface. 
At the moment this is all deployed using JBossWS. Has anybody deployed 
Axis2 as a service within JBoss 4.0? Is it straightforward. There is the 
option of changing to JBoss WS, but I am using other Axis2 features like 
handlers that I would rather not drop.
Does anybody have any suggestions as to how I could go about this 
transition? Any documentation on the web where this has been tried?

Regards,
Brian.

--
Brian Shields BSc. MSc.,
PhD Candidate,
Department of Information Technology,
National University of Ireland,
Galway,
Ireland.


Re: Axis2 and JBoss 4.0 and Asynchronous Webservices

2006-03-13 Thread Brian Shields

Tony,
Thats great, Ill get stuck into it. Thats pretty much what I assumed 
would be the way to do it. The only problem I can forsee having is 
having a SessionBean as the Web Service endpoint rather than a POJO. It 
should still be straight forward though and a simple JNDI lookup should 
connect the SessionBean to the EntityBean application in the background. 
Once again my experience with J2EE is limited and JBoss even more so, so 
it will be a case of feeling round in the dark for a while.

Thanks for the pointers though,
Brian.

Antony Wilson wrote:


Brian,

I really did not do anything special for deploying Axis2 to JBoss 
4.0.3. I unzipped the Axis2 war into the JBoss deploy directory and 
deployed the Axis2 webservices to the Axis2 services directory (as 
described in the Axis2 docs). By default, JBoss 4.0.2+ uses tomcat's 
classloading implementation vice their own unified/flat classloader. 
This approach isolates the classes/libraries per web application...so 
you avoid the library/jar conflicts that can sometime arise from using 
a unified classloader (e.g., the default JBoss classloader). So as I 
understand it...it is basically like running on Axis2 on standalone 
Tomcat. If you are using an earlier version of JBoss 4.0.1sp1 or 
lower...you should modify a few lines in jboss 
home\server\default\deploy\jbossweb-tomcat50.sar\META-INF\jboss-service.xml 
as follows:


!--
Get the flag indicating if the normal Java2 parent first class
loading model should be used over the servlet 2.3 web container first
model.

--
attribute name=Java2ClassLoadingCompliancefalse/attribute
−
!--
A flag indicating if the JBoss Loader should be used. This loader
uses a unified class loader as the class loader rather than the tomcat
specific class loader.
The default is false to ensure that wars have isolated class loading
for duplicate jars and jsp files.

--
attribute name=UseJBossWebLoaderfalse/attribute

This will properly isolate the Axis2 classes and has worked for me. 
From this point on...I just followed the instructions is in the Axis2 
docs for deploying webservices.


As mentioned in my earlier email...I have had problems with the 
EchoNonBlockingDualClient example...at this point I'm reasonably 
convinced that it is due to the fact that the webservice is not 
asynchronous. After reading a few earlier threads, I believe I have to 
extend the AbstractInOutAsyncMessageReceiver to create an asynchronous 
service. Not that much fun:-( I really wish there was an example or 
default implementation in the Axis2 distro. But I guess it's a small 
price to pay for the power/flexibility of Axis2;-)


Hope this helps,
Tony

Brian Shields wrote:

Thats a bit disappointing, maybe i was a bit naive thinking it would 
be straight forward. I need to have a serious think how i will 
progress. I am not willing to stop using axis2, ive too much time 
invested now and everything set up the way i need it for my own 
research. Unfortunately i also have committments on a project that 
uses JBoss 4.0. How much of WS-Security is implemented in the most 
recent stable release of JBoss? How straightforward is it to 
implement security on existing (Web) SessionBeans? I particularly 
like the modular approach of axis2 which completely abstracts the 
security layer from the developer of the endpoint and vice versa.
Any other help, pointers etc (maybe a url to a walk thru of deploying 
axis2 on JBoss 4 ; ) ) greatly appreciated.

Regards,
Brian.

robert lazarski wrote:

I haven't mixed JBoss and Axis2 together yet - but I know both 
reasonably well independently. I've used JBoss and EJB with JWSDP alot.


Internally JBoss 4.0.x comes with Axis 1.x - though strangely their 
docs and examples favor JWSDP. Furthermore, It tends to be more 
natural to use a Statelful session bean with web services.


There are Handlers that are part of Java itself and can be used with 
Axis 1 and JWSDP - javax.xml.rpc.handler.Handler is one I've used a 
lot. However, axis2 does not currently support JAX-RPC. JBoss is 
pretty wired into JAX-RPC.


So to make Web Services function with JBoss and EJB you'll need to 
edit and create a lot of files, and using axis2 in jboss and ejb is 
a bit bleeding edge. Don't get me wrong - it'd be a cool project and 
yes I think it can be done. But if you don't know Jboss or axis2 
well, there are not going to be a lot of docs to help you. My 
personal experience on the jboss lists have not been good - they 
strongly encourage paid support.


Another option I would strongly consider is just use hibernate if 
you have a choice - instead of EJB. It'll be a lot simpler config. 
Sounds like your commited to EJB though.


If you still decide to use axis2 with jboss, look at the jboss guide 
chapter 12. Look at their files:


webservices.xml
ejb-jar.xml
jboss.xml

Know what config-*.xml does

HTH,
Robert
http://www.braziloutsource.com/

On 3/13/06, * Brian Shields*  [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] wrote:


Hi All,
I am

axis2 and mtom

2006-03-12 Thread Brian Shields

Hi all,
I am having some trouble sending attachments with axis2 messages. Until 
now I have been sending a large xml string as a parameter of a web 
service call. I recently applied security to this and I am getting a lot 
of errors when the string parameter goes beyond a certain size. What I 
am exploring as a work around is sending the xml file as an attachment 
using MTOM. From some v quick research i think this is the best approach 
when security is involved.
My problem is on the parsing of this message. I am getting a ContentID 
is null message. Is this because I have not specified the MIME type in 
the Client? My client code looks like...


OMElement value = fac.createOMElement(Text, omNs);
DataHandler dh = new DataHandler(new ByteArrayDataSource(s.getBytes()));
OMText text = fac.createText(dh, true);
value.addChild(text);
where s is a String.

The server code to parse this looks like...
OMElement binaryElement = element.getFirstElement();
OMText binaryNode = (OMText) binaryElement.getFirstOMChild();
DataHandler actualDH = (DataHandler)binaryNode.getDataHandler();

Anybody see any problems in this?
Regards,
Brian.

--
Brian Shields BSc. MSc.,
PhD Candidate,
Department of Information Technology,
National University of Ireland,
Galway,
Ireland.


Re: Can't find module.xml

2006-02-03 Thread Brian Shields
Have you shut down your app/web server before trying to delete it? If so 
then it is likely there is a java process running with a lock on it, 
that was the case with me!


Aaron Evans wrote:


Bryan Allen Bryan.Allen at sas.com writes:

 


Look in:  %UserProfile%.  This is where my .axis2 folder was located when I
   


had this problem.
 


If your username is gikxh06, that should resolve to something like
   


C:\Documents and Settings\gikxh06 on XP.
 


Bryan Allen
SAS Institute
   



Windows won't let me delete it! I get access denied no matter what!
Any suggestions?


 



--
Brian Shields BSc. MSc.,
PhD Candidate,
Department of Information Technology,
National University of Ireland,
Galway,
Ireland.


Re: wss4j and axis2

2006-02-02 Thread Brian Shields

Thanks for the reply Ruchith,
What do you mean by the axis2.xml file of the client? Is this the same 
axis2.xml file as that of the server if one is calling a service from 
localhost? I am using 2 deployments of axis2 on two different machines, 
one of which i have the two parameters below included in the axis2. This 
is my server. My client machine on the other hand has the same 
configurations all down to the axis2.xml file where i have only the 
OutflowSecurity parameter included.
When calling the service i get an error saying that the request does not 
contain the required Security headers!! I have used tcpmon and the 
message is being sent successfully, without the security header! Is it 
possible that the client is ignoring the axis2.xml configurations when 
calling the service? I presume the axis2.xml replaces the 
client_deploy.wsdd file!

Thanks,
Brian.

Ruchith Fernando wrote:


Hi Brian,

Please see my comments below:

On 2/2/06, Brian Shields [EMAIL PROTECTED] wrote:
 


Hello,
I am deploying security handlers in axis2. My question may be very
simple, apologies if the answer is staring me in the face!!
Where is the best place to include security tokens in the client? I have
altered the axis2.xml file to include a parameters in the inflow and
outflow..
parameter name=InflowSecurity
   action
   itemsTimestamp/items
   /action
   /parameter

   parameter name=OutflowSecurity
   action
   itemsTimestamp/items
   /action
   /parameter
From what i can make out, the outflowsecurity parmeter refers to any
security tokens which will be added in the outflow of a service request
and the inflowsecurity parameters are parameters which are expected for
the service to be invoked?!?
   



Correct !!!

The above configuration will ensure that a Timestamp is added to the
outgoing message and it will require all incoming messages to contain
a Timestamp header.

 


Where then are they applied to the client? Using the Options parameters?
   



With the Axis2-0.94 release we support setting the client parameters
in the axis2.xml of the client. And from the next release you will be
able to set the configuration via Options parameters (Using
org.apache.axis2.security.handler.config.InflowConfiguration and
org.apache.axis2.security.handler.config.OutflowConfiguration). This
feature is already available in the SVN HEAD.

Thanks,
Ruchith

 


Thanks,
Brian.

--
Brian Shields BSc. MSc.,
PhD Candidate,
Department of Information Technology,
National University of Ireland,
Galway,
Ireland.

   




 



--
Brian Shields BSc. MSc.,
PhD Candidate,
Department of Information Technology,
National University of Ireland,
Galway,
Ireland.


Re: wss4j and axis2

2006-02-02 Thread Brian Shields
Thanks Ruchith, That worked. I had the module installed correctly but 
the client was not aware of the axis2.xml file. creating a ServiceClient 
with custom repository worked.
I am aware that for service specific settings i will have to configure 
the services.xml file, that will be done in due course. For now I am 
going to get encryption and signatures working at a global!

Thanks again,
Brian.

Ruchith Fernando wrote:


If you are using the axis2.xml file to configure security module
parameters in the server side, please note that those configurations
will be applicable to ALL the services in that axis2 repository.
Therefore if you want to configure security on a per service basis you
MUST use the services.xml file to configure the parameters.

Thanks,
Ruchith

On 2/2/06, Ruchith Fernando [EMAIL PROTECTED] wrote:
 


Hi Brian,

If you get the request does not contain the required Security
headers then it seems like the security module is not deployed at the
client side OR the configured axis2.xml file is not picked up by the
client. You MUST provide this configured axis2.xml file along with a
repository containing the security.mar in the 'modules' directory. [1]

- Are you providing the repository location to the ServiceClient?

  - If NOT, please provide an axis2 repository with the 'modules'
directory as as sub directory and make sure you have security
configured [2] axis2.xml file in the repo directory (if you are using
the SVN HEAD axis2.xml file should be in the 'conf' directory in the
repo direcotry).

 - If YES, the please check whether you have the security.mar file in
the 'modules' directory of the repo.

Thanks,
Ruchith

Notes:
[1] Creating a ServiceClient with a custom repository:

ConfigurationContext ctx =
ConfigurationContextFactory.createConfigurationContextFromFileSystem(/path/to/axis2/repo,
path/to/configured/axis2.xml);
   ServiceClient serviceClient = new ServiceClient(ctx, null);


[2] Security configured mean that you must have the module
ref=security / entry in axis2.xml along with the required
inflow/outflow parameters. But if you don't have the module
ref=security / entry in the axis2.xml you can engage the security
module using the ServiceClient object as shown beow:

   serviceClient.engageModule(new QName(security));

[3] Make sure you include the commons-codec.jar in the client's and
server's classpath (in WEB-INF/lib directory in the case of Tomcat)

On 2/2/06, Brian Shields [EMAIL PROTECTED] wrote:
   


Thanks for the reply Ruchith,
What do you mean by the axis2.xml file of the client? Is this the same
axis2.xml file as that of the server if one is calling a service from
localhost? I am using 2 deployments of axis2 on two different machines,
one of which i have the two parameters below included in the axis2. This
is my server. My client machine on the other hand has the same
configurations all down to the axis2.xml file where i have only the
OutflowSecurity parameter included.
When calling the service i get an error saying that the request does not
contain the required Security headers!! I have used tcpmon and the
message is being sent successfully, without the security header! Is it
possible that the client is ignoring the axis2.xml configurations when
calling the service? I presume the axis2.xml replaces the
client_deploy.wsdd file!
Thanks,
Brian.

Ruchith Fernando wrote:

 


Hi Brian,

Please see my comments below:

On 2/2/06, Brian Shields [EMAIL PROTECTED] wrote:


   


Hello,
I am deploying security handlers in axis2. My question may be very
simple, apologies if the answer is staring me in the face!!
Where is the best place to include security tokens in the client? I have
altered the axis2.xml file to include a parameters in the inflow and
outflow..
parameter name=InflowSecurity
  action
  itemsTimestamp/items
  /action
  /parameter

  parameter name=OutflowSecurity
  action
  itemsTimestamp/items
  /action
  /parameter
From what i can make out, the outflowsecurity parmeter refers to any
security tokens which will be added in the outflow of a service request
and the inflowsecurity parameters are parameters which are expected for
the service to be invoked?!?


 


Correct !!!

The above configuration will ensure that a Timestamp is added to the
outgoing message and it will require all incoming messages to contain
a Timestamp header.



   


Where then are they applied to the client? Using the Options parameters?


 


With the Axis2-0.94 release we support setting the client parameters
in the axis2.xml of the client. And from the next release you will be
able to set the configuration via Options parameters (Using
org.apache.axis2.security.handler.config.InflowConfiguration and
org.apache.axis2.security.handler.config.OutflowConfiguration). This
feature is already available in the SVN HEAD.

Thanks,
Ruchith



   


Thanks,
Brian.

--
Brian Shields BSc. MSc.,
PhD Candidate,
Department

Handlers in Axis2

2006-01-31 Thread Brian Shields

Hello,
When using the same handler for inflow and outflow messages, does axis2 
create a seperate object of the handler for the different flow. It uses 
the same object for all inflows, but is there a second object for all 
outflow messages? It is confusing as the two instances of the handler 
(if there are two instances) have the same object hashCode, yet when 
using a java collection object within the handler, the outflow cannot 
see the same collection object as the inflow?? Any suggestions?


--
Brian Shields BSc. MSc.,
PhD Candidate,
Department of Information Technology,
National University of Ireland,
Galway,
Ireland.


Re: Handlers in Axis2

2006-01-31 Thread Brian Shields
Thanks Srinath, using the OperationContext I can persist object state 
between the request and the reply.

Regards,
Brian.

Srinath Perera wrote:


Hi Brian;

Handlers are stateless across multiple invocations. You should store
the states in the OperationContext (msgctx.getOperationContext()). Get
back if that do not solve your problem.

Thanks
Srinath

On 1/31/06, Brian Shields [EMAIL PROTECTED] wrote:
 


Hello,
When using the same handler for inflow and outflow messages, does axis2
create a seperate object of the handler for the different flow. It uses
the same object for all inflows, but is there a second object for all
outflow messages? It is confusing as the two instances of the handler
(if there are two instances) have the same object hashCode, yet when
using a java collection object within the handler, the outflow cannot
see the same collection object as the inflow?? Any suggestions?

--
Brian Shields BSc. MSc.,
PhD Candidate,
Department of Information Technology,
National University of Ireland,
Galway,
Ireland.

   




--

Srinath Perera:
  http://www.cs.indiana.edu/~hperera/
  http://www.bloglines.com/blog/hemapani


 



--
Brian Shields BSc. MSc.,
PhD Candidate,
Department of Information Technology,
National University of Ireland,
Galway,
Ireland.


trouble redeploying handlers

2006-01-31 Thread Brian Shields

Hello,
I am having some trouble redeploying a handler .mar file in axis2. The 
engine seems to have an old reference to the classes inside my module 
and any changes i make are not being reflected when i repackage the 
module and redeploy it. I am restarting the web server and it is still 
referencing the older version of the classes!! Any ideas?


--
Brian Shields BSc. MSc.,
PhD Candidate,
Department of Information Technology,
National University of Ireland,
Galway,
Ireland.