Reputation: 1264
I worked in a couple of web service projects with Java.
Some third parties provide us with their WSDL from which I can generate Java classes using Axis2.
Other third parties do not provide us with a WSDL, instated they provide use with request and response samples and I have to build the SOAP XML messages using StringBuilder
or StringBuffer
.
Unfortunately, I don't think this is the most efficient or preferred way to build the messages.
Is there any better way to achieve that? A way where I do not have to build the SOAP messages using StringBuilder
?
Upvotes: 0
Views: 281
Reputation: 24590
If you have a WSDL you can feed it to a tool to generate the client plumbing code (in you case Axis2) so ideally you should obtain one.
First of all you should ask the provider for the WSDL. It's a good practice and their responsibility to provide a WSDL and they should build one if their service doesn't yet have it.
If still they won't give you a WSDL you can build one yourself, it ain't that difficult if you know what you are doing.
And if you still can't obtain a WSDL then use a low level API like SAAJ to build the messages. It beats working with StringBuilder
or StringBuffer
.
Upvotes: 1