Im new to web services, so hopefully can get some help here. Say i need to write some api to correspond to the web service http://api.clickatell.com/soap/webservice.php?WSDL in order to invoke the method of the web service and pass in parameter, how should i start with that, any good examples which i can follow?
The NetBeans site has a lot of tutorials, for instance this one about getting started developing JAX-WS web services:
http://www.netbeans.org/kb/docs/websvc/jax-ws.html The web service you want to develop a client to uses RPC/Encoded encoding and I am not sure about the support for SOAP encoding in JAX-WS, since I have never tried it. If you check the JAX-WS 2.1 specification, under the section Non-Goals, you see the following:
SOAP Encoding Support Use of the SOAP encoding is essentially deprecated in the web services com-
munity, e.g., the WS-I Basic Profile excludes SOAP encoding. Instead, literal usage is preferred,
either in the RPC or document style.
SOAP 1.1 encoding is supported in JAX-RPC 1.0 and 1.1 but its support in JAX-WS 2.0 runs counter
to the goal of delegation of data binding to JAXB. Therefore JAX-WS 2.0 will make support for SOAP
1.1 encoding optional and defer description of it to JAX-RPC 1.1.
Support for the SOAP 1.2 Encoding is optional in SOAP 1.2 and JAX-WS 2.0 will not add support
for SOAP 1.2 encoding.
If you check the JAX-RPC 1.1 specification, section 14.3.2 you see:
The JAX-RPC specification requires support for the following representation for remote call and response in a SOAPmessage:
• Encoded representation using the SOAP 1.1 encoding:
The rules and format of serialization for the XML data types are based on the SOAP1.1 encoding.
A JAX-RPC run time system implementation is required to support the SOAP1.1 encoding. Interoperability requirements for any other encodings are outside the scope of the JAX-RPC specification.
Thus: You may have to revert to JAX-RPC if there are problems consuming your web service using JAX-WS.
Joined: Feb 03, 2009
Hi thanks for the reply, ill take a look at the links provided. While i was in the process of researching, i came across , apache axis, axis2 and apache soap. Can i use them to write the client soap?
i came across , apache axis, axis2 and apache soap. Can i use them to write the client soap?
Apache SOAP is obsolete - under no circumstances should you use it for anything.
For JAX-WS services you can Axis-2. If you have to use JAX-RPC (see Ivan's post) you can use Axis 1 (Axis 2 doesn't support JAX-RPC).
Joined: Feb 03, 2009
First off, i would like to thank you both on the replies. Here i have another doubt.
I can see there're some examples on the net on how to use axis to write client to invoke web service, one of them is http://126.96.36.199/docs/easws/easws103.htm Well, i have a question here since i have not started trying out the examples, yet, that whether it is possible to to use axis to list out the available web methods to invoke? and we need to know the return value type as well, so that we can do something like this int value= ((Integer)call.invoke(inParams)).intValue(); it means we need to know /understand the web service before proceed with writing the client? Would that be possible that i write a generic web service client that could cater for different web services?
Please advice and thanks in advance.
Joined: Oct 04, 2006
Generally speaking, you do not need to fully understand the WSDL of a web service in order to develop a client for the service.
This is what tools like wsimport do; they parse the WSDL and create artifacts (like JAXB beans, service endpoint interface etc).
Having created these artifacts, you can, in a very simple manner, invoke operations in the service.
Yes, it is possible to write a generic web service client, but I feel it would be a lot of work. Given that there are tools available, I feel it would be a waste of time better spent on other things.