What you suggest is not a natural use of SOAP and I doubt that Axis supports
it. The whole point of SOAP is that everything that sent to the server travels
in the SOAP enevlope or as an attachement to it. You shouldn't expect a
SOAP-client engine automatically to turn bits of URL into bits of SOAP bdy or
into attachments.

You could solve this in several ways.

1. Write a document/literal service that loads the contents of the request
body into the XML DB. I.e., your client reads the file on the client machine
and puts its (XML) contents directly inside the SOAP body request message. You
can only put XML in here, not zipped files.

2. Write a service and client that send the zipped file as an attachement to
the SOAP message. In this case, the SOAP body of the request message might be
empty, as the service need only have the one operation "upload XML document"
and that operation wouldn't need parameters to the SOAP part since its
sementics would be fixed: "find first attachement, unpack and load into DB".

3. Write a non-SOAP HTTP servlet that goes into your web-app alongside the
axis servlet and accepts file upload using HTTP Put. In this case, the path to
your upload-servlet can't be

http://localhost:8080/axis2/services/myservice/uploadZip?path=...

as that clashes with the Axis servlet, but you could have something like

http://localhost:8080/axis2/uploadZip?path=...

On Tue, 11 Oct 2005, Antony Grinyer wrote:

> 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
>
>
>
>

Guy Rixon                                       [EMAIL PROTECTED]
Institute of Astronomy                          Tel: +44-1223-337542
Madingley Road, Cambridge, UK, CB3 0HA          Fax: +44-1223-337523

Reply via email to