简体   繁体   中英

Building XML messages for SOAP web services that don't have a WSDL

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 ?

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM