Need help creating client for DOM/Message Based Webservice


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Need help creating client for DOM/Message Based Webservice

  1. #1
    Join Date
    Jul 2005
    Posts
    3

    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/"
    xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"
    xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance">
    <service name="DocService" style="java:MSG">
    <parameter name="className" value="testing.webservices.DocTest" />
    <parameter name="allowedMethods" value="doSubmission" />
    </service>
    </deployment>

    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.

    J-Rod

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

    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.

    J-Rod

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
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

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