This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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: 984

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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Axis client with documents
 
Similar Threads
STUB, Dynamic Proxy, DII
web service with attachment under java 1.6
Desperate newbie - problem with image attachment
how to invoke web service implemented in MS.NET
Sending requests in xml