Yes it is very possible.
There are 2 ways I can think of right away. Servlet one, and easy one.
(There maybe 10 other ways to do it though)
The easy way uses the shiny auto deployment, but has a little overhead with
creation of junk message.

1) Servlet way (Hello echo service)
Write a servlet that bypasses the Call stuff. Once you get your request, use
Axis to serialize RPC parameters into types.
Ex:

    //Process the HTTP Post request
    public void doPost(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {

                String contentType=request.getContentType();
                if(contentType==null){
                        contentType="text/xml";
                }
                String
contentLocation=request.getHeader("Content-Location");

                AxisClient ac=new AxisClient ();
                MessageContext mc=new MessageContext(ac.getClientEngine());
//********************
                TypeMappingRegistry reg=mc.getTypeMappingRegistry();
                //register your types here
                mc.setTypeMappingRegistry(reg);
//********************

                Message reqMsg=new
Message(request.getInputStream(),false,contentType,contentLocation);
                mc.setRequestMessage(reqMsg);
                SOAPEnvelope reqEnv=reqMsg.getSOAPEnvelope();

//start non axis code
                SOAPHeader deliveryHdr=
reqEnv.getHeaderByName(GCSerializerConstants.TYPE_DELIVERY.getNamespaceURI()
,
        
GCSerializerConstants.TYPE_DELIVERY.getLocalPart());
                CLDelivery delivery=(CLDelivery) deliveryHdr.getValue();
                //Enjoy your object here
//end non axis code

                ArrayList
children=reqEnv.getBodyByName("http://myorg.com/hello","helloService";).getCh
ildren();

                SOAPEnvelope env=new SOAPEnvelope();
                TypeMapping
tm=(TypeMapping)mc.getTypeMappingRegistry().getTypeMapping(Constants.URI_SOA
P_ENC);
                QName stringType=tm.getTypeQName(String.class);
                SOAPBodyElement body=new SOAPBodyElement();
                body.setName("helloServiceResponse");
                body.setNamespaceURI("http://myorg.com/hello";);
                for(Iterator it=children.iterator();it.hasNext();){
                        MessageElement nameNode=(MessageElement) it.next();
                        String name=null;
                        try{
                                name=(String)nameNode.getValue();
                        }catch(Exception e){
                                e.printStackTrace();
                        }
                        MessageElement helloTo=new MessageElement();
                        helloTo.setValue("Hello "+name);
                        helloTo.setType(stringType);
                        helloTo.setName("helloTo");
                        body.addChild(helloTo);
                }
                env.addBodyElement(body);

//start non axis code
                CLPost post=new CLPost();
                post.setToken(delivery.getToken());
                SOAPHeader postHdr=new SOAPHeader(null,null,post); //excuse
the nulls, my deserializer handles them
                env.addHeader(postHdr);
//end non axis code
                Message respMsg=new Message(env);
                mc.setResponseMessage(respMsg);

//console polution
                respMsg.writeContentToStream(System.out);
//end console polution

                response.setContentType(respMsg.getContentType());
                response.setContentLength(respMsg.getContentLength());
                OutputStream out = response.getOutputStream();
                respMsg.writeContentToStream(out);
                out.flush();
                out.close();
    }


****************************************************************************
************
2) Easy way
Do your normal RPC, as a return type return anything like... null.
Add a Handler to your service that on the response replacesResponseMessage
with correct one.
Ex handler:
    public void invoke(MessageContext context) throws AxisFault
    {    
        if (context.getPastPivot()) {
            // This is a response.
            
            Message msg = context.getResponseMessage();
                ...
                ...

                Message goodMsg=new Message(...);
                context.setResponseMessage(goodMsg);
        } else {
            // Request.
        }
    }

> -----Original Message-----
> From: Steven Gollery [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 25, 2002 11:43 AM
> To: [EMAIL PROTECTED]
> Subject: RPC in, Document out?
> 
> 
> I see how to set up services so that they receive and send 
> XML documents
> instead of using the RPC style of SOAP. But I have some existing code
> that takes several arguments and uses them to determine an appropriate
> XML file, which the method then returns as an XML Document object. I
> could wrap this code in a method that takes an XML document as input,
> then extracts and converts the arguments and passes them to 
> the existing
> method, but I don't want to do that if I can get Axis to convert the
> arguments for me, as it does when I deploy a service that uses RPC for
> the arguments and the return value.
> 
> So I'm wondering:  Is it possible to deploy a service that 
> uses RPC for
> the input arguments and returns an XML document? And if so, how?
> 
> Steven Gollery
> [EMAIL PROTECTED]
> 
> 
> 
> 

Reply via email to