File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Axis client with documents

 
Avin Nar
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 986
Eclipse IDE Firefox Browser Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is an article which talks about this.
Let us know what you learn.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic