hi,

this looks very much like what i had to put together. one thing, in your
wsdd file, make sure you add a style to the service tag:

<service name="MyService" provider="java:MSG" style="document">

that way, when axis renders the wsdl, you don't get an RPC description. 

the other thing we encountered was dealing with the AxisFault so we could
pass the exception back to the client properly - as an xml document. you can
either put it into an AxisFault and return the details or create your own
xml return document.

jill

> -----Original Message-----
> From: Murray Spork [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, June 02, 2002 10:59 PM
> To: [EMAIL PROTECTED]
> Subject: Help for those trying to do document style
> 
> 
> 
> Hi all,
> 
> I've put together some skeleton code for how to implement, 
> publish and 
> call a document-style SOAP service in Axis beta 2 (thanks for 
> the help 
> Ramon Turnes). Maybe some of the experts here could check 
> this for me - 
> hopefully other newbies trying to do document-style SOAP will 
> find it of 
> some use (I certainly could have used something like it).
> 
> I'd be happy to document this properly if someone will give me some 
> help. I'm still not sure about a few things. For example - is it 
> possible to have a signature for the method that implements 
> the service 
> that looks more like:
> 
>     public Document methodA(Document xml)
> 
> rather then the way I've done it:
> 
>     public Element[] methodA(Vector xml)
> 
> I couldn't get the first one to work at all.
> 
> I've also got a reponse handler working that takes the body of the 
> response message - does an XSL transform on it and sticks some extra 
> information into the message before sending it on to the next handler.
> 
> 
> **How to do document style soap calls in Axis beta 2**
> 
> **Service Interface**
> 
>     public interface IMyService
>     {
>         public Element[] query(Vector xml)
>             throws InvalidTradingIntentionFormatException?;
>     }
> 
> **Service Implementation**
> 
> public MyServiceImpl implements IMyService
> {
>     public Element[] methodA(Vector xml)
>     {
>         Document requestMessage = 
> ((Element)xml.get(0)).getOwnerDocument();
>         Document responseMessage = ... /* get response message */
> 
>         Element[] result = new Element[1];
>             result[0] = responseMessage.getDocumentElement();
>         return result;
>     }
> }
> 
> **Deployment Descriptor**
> 
> We deploy the service with the following deployment descriptor:
> 
>     <deployment xmlns="xml.apache.org/axis/wsdd/"
>             xmlns:java="xml.apache.org/axis/wsdd/providers/java"
>             xmlns:xsi="www.w3.org/2000/10/XMLSchema-instance">
>         <service name="MyService" provider="java:MSG">
>             <parameter name="className" 
> value="com.mypackage.MyServiceImpl"/>
>             <parameter name="allowedMethods" value="methodA"/>
>         </service>
>     </deployment>
> 
> **Client side code**
> 
>     public void invokeRemoteMethod(Document messageDoc)
>         throws Exception
>     {
>         // Initialize our Service -
>         Service service = new Service();
>         Call     call    = (Call) service.createCall();
>         call.setTargetEndpointAddress( new 
> java.net.URL("http://myservername:8080/axis/services/MyService";) );
>         Vector result = null;
>         Object[]  params = new Object[] { new 
> SOAPBodyElement(messageDoc.getDocumentElement())};
>         result = (Vector) call.invoke( params );
>         SOAPBodyElement body = (SOAPBodyElement) result.elementAt(0);
> 
>         Document resultDoc = body.getAsDocument();
> 
>         /* do stuff with resultDoc */
> 
>     }
> 
> **The Soap Message**
> 
> Here's what the SOAP message looks like:
> 
>     POST /axis/services/MyService HTTP/1.0
>     content-Length: 2418
>     Host: myservername
>     Content-Type: text/xml; charset=utf-8
>     SOAPAction: ""
> 
>     <?xml version="1.0" encoding="UTF-8"?>
>     <SOAP-ENV:Envelope
>         xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
>         xmlns:xsd="http://www.w3.org/2001/XMLSchema";
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
>         <SOAP-ENV:Body>
>                              <!-- my xml document here -->
>         </SOAP-ENV:Body>
>     </SOAP-ENV:Envelope>
> 
> --
> Murray Spork
> Centre for Information Technology Innovation (CITI)
> The Redcone Project
> Queensland University of Technology, Brisbane, Australia
> Phone: +61-7-3864-9488
> Email: [EMAIL PROTECTED]
> Web: http://redcone.gbst.com/
> 
> 
> 

Reply via email to