Hi,
I am trying to communicate Axis client and Tomcat server.
When I use Axis client, it doesn't work.
What is wrong?
Thanks.
---------------- Axis client code ----------------
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.axis.encoding.SerializationContext;
import org.apache.axis.client.Service;
import org.apache.axis.client.Call;
import org.apache.axis.message.SOAPBodyElement;
import org.apache.axis.utils.Options;
import org.apache.axis.utils.XMLUtils;
import org.w3c.dom.Element;
import org.w3c.dom.Document;
import java.net.URL;
import java.util.Vector ;
import java.io.FileInputStream;
public class Buyer {
public String doit(String[] args) throws Exception {
Options opts = new Options(args);
opts.setDefaultURL("http://localhost:8081/soap/servlet/messagerouter");
// opts.setDefaultURL("http://localhost:8080/axis/services/MyService");
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new URL(opts.getURL()) );
SOAPBodyElement[] input = new SOAPBodyElement[1];
input[0] = new SOAPBodyElement(new FileInputStream("data.xml"));
Vector elems = (Vector) call.invoke( input );
SOAPBodyElement elem = null ;
Element e = null ;
elem = (SOAPBodyElement) elems.get(0);
e = elem.getAsDOM();
String str = "Res elem[0]=" + XMLUtils.ElementToString(e);
return( str );
}
public static void main(String[] args) throws Exception {
String res = (new Buyer()).doit(args);
System.out.println(res);
}
}
---------------- Axis client code ----------------
---------------- data.xml ----------------
<receiveFurikomi xmlns="urn:ssrssamplemediator">
<dummy>dummy value</dummy>
</receiveFurikomi>
---------------- data.xml ----------------
---------------- client output message ----------------
[DEBUG] org.apache.axis.SOAPPart (252) - Setting current message form to:
FORM_SOAPENVELOPE (currentMessage is now <SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring>Exception from service object: null</faultstring>
<faultactor>/soap/servlet/messagerouter</faultactor>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>)
[DEBUG] org.apache.axis.SOAPPart (438) - Exit: SOAPPart::getAsSOAPEnvelope
Exception in thread "main" Exception from service object: null
at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:135)
at
org.apache.axis.encoding.DeserializationContextImpl.endElement(DeserializationContextImpl.java:853)
at org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1403)
at
org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:1480)
at
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1149)
at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1081)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:374)
at
org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:201)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:429)
at org.apache.axis.client.Call.invoke(Call.java:1729)
at org.apache.axis.client.Call.invoke(Call.java:1038)
at Buyer.doit(Buyer.java:32)
at Buyer.main(Buyer.java:45)
---------------- client output message ----------------
--
IKEDA Katsumi <[EMAIL PROTECTED]>