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 example: need help. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "AXIS client example: need help." Watch "AXIS client example: need help." New topic
Author

AXIS client example: need help.

Dmitry Zhuravlev
Ranch Hand

Joined: Apr 14, 2010
Posts: 91
Hello Everyone!

Guys, I just started to study web-services and making my first app. It is taken from the AXIS site: Getting Started Example. Here is the code:



This results in
08.11.2010 11:39:26 org.apache.axis.utils.JavaUtils isAttachmentSupported
WARNING: Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
error java.net.ConnectException: Connection refused: connect


So, as far as I understand I have 2 problems:
- something is missing
- apache testing server is not working

Can you help me with this? Can you advice some open web-service in www using which I can test my client?
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
Stop! Before you go any further you should update to a newer version of Axis, namely Axis2. Instead of http://ws.apache.org/axis/, go to http://ws.apache.org/axis2/ to get all the software and tutorials. Axis 1 has long been obsolete and should not be used for anything at this point.

As for the two problems, the first is just a warning and results in what it mentions: no support for attachments. Attachments are used far less than SOAP services in general, so that is most likely not a problem, especially if you're just starting out.

The second means that the server you're trying to access (http://ws.apache.org:5049/) does not exist. The folks at Apache do not run test servers for the general public, and you should replace the URL with the respective address of your test server - which means you have to install Axis and your test service before you can use that client code.
Dmitry Zhuravlev
Ranch Hand

Joined: Apr 14, 2010
Posts: 91
OK,
Lester may be you can advice some working web-service in internet using which I can test my client?

And also, can you explain me if I need WSDL2Java utility? How can it help me building my client?
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
I'm not aware of a public testbed for SOAP services, although they probably exist. I would advise to run your own Axis2 instance in Tomcat or some other servlet container; it's easy to get up and running, and you should definitely learn about both sides.

The Axis2 web site has very extensive documentation covering wsdl2java and all its other features; start reading there, particularly the "User Guide".
Dmitry Zhuravlev
Ranch Hand

Joined: Apr 14, 2010
Posts: 91
Lester, I have been advised to use axis 1.4 because the web-service I need to reach uses "old rpc/enc - encoded style". Dont know what is it.

Anyway,
now I have made some steps in working soap client direction and have the following two erros, can anyone explain me whats up?

(1) at home I get
org.xml.sax.SAXException: No deserializer defined for array type {http://namespaces.soaplite.com/perl}ShortCampaignInfo
at org.apache.axis.encoding.ser.ArrayDeserializer.onStartElement(ArrayDeserializer.java:276)
at org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:393)
at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1048)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:345)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
at org.apache.axis.client.Call.invoke(Call.java:2467)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at solutiondatabase.SOAPExample.runExample(SOAPExample.java:37)
at solutiondatabase.Main.main(Main.java:Cool
org.xml.sax.SAXException: No deserializer defined for array type {http://namespaces.soaplite.com/perl}ShortCampaignInfo


(2) at office, where I have proxy and firewall, I have:

(405)Not Allowed
at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:744)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at solutiondatabase.SOAPExample.runExample(SOAPExample.java:46)
at solutiondatabase.Main.main(Main.java:10)


I gave already added proxy settings to my code:
Properties props= new Properties(System.getProperties());
props.put("http.proxySet", "true");
props.put("http.proxyHost", "XXX");
props.put("http.proxyPort", "8080");

Properties newprops = new Properties(props);
System.setProperties(newprops);



Can you explain me the meaning of the errors?
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
You need a custom serializer in order to send arbitrary Java objects over the wire. If your object follows JavaBean semantics, you may be able to get away with configuring a Bean Serializer. Start here: http://ws.apache.org/axis/java/user-guide.html#XMLJavaDataMappingInAxis.
 
 
subject: AXIS client example: need help.
 
Similar Threads
Axis samples
NoClassDefFoundError
java.net.ConnectException: Connection timed out: connect
javax.rpc.call problem
STUB, Dynamic Proxy, DII