Creating EJB Proxies to External WebServices Using the Dispatch API

Whilst JavaCAPS6, and specifically the HTTP Binding Component, have many useful features, there are currently limitations with it, notably calling JAX-RPC webservices using soap encoded arrays and calling webservices using SOAP1.2.

With JAX-WS you get access to the Dispatch API which makes it easy to call both of these use-cases from Java code.

Wrapping the Dispatch code inside an EJB, exposed as a doc/literal webservice, is a simple way to create a proxy to these external webservices, this EJB-WS can then be called from BPEL, for example, via the JavaEE SE making the overall process very efficient.

So, how do we do this........

1. Find an example RPC/encoded webservice - try this one which returns a quotation

2. Create a EJB project inside NetBeans

3. Create a WSDL to expose your EJB as a webservice

4. Do not create a WebService Client - this is an un-necessary step, we will do this dynamically in the code

5. Start coding, the code below can be used to call the above webservice and respond with the quotation string, pay special note to how the qualified names for the serviceName and portName are constructed and how they relate to the underlying WSDL.....

6. Attached are the EJB project & the input file representing the XML message sent to the external webservice. To test just create a WS client from the EJB-WS.

Enjoy....


Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Mark Foster, Obernai, France

I work for Sun in a team called FAST helping to enable the open source community for Open ESB.

Search

Categories
Archives
« April 2014
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today