DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Hybrid View

  1. #1
    Join Date
    Jul 2005

    Need help creating client for DOM/Message Based Webservice

    Hello all,

    I am using Apache Axis and am trying to set up a document style (message based) webservice that will receive a DOM object, modify that DOM object, and return it as a new DOM object.

    I have set up my webservice (a very simple one to get this going):
    package testing.webservices;

    import org.w3c.dom.Document;
    import org.apache.axis.MessageContext;

    public class DocTest{
    public Document doSubmission(MessageContext msgContext, Document inDoc)throws Exception{
    return inDoc;

    I set this class up in Axis with my deploy.wsdd file:
    <deployment name="test" xmlns="http://xml.apache.org/axis/wsdd/"
    <service name="DocService" style="java:MSG">
    <parameter name="className" value="testing.webservices.DocTest" />
    <parameter name="allowedMethods" value="doSubmission" />

    When I look at Axis it lists this DocService as an active service. Can anyone tell me what the client code would look like to send a Document object to my simple webservice and receive a document object back? Any help would be greatly appreciated.


    NOTE: This is what I have so far:

    import .....

    public class DocTestClient{
    public static void main(String[] args) throws Exception {
    String fileName = "C:\\Dev\\MyXmlFile.xml";
    String uri = "file:" + new File(fileName).getAbsolutePath( );
    DocumentBuilderFactory factory =DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document doc = builder.parse(uri);

    String endpointURL = "http://localhost:8080/axis/services/DocService";
    Service service = new Service();

    Call call = (Call) service.createCall();
    call.setTargetEndpointAddress(new java.net.URL(endpointURL) );
    call.setOperationName(new QName("http://testing.webservices", "doSubmission") );
    ?????? WHAT DO I DO HERE to access the send the doc object and receive it back?????

  2. #2
    Join Date
    Jul 2005

    Found a work around

    Hello all,

    I needed to move on so I figured a work around to my issue. I ended up using RPC with strings of XML, which I then convert to a DOM object when I receive it. Works just as well.

    Thanks anyways.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.