[axis2] Shutdown mechanism?

2005-12-07 Thread Antony Grinyer
Hi,
 
Is there a shutdown mechanism as part of axis2 that can be used to close 
resources if, for example, the servlet container such as Tomcat, containing oru 
axis2 webapp is shutdown unexpectedly? We'd like to use something like the 
ServletContextListener to listen if a shutdown occurs so we can close critical 
resources.
 
Any help/advice gratefully received.
 
Thanks,
Ant
CSW Group Ltd.
 
<>

RE: Axis2 API OMElement limitation?

2005-11-08 Thread Antony Grinyer
Found the OMNavigator object that seems to do the trick!


> -Original Message-
> From: Antony Grinyer [mailto:[EMAIL PROTECTED] 
> Sent: 08 November 2005 08:44 pm
> To: axis-user@ws.apache.org
> Subject: Axis2 API OMElement limitation?
> 
> Hi,
> 
> Apologies if this is a basic question, but I can't seem to 
> find a method on the OMElement to find a child element deep 
> in an XML document? The OMElement object methods 
> "getChildrenWithName()" and "getFirstChildWithName()" seems 
> to only go one leaf deep. Say in the following instance I 
> want to get the  element :
> 
> 
>
>
>
>   
>
>
>   
>  
>   
>
> 
> 
> Is there no method to get element  from a direct API call 
> on the OMElement object? or do I have to implement a 
> recursive tree walker myself?
> 
> Thanks in advance,
> Ant
> 
> 
> 
> 
> 




Axis2 API OMElement limitation?

2005-11-08 Thread Antony Grinyer
Hi,

Apologies if this is a basic question, but I can't seem to find a method
on the OMElement to find a child element deep in an XML document? The
OMElement object methods "getChildrenWithName()" and
"getFirstChildWithName()" seems to only go one leaf deep. Say in the
following instance I want to get the  element :


   
   
   
  
   
   
  
 
  
   


Is there no method to get element  from a direct API call on the
OMElement object? or do I have to implement a recursive tree walker
myself?

Thanks in advance,
Ant




Newbie - getting the session?

2005-10-17 Thread Antony Grinyer
Apologies is this is simple question, however how to you get the session
object in axis2? I have a simple class which exposes all my services, I
am able to get the axis configuration with:

private AxisConfiguration m_ac = null;

public void init(MessageContext mc)
{
  m_ac = mc.getSystemContext().getAxisConfiguration();
} 

...however I am unsure where I get the session object from? Again, I
apologize if this is simple, I am new to axis/axis2.

Thanks,
Ant




Newbie: Recreating Zip file in MTOM service class?

2005-10-12 Thread Antony Grinyer
Hi,

Being an axis2 newbie, I've managed to create an MTOM client and
service, passing a Zip file to the service, however I'm unsure what to
do at the service end to recreate the zip? The example on the axis2
website just shows what to do with an image. Here's snippets of my code:

CLIENT:

<< snip >>

OMElement zip = fac.createOMElement("zip", omNs);
 
File file = new File(filePath);

byte[] bytes = new byte[(int)file.length()];
bytes = BDBXMLUtils.getBytesFromFile(file);
ByteArrayDataSource dataSource = new ByteArrayDataSource(bytes);
dataHandler = new DataHandler(dataSource);
OMText textData = fac.createText(dataHandler, true);
zip.addChild(textData);

<< snip >>

The do all the client calls to the addDocumentsAsZip web service method.

SERVICE:

public OMElement addDocumentsAsZip(OMElement element)
throws XMLStreamException
  {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs =
fac.createOMNamespace("http://some.namespace/anything";, "anything");

OMElement zipEle = element.getFirstElement();
OMElement zipName = (OMElement) zipEle.getNextSibling();
OMText binaryNode = (OMText) zipEle.getFirstChild();
String fileName = zipName.getText();

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

// Now, how do I get the data back into a zip?

<< snip >>

I know there's the Java util.zip package but how do I recreate my zip
from the DataHandler?

Any help gratefully appreciated.
Thanks,
Antony




Newbie - file upload with axis2?

2005-10-11 Thread Antony Grinyer
Hi all,

This is my first mail to the list as I am new to axis2 development. I am
using axis2 and resin 2.1.0, and I have developed a basic web service
which allows me to retrieve information from the database using basic
http parameters as arguments to web service calls e.g.

http://localhost:8080/axis2/services/myservice/getPerson?db=myDb&personI
D=10


I would now like to write a method to upload a zip file from a client to
the server using a web service call convention like:

http://localhost:8080/axis2/services/myservice/uploadZip?path=c:\data\xm
l.zip

Which takes the file from the client machine and dumps it on the server.
This file will then be unzipped at the server end and processed to
upload XML to a database.

I am using AXIOM for my web service methods to process all the web
service calls e.g.

public OMElement uploadZip(OMElement element)
  throws XMLStreamException
{
  QName qn = new QName("path");
  OMElement e = element.getFirstChildWithName(qn);
  String pathToZip = e.getText();

   // missing implementation - what goes here?
}

...however I am completely mystified how I can implement this service to
actually get the file from the client and put it on the server? i.e. how
can my uploadZip method get the file from the client for the server to
process?

I can't find any examples anywhere on how to do this, therefore any
help/advice would be gratefully received!

Many thanks in advance,
Antony