This how we implemented message style service :

Service code : 
import org.w3c.dom.*;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
public Element[] validate(Element [] input) throws ValidationException {
        if(input == null || input.length == 0) {
            throw new ValidationException("No message found");
        }
        try {
            // process input .... 

            Element[] output = new Element[1];
            DocumentBuilder builder =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
            Document doc            = builder.newDocument();

            // build response xml document... 
            output[0] = doc.getDocumentElement();
            return output;
        } catch (ValidationException ave) {             
            throw ave;
        } catch (Exception e) {         
            throw new ValidationException("Error occured during
Validation",e);
        } catch (Throwable t) {
                return null;       
        }
    }    

Client code : 
public Address validate(Address address) throws ValidationException {
        try {
            Service service = new Service();
            Call call = (Call)service.createCall(new QName("",""));


            call.setTargetEndpointAddress( new
URL((String)_hmProperties.get(this.ENDPOINT_ADDRESS_PROPERTY)) );

            SOAPBodyElement[] input = new SOAPBodyElement[1];

            DocumentBuilder builder =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
            Document doc            = builder.newDocument();
                           // build request xml ....
            input[0] = new SOAPBodyElement(doc.getDocumentElement());
            
            Vector output = (Vector)call.invoke(input);

            if(output == null || output.isEmpty()) {
                throw new ValidationException("No response message found");
            }
            //get info from output and process to create return address
object 
            //((SOAPBodyElement)output.get(0)).getAsDOM();
            return address;
        } catch (ValidationException pe) {
            throw pe;
        } catch (Exception e) {
            throw new ValidationException("Error occured while validating
address",e);
        }

    }

deploy.wsdd code : 
<deployment name="test" xmlns="http://xml.apache.org/axis/wsdd/";
            xmlns:java="http://xml.apache.org/axis/wsdd/providers/java";
            xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance";>  
  <service name="AddressValidationService" style="message">
    <parameter name="className" value="com.abc.xyz.AddressValidationService"
/>
    <parameter name="allowedMethods" value="*" />
  </service>
</deployment>

Hope that helps :
Ashish.



> -----Original Message-----
> From: Volkmann, Mark [SMTP:[EMAIL PROTECTED]
> Sent: Tuesday, July 01, 2003 8:00 AM
> To:   '[EMAIL PROTECTED]'
> Subject:      RE: Creating message-style services
> 
> I think the reason you've only seen examples of using the signature 
> 
> public Element [] method(Element[] bodies) 
> 
> is that the other three supposedly supported signatures don't work. 
> I've tried to use them without success. 
> I too would like to see working examples of using the other signatures. 
> 
> > -----Original Message----- 
> > From: Sachin [ <mailto:[EMAIL PROTECTED]>] 
> > Sent: Tuesday, July 01, 2003 1:56 AM 
> > To: Axis userList (E-mail) 
> > Subject: Creating message-style services 
> > 
> > 
> > Hi All, 
> >         well i have posted two problem related to XML 
> > Document handling via 
> > web Services but got no response. 
> > 
> > but After some study on net and help of some users.I am able 
> > to find that 
> > for this i have to create message-style service Axis has 
> > given four methods 
> > for it 
> > public Element [] method(Element [] bodies) 
> > public SOAPBodyElement [] method (SOAPBodyElement [] bodies) 
> > public Document method(Document body) 
> > public void method(SOAPEnvelope req, SOAPEnvelope resp) 
> > 
> > but only example of public Element [] method(Element [] 
> > bodies) is given so 
> > if i have to look for more example 
> > then where should i go 
> > 
> > Axis Site has very little mentioning About it so more 
> > documentation need to 
> > be provided on these topics or 
> > Anyone can suggest me about it. 
> > 
> > Thanks 
> > 
> > 
> > 
> > 
> 
> 
> 
> **************************************************************************
> *********
> WARNING: All e-mail sent to and from this address will be received or
> otherwise recorded by the A.G. Edwards corporate e-mail system and is
> subject to archival, monitoring or review by, and/or disclosure to,
> someone other than the recipient.
> **************************************************************************
> **********
> 

Reply via email to