File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Axis client with documents Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Axis client with documents" Watch "Axis client with documents" New topic
Author

Axis client with documents

Avin Nar
Greenhorn

Joined: Apr 21, 2005
Posts: 4
Ok here is what I need to do:

I need to write an Axis client for "http://www.wsdirect.net/axis/services/spellcheckerdoc?wsdl"

I want to do the dynamic invocation and not create stubs out of the wsdl.
I have no clue of how to go about doing this. Can anyone help me out ?

The WSDL for the file is given in the above URL.

Can someone modify the sample code I have below to accomodate this ?



=================

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import org.apache.axis.enum.Style;
import org.apache.axis.enum.Use;
import org.apache.axis.message.SOAPBodyElement;
import org.apache.axis.message.SOAPEnvelope;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.apache.axis.utils.XMLUtils;
import java.util.Vector;

public class DocClient
{

public static void main(String[] args)
{
try
{
/*
* NOTE: The web service uses document style
* eg:
*<service name="MyDocSample" provider="java:RPC" style="document" use="literal">
*/
String url = "http://localhost:8080/ws/services/MyDocSample";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(url);
String param= "hello";

/*
*construct the XML document
*/
SOAPBodyElement[] input = new SOAPBodyElement[1];

input[0] = new SOAPBodyElement(XMLUtils.StringToElement("http://www.w3.org/2001/XMLSchema",
"echo", param));
Vector elems = (Vector) call.invoke( input );

SOAPBodyElement elem = (SOAPBodyElement) elems.get(0);
Element e = elem.getAsDOM();
System.out.println("returned value: " + XMLUtils.ElementToString(e)); }
catch (Throwable t)
{
t.printStackTrace();
}
}
}
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 986

Here is an article which talks about this.
Let us know what you learn.


Please ignore post, I have no idea what I am talking about.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Axis client with documents