7 Replies Latest reply on Apr 13, 2009 6:26 AM by 843830

    call web service via OpenESB

    843830
      I have deployed an echo web service (using axis 1.4) on
      tomcat. I can successfully call it from my client but I
      want my call to go through OpenESB to bring a level of
      indirection so that in future if there is any change in the
      web service (endpoint etc.), I don�t have to change my
      client.

      Please advice me how to do that.

      Thanks.
        • 1. Re: call web service via OpenESB
          843830

          While trying to call my echo web service via OpenESB using a standalone client, I am getting this error:-



          javax.jbi.messaging.MessagingException: Unable to locate activated endpoint for service connection



          Can anybody let me know as to what am I doing wrong?



          Thanks.

          • 2. Re: call web service via OpenESB
            843830
            Can you provide details on how your compsite application looks? When you deploy your comp app, did you see any errors (in NB console or server.logs)? Which endpoint was not found? Can you provide the stack trace?
            • 3. Re: call web service via OpenESB
              843830

              Web Service*

              *
              *
              *
              *
              *import org.w3c.dom.Element;*
              
              *public class MyService {*
              
              *public Element[] serviceMethod(Element[] elems) {*
              
              *String xmlStr = elems[0].getTextContent();*
              
              *System.out.println("*****************Service was called*******"+xmlStr);*
              
              *return elems;*
              
              *}*
              
              
              
              *}*
              *
              *

              **WSDL*

              *


              <?xml version="1.0" encoding="UTF-8"?>
              <wsdl:definitions targetNamespace="<a href="http://localhost:8080/axis/services/MyService">http://localhost:8080/axis/services/MyService</a>" xmlns:apachesoap="<a href="http://xml.apache.org/xml-soap">http://xml.apache.org/xml-soap</a>" xmlns:impl="<a href="http://localhost:8080/axis/services/MyService">http://localhost:8080/axis/services/MyService</a>" xmlns:intf="<a href="http://localhost:8080/axis/services/MyService">http://localhost:8080/axis/services/MyService</a>" xmlns:tns1="<a href="http://webservice.fgs.com/">http://webservice.fgs.com/</a>" xmlns:wsdl="<a href="http://schemas.xmlsoap.org/wsdl/">http://schemas.xmlsoap.org/wsdl/</a>" xmlns:wsdlsoap="<a href="http://schemas.xmlsoap.org/wsdl/soap/">http://schemas.xmlsoap.org/wsdl/soap/</a>" xmlns:xsd="<a href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>">
              <!--WSDL created by Apache Axis version: 1.4
              Built on Apr 22, 2006 (06:55:48 PDT)-->
              <wsdl:types>
              <schema targetNamespace="<a href="http://webservice.fgs.com/">http://webservice.fgs.com/</a>" xmlns="<a href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>">
              <element name="serviceMethod" type="xsd:anyType"/>
              </schema>
              <schema targetNamespace="<a href="http://localhost:8080/axis/services/MyService">http://localhost:8080/axis/services/MyService</a>" xmlns="<a href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>">
              <element name="serviceMethodReturn" type="xsd:anyType"/>
              </schema>
              </wsdl:types>


              <wsdl:message name="serviceMethodResponse">


              <wsdl:part element="impl:serviceMethodReturn" name="serviceMethodReturn"/>


              </wsdl:message>


              <wsdl:message name="serviceMethodRequest">


              <wsdl:part element="tns1:serviceMethod" name="part"/>


              </wsdl:message>


              <wsdl:portType name="MyService">


              <wsdl:operation name="serviceMethod">


              <wsdl:input message="impl:serviceMethodRequest" name="serviceMethodRequest"/>


              <wsdl:output message="impl:serviceMethodResponse" name="serviceMethodResponse"/>


              </wsdl:operation>


              </wsdl:portType>


              <wsdl:binding name="MyServiceSoapBinding" type="impl:MyService">


              <wsdlsoap:binding style="document" transport="<a href="http://schemas.xmlsoap.org/soap/http"/">http://schemas.xmlsoap.org/soap/http"/</a>>


              <wsdl:operation name="serviceMethod">


              <wsdlsoap:operation soapAction=""/>


              <wsdl:input name="serviceMethodRequest">


              <wsdlsoap:body use="literal"/>


              </wsdl:input>


              <wsdl:output name="serviceMethodResponse">


              <wsdlsoap:body use="literal"/>


              </wsdl:output>


              </wsdl:operation>


              </wsdl:binding>


              <wsdl:service name="MyServiceService">


              <wsdl:port binding="impl:MyServiceSoapBinding" name="MyService">


              <wsdlsoap:address location="http://localhost:8080/axis/services/MyService"/</a>>


              </wsdl:port>


              </wsdl:service>


              </
              *_Client_*


              import java.io.StringWriter;


              import javax.xml.namespace.QName;
              import javax.xml.parsers.DocumentBuilderFactory;
              import javax.xml.rpc.ParameterMode;
              import javax.xml.transform.Transformer;
              import javax.xml.transform.TransformerFactory;
              import javax.xml.transform.dom.DOMSource;
              import javax.xml.transform.stream.StreamResult;


              import org.apache.axis.Constants;
              import org.apache.axis.client.Call;
              import org.apache.axis.client.Service;
              import org.apache.axis.constants.Style;
              import org.xml.sax.InputSource;


              /**
              * Simple test driver for our message service.
              */
              public class TestClient {


              final static String NAMESPACE = "
              http://webservice.fgs.com/";

              public static void main(String[] args){
              try{
              System.out.println("TestClient.main()");
              Service service = new Service();
              Call call = (Call) service.createCall();
              //This is where I am calling ESB through which the call will go to my actual service - <a href="http://localhost:8080/axis/services/MyService">http://localhost:8080/axis/services/MyService</a>


              call.setTargetEndpointAddress("http://localhost:18181/service");
              call.setOperationStyle(Style.DOCUMENT);
              call.setOperationName(new QName(NAMESPACE, "serviceMethod"));
              call.addParameter("elems", Constants.XSD_ANY,ParameterMode.IN);
              call.setReturnType(Constants.XSD_ANY);
              String result = (String) call.invoke(new Object[] { "Hello World"});
              System.out.println(result);
              }
              catch(Exception e){
              e.printStackTrace();
              }


              }


              }



              I want to inquire as to how do I go about things If my service and client are external to OpenESB? (My echo service is deployed in tomcat) i.e. how can I bring about the level of indirection?. In other words, rather than calling my web service (MyService) directly, the call will go via OpenESB.



              Please note that my service is document/literal compliant.



              Looking forward to your valuable guidance.



              Thanks.


              • 4. Re: call web service via OpenESB
                843830

                Hello,



                While trying to call my echo web service (deployed in jboss/tomcat) via OpenESB using a standalone client, I am getting this exception:-



                javax.xml.ws.soap.SOAPFaultException: javax.jbi.messaging.MessagingException: javax.jbi.messaging.MessagingException: HTTPBC-E00799: Message denormalization failed


                at com.sun.xml.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:187)


                at com.sun.xml.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:108)


                at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:254)


                at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:224)


                at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:117)


                at $Proxy26.echoClientOperation(Unknown Source)



                Can you please let me know why that is happening?



                Thanks.

                • 5. Re: call web service via OpenESB
                  843830
                  Can you please explain what you mean "While trying to call my echo web service (deployed in jboss/tomcat) via OpenESB". Does that mean you have already achieved the level of indirection you were looking for? If yes, how did you do it?

                  You can find a lot of samples, tutorials and demos here http://wiki.open-esb.java.net/Wiki.jsp?page=Jbicomps
                  I would recommend that you go through some of these to see how open-esb can be used.

                  Thanks
                  • 6. Re: call web service via OpenESB
                    843830

                    Yes, I believe I have achieved the level of indirection that I taked about, but the problem is that everything is happening in open ESB environment i.e

                    Client (created via netbeans) -> Intermediate service (open esb)- > My web service (glassfish).

                    I am not able to achieve the same when my Client and my service are running on different environment i.e

                    Client (using apache axis) -> Intermediate service (open esb)- > My web service (tomcat/jboss).

                    Let me know one of your email ids so that I can send across my projects to you.

                    Thanks.

                    • 7. Re: call web service via OpenESB
                      843830
                      hi every1.
                      i m a newbie working with Open ESB.
                      i m trying to develop a simple proj:
                      client(JSP) calls ESB which calls a webservice.
                      webservice sends a reply to ESB which in turn sends it to JSP.
                      i know how to create web service,bpel module proj and composite application..
                      but i have no idea how to make JSP call ESB...
                      thanks in advance for any help...