4

Will I be able to connect to a JAX-RPC web service using a JAX-WS (wsimport) generated client stub? What are the effects of consuming a JAX-RPC web service using a JAX-WS client? Are there any advantages and disadvantages?

Arci
  • 6,647
  • 20
  • 70
  • 98

1 Answers1

6
  1. The tool wsimport works on a WSDL file which is an XML document describing the web service.
  2. The tool wsimport does not care to the style of the service (RPC/DOCUMENT) as described in the WSDL.
  3. If the WSDL has RPC-style, it will generate the client stubs for consuming RPC-style web services and similarly for document-style.
  4. JAX-WS (which provides wsimport) provides (or rather capable of generating ) both the style (RPC/Document) of web services and both work equally well with respective types of service end points.
  5. Here is an example of using wsimport for generating JAX-RPC client.

Hope this helps.

Arci
  • 6,647
  • 20
  • 70
  • 98
Santosh
  • 17,667
  • 4
  • 54
  • 79
  • Hi! Thanks for your reply! Does it mean that it doesn't matter if I'm using a wsimport generated client stubs or a wscompile generated client stubs because, in the end, I'll still be able to connect using either of the 2? My dilemna is something like this: I have a set of WSDL files. Since I don't know how to the generate client stubs yet when I received the WSDL files, I ask someone to generate the client stubs for me. The one who generated the client stubs uses IBM's RAD. Some of the files were generated using JAX-RPC while some were generated using JAX-WS. – Arci Sep 11 '12 at 06:35
  • Now here's the part where I'm confused: If he can generate all of the WSDL files using JAX-WS, then why did he generate the others using JAX-RPC? What is the relevance of generating using JAX-RPC? I know that JAX-WS is newer so why did he chose to generate the others using JAX-RPC? Can you please enlighten me on this one? – Arci Sep 11 '12 at 06:38
  • Well, `wsimport` is the latest thing for generating web services artifacts and is better where as `wscompile` is earlier way of doing the same thing. [Check this link](http://weblogs.java.net/blog/kohlert/archive/2006/01/easier_web_serv.html). Ideally,as you said, it does not matter whether you use `wsimport` or `wscompile`. But, in your particular case, why the other person used `JAX-RPC` and not `JAX-WS`? Honestly I cannot figure this out. He himself is better person to answer this query. – Santosh Sep 11 '12 at 06:56
  • Not sure but may be a case wherein a WSDL is too complex to be handled by normal `wsimport` and hence he is compelled to use `wscompile`. But this is a _remote possibility_ and I would be curious to know about that case. – Santosh Sep 11 '12 at 06:57
  • Thanks! Yup, I'm also not sure why he opted to use JAX-RPC on others. In fact, I was also able to generate JAX-WS clients from the WSDL files wherein he generated the JAX-RPC clients. So there shouldn't be a problem with the WSDL file. But I won't be able to test the generated clients since I don't have access to the actual web service. :| Maybe I should ask it directly to him why he did it. Thanks for the clarification! – Arci Sep 11 '12 at 07:13