6 Replies Latest reply on May 4, 2010 4:17 PM by sidhartaquintana

    Expose various WS throw just one WSDL.

      Hi everyone,

       

      The task that I’m trying to perform is to expose an undefined number of web services from different sources throw just one WSDL and modify it so if I want just one method from a WS I'll be able to do it, the way I’m trying to accomplish this is:

       

      1. I create a new ESB project
      2. In the corresponding jboss-esb-.xml file I add a first service called “WSConsumer_computerConversion” in which listener add a HTTP Gateway, and in the action section I add a SOAP Proxy invoking an external web service.
      3. Finally in the same as I do before add a second SOAP Proxy action called “WSConsumer_weightConversion”.

       

      Above result in a structure like this:

       

       

       

      tree.jpg

      I also attach the corresponding .xml file.

       

      When deploying the project to the server it generates a WSDL for each web service invoked, in this case 2 WSDL.

       

       

      contract.jpg

      What I’m trying to do is expose this WS throw just one WSDL.

       

      greetings.

       

      _____

      Sidh

        • 1. Re: Expose various WS throw just one WSDL.
          tfennelly

          There's nothing there at the moment to automagically do this i.e. construct the unified facade etc.  At present, you'd need to construct the facade yourself and have it perform content based routing based on the invoked operation etc.

          1 of 1 people found this helpful
          • 2. Re: Expose various WS throw just one WSDL.

            Thanks for your reply Tom, right now that's what I'm trying to do build it myself (kind of hehe) I've reading about it and I’d got to the point where I realize that I need to use proxy routing, I've doing some test about that too but nothing seems to work right. Did anyone of you try something like this? I mean construct the unified facade?  I’ve looking for examples on the web but it looks like this is an uncommon topic.

            • 3. Re: Expose various WS throw just one WSDL.

              This is an approach we’ve been trying, we have 3 different projects:


              CustomWSDL: containing the custom WS that performs the service invocation so that we have only one WSDL.


              package mx.com.comun.fin.ws.wsdl;
              
              import javax.jws.WebMethod;
              import javax.jws.WebParam;
              import javax.jws.WebService;
              import javax.jws.soap.SOAPBinding;
              import javax.jws.soap.SOAPBinding.Style;
              import javax.jws.soap.SOAPBinding.Use;
              
              @WebService
              @SOAPBinding(style=Style.DOCUMENT, use = Use.LITERAL)
              public interface CustomWSDL {
                  @WebMethod public int ejecutarAction1(@WebParam String param1);
                  @WebMethod public void ejecutaVentasDelDia(@WebParam String []param);
                  @WebMethod public String []obtenerParametros(@WebParam int pedido);
              }
              

               

               

              package mx.com.comun.fin.ws.wsdl;
              
              import javax.jws.WebService;
              
              import org.jboss.soa.esb.client.ServiceInvoker;
              import org.jboss.soa.esb.couriers.FaultMessageException;
              import org.jboss.soa.esb.listeners.message.MessageDeliverException;
              import org.jboss.soa.esb.message.Message;
              import org.jboss.soa.esb.message.format.MessageFactory;
              import org.jboss.soa.esb.services.registry.RegistryException;
              import org.slf4j.Logger;
              import org.slf4j.LoggerFactory;
              
              @WebService(endpointInterface="mx.com.comun.fin.ws.wsdl.CustomWSDL")
              public class CustomWSDLImpl implements CustomWSDL {
                  private static Logger log = LoggerFactory.getLogger(CustomWSDLImpl.class);
                  @Override
                  public void ejecutaVentasDelDia(String[] param) {
                      // TODO Auto-generated method stub
                      try {
                          log.info("Andamos aqui....... VIVE");
                          ServiceInvoker invoker = new ServiceInvoker("FinComun", "Venta");
                          Message mesg = MessageFactory.getInstance().getMessage();
                          mesg.getBody().add(param[0]);
                          
                          Message msg = invoker.deliverSync(mesg, 1000L);
                          log.info("Mensaje devuelto regresamos al punto de entrada: " + msg.getBody().get().toString());
                          //invoker.deliverAsync(mesg);
                          
                      } catch (MessageDeliverException e) {
                          // TODO Auto-generated catch block
                          e.printStackTrace();
                      } catch (FaultMessageException e) {
                          // TODO Auto-generated catch block
                          e.printStackTrace();
                      } catch (RegistryException e) {
                          // TODO Auto-generated catch block   
                          e.printStackTrace();
                      }
              
                  }
              
                  @Override
                  public int ejecutarAction1(String param1) {
                      // TODO Auto-generated method stub
                      return 0;
                  }
              
                  @Override
                  public String[] obtenerParametros(int pedido) {
                      // TODO Auto-generated method stub
                      return null;
                  }
              
              }
              


              ServiciosWebESB: containing the WS that we build ourselves that will be invoked and pass throw our custom WSDL.


              SoapProxy: the ESB projecto that will manage all of this.

               


              tree2.jpg

               


              <?xml version="1.0"?>
              <jbossesb parameterReloadSecs="5"
               xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd http://anonsvn.jboss.org/repos/labs/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd">
               <services>
                <service category="FinComun"
                 description="Punto de Acceso para los clientes que quieran accesar a los servicios del canal"
                 invmScope="GLOBAL" name="FinComunEntryPoint">
                 <listeners>
                  <http-gateway name="HTTPGW-EntryPoint"/>
                 </listeners>
                 <actions>
                  <action name="entrada">
                   <property name="message" value="Entramos al punto de entrada del canal de servicios"/>
                  </action>
                  <action name="Proxy-FinComun">
                   <property name="wsdl" value="http://127.0.0.1:8080/CustomWSDL/ProxyWSDL?wsdl"/>
                  </action>
                  <action name="salida">
                   <property name="message" value="Saliendo del canal de servicios de Fin Comun"/>
                  </action>
                 </actions>
                </service>
                <service category="FinComun" description="Post Venta WS"
                 invmScope="GLOBAL" name="Venta">
                 <actions>
                  <action name="antesVenta">
                   <property name="message" value="Procesando Venta........."/>
                  </action>
                  <action
                   name="request-mapper" process="process"/>
                  <action name="SoapUI">
                   <property name="wsdl" value="http://127.0.0.1:8080/ServiciosWebESB/PostVenta?wsdl"/>
                   <property name="SOAPAction" value="ventasDelDia"/>
                   <property name="responseAsOgnlMap" value="true"/>
                  </action>
                  <action
                   name="response-mapper" process="process"/>
                  <action name="despuesVenta">
                   <property name="message" value="Ya vendimos awepooooo"/>
                  </action>
                 </actions>
                </service>
               </services>
              </jbossesb>
              

              • 4. Re: Expose various WS throw just one WSDL.
                tfennelly

                Not sure if something like this has been tried... Dave Ward??

                 

                Yeah... a jsr-181 as the facade would be one approach for sure.  Would be nice to automate this if possible e.g. allowing multiple wsdls to be defined on the SOAPProxy and have it expose a unified wsdl.  The SOAPProxy would then know which service to route the individual operation invocations to.  Of course.. might be tricky generating the unified WSDL and some transforms with probably be required on the SOAP invocation payloads before proxying on to the backend services.

                • 5. Re: Expose various WS throw just one WSDL.
                  dward

                  The closest thing we have to a facade routing to different services that use SOAPProxy actions is the webservice_proxy_routed quickstart.  You can see in jboss-esb.xml that we use a Drools-based content based router to inspect the incoming soap request, and based on operation, it routes to one of two different target (SOAPProxy) services.  You can see how the matching is done in Proxy_Routed_Rules.drl.

                   

                  The problem, of course, is that the facade service doesn't expose a merged WSDL.  This sounds like a good Jira Feature Request, however I personally doubt it will happen in the ESB 4.x series.  A lot of thought would have to be put into how to go about implementing it.  The first hurdle that comes to my mind would be how to handle conflicts of operation names and schema types within the same namespace.

                  1 of 1 people found this helpful
                  • 6. Re: Expose various WS throw just one WSDL.

                    Thank you Tom and David this has been a difficult topic indeed. I'll let you know how we manage to acomplish this.


                    Greetings.