3 Replies Latest reply on Aug 5, 2006 11:29 AM by Lightenex Cui

    Desgin Patterns - Web Service

    Nagesh Gummadivalli Newbie

      Hi,
      What is the best way of sending data to web service in intranet application?
      Is it over HTTP or thru SOAP Client? I inclined towards using SOAP Client (with generated stubs) but can anybody suggest me some good patterns for client (SOAP) patterns?

        • 1. Re: Desgin Patterns - Web Service
          Justin Bertram Newbie

          Web Services almost always communicate using HTTP. HTTP is the transfer protocol.

          Web Services can either be SOAP based XML or just plain XML. In the former case, SOAP is the content protocol.

          Web Services using SOAP is the industry standard right now so I would recommend you go that route. There are lots of tools out there to generates stubs, etc., including JBoss' wstools.

          • 2. Re: Desgin Patterns - Web Service
            Nagesh Gummadivalli Newbie

            Thanks for the answer. But My question is regarding posting data over HTTP using URLCOnnection or using generated stubs.
            I am having another problem now, please see the below proble.

            I have to accept the data in xml format and it is working fine if i make call to web service using client like below.
            IdentityService service = new IdentityServiceProviderLocator).getIdentityPort();
            System.out.println(service.retrieveUsersByAccountId(xmlInputFile));

            But was getting issues with the below client
            Call call = (Call)service.createCall();
            call.setTargetEndpointAddress( endpoint );
            SOAPEnvelope env = new SOAPEnvelope(new java.io.ByteArrayInputStream(xmlInputFile.getBytes()));
            //System.out.println(" env---"+env);
            call.invoke(env);
            SOAPEnvelope elems = (SOAPEnvelope)call.invoke(env);
            System.out.println("elemss----"+elems);

            It says no operation "xyz.." found .


            • 3. Re: Desgin Patterns - Web Service
              Lightenex Cui Newbie

              yeah, in my opinion, the best way to performing SOAP client operations would be using generated client instead of DII, DII seems got its own trouble in many ways, and the code written by DII is not easy to maintain. You can choose any independent stub generatation tools to generate those stubs. moreover, you can create a facade layer for web service access, if the service point has changed, you can limit your change in the facade layer, and that's really helpful for you to address short term change and make things happen.