Question

I need to create connection to web service with axis2. I would like to know how can I convert recieved xmls to Java objects. Is there any good tutorials to learn how to do this?

Was it helpful?

Solution

Axis2 is pretty well documented. Make sure to check the axis2 user guide. On the other hand be aware of that using web services and axis2 is not a piece of cake sort of think, so read the docs exhausitvly. ;)

OTHER TIPS

Either the XML is part of the SOAP request. In that case, Axis2 will convert it to Java for you.

If XML is part of a "data blob", then you need to do this yourself. There are several options:

  1. You can have a look at the generators which Axis2 uses. Try the docs.

  2. Use an XML OO mapper like Castor.

  3. You can write your own mapper (not really recommended).

  4. If you can influence the sender side, you can try to create XML that follows the rules for XMLEncoder. That would allow you to use the standard Java Serialization API to build objects.

use axis wsdl2java tool and put generated classes to your source files. Then first create a service stub with YourServiceStub(Service_Adress) and use that instance to invoke necessary methods.

for wsdl2java i commonly use:

wsdl2java -uri wsdlLocation -ss -sd -uw -g -o outputLocation

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top