5 Replies Latest reply on Oct 20, 2004 11:23 AM by sfrind

    j2me webservice client (jsr172) possible?

    sfrind Newbie

      Hello,
      I am trying to create a java client for a webservice.
      As far as I know jsr172 reference implementation from SUN supports only documentliteral encoding and not rpcliteral.
      Is used
      wscompile -cp . -define -mapping ComplexServiceMapping.xml -f:documentliteral config.xml
      to create wsdl and mapping file
      and used
      java -cp %MYCP% com.sun.j2mews.sg.WSCompile -keep -gen:client -f:wsi -verbose stubsconfig.xml
      In order to generate jsr172 stubs.
      I can deploy the stuff on jboss4.0. No warning. But when I want to acess the websevice from my j2me java client the client sends an SOAP envelop and the server throws exception
      17:10:48,137 ERROR [RPCInvocation] org.xml.sax.SAXException: Deserializing parameter 'compute': could not find deserializer for type {http://gfd.de/types}compute
      org.xml.sax.SAXException: Deserializing parameter 'compute': could not find deserializer for type {http://gfd.de/types}compute
      at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:330)

      Does jboss4.0 support documentliteral encoding? Did someone successfully used an jsr172 client with jboss?

      Thanks a lot,
      Stephan

        • 1. Re: alpha release soon
          sfrind Newbie

          Hi howard !

          I am glad you commented and I am ok to provide you feedbacks.

          First point :

          when a page is redirected, the vaidate method is never called a second time. I think such a behaviour would be usefull. It comes from the service method of AbstractEngine :

          service()
          {
          ...
          try { service.service(this, cycle, output);
          }
          ...
          catch(RedirectException e)
          {
          redirect(ex.getTargetPageName(), cycle, output, ex);
          }
          ...
          }

          redirect(...)
          {
          ...
          IPage page = cycle.getPage(pageName);
          cycle.setPage(page);
          renderResponse(cycle, out);
          ...
          }

          and in DirectService :

          service(...)
          {
          ...
          IPage page = cycle.getPage(pageName);
          ...
          page.validate(cycle);
          ...
          engine.renderResponse(cycle, output);
          ...
          }

          you see that validate is not called when I redirect
          to a page. Therefore I added a validateBusiness method
          that is called every time a page is going to be
          validated, because I feel it like that. What' your
          POV ?

          Second point :

          I did a form componenet with many properties that go in a map.

          AFAIK the tapestry way,

          <component-specification>
          ...



          ...
          </component-specification>

          in the class :

          public void getAddress()
          {
          return map.get("address");
          }

          public void setAddress(String address)
          {
          map.put("address", address);
          }

          what I did is simply to intercept call to the
          class by binding some code thanks to ognl with smth
          like :

          public Object getProperty(
          Map context,
          Object target,
          Object name)
          throws OgnlException
          {
          return map.get(name);
          }

          that mean I can save some *stupid* code.

          Some feedback in general :

          I wish tapestry would have more generic
          way to generate page components. For instance a
          component could be generated programmatically on the fly when a page is rendered according to some metadata.

          Second I *really* wish tapestry would integrate
          JAAS for security. So far I am using it in forum
          code.

          That would be usefull for everyone using tapestry + jboss.
          To my taste, validate() is a little bit light for security
          purposes. But that could be jboss specific and you
          don't want that. Anyway there might be smth to do :
          JAAS + jboss JAAS specific pluggin.

          I would like also to EJB locals usable directly.

          for instance :






          public UserEJBLocal getUser()
          {
          return a EJB local user;
          }

          public void edit(IRequestCycle cycle)
          {
          UserEJBLocal user = cycle.getParameters()[0];
          ...
          do smth with that damn user
          }

          that mean transparently encode EJB pk + a way to find
          its home and decode it later.

          I hope to have brought some ideas and that my POV
          is not flawed or insane.

          julien

          • 2. Re: j2me webservice client (jsr172) possible?
            Thomas Diesler Master

            Yes, we support doclit, however there are known issues in the Axis layer. Try to supply a serializer/deserializer for {http://gfd.de/types}compute in ws4ee-deployment.xml if it is not a bean.

            • 3. Re: j2me webservice client (jsr172) possible?
              sfrind Newbie

              I don't understand the issue I am quite new to webservices. Here is a sample envelop that was send by a client:
              <?xml version="1.0" encoding="utf-8"?>
              <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xmlns:xsd="http://www.w3.org/2001/XMLSchema"
              xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
              xmlns:tns="http://gfd.de/types">
              <soap:Body>
              <tns:compute>
              <Args_1 xmlns="">
              12
              a
              b
              </Args_1>
              </tns:compute>
              </soap:Body>
              </soap:Envelope>

              compute is the operation. Args_1 represents a java object that follows bean spec. When I understand you right then I have to create a serializer and a deserializer for my operation. No idea how to do that. The other point is how does JBossWS know that clients wants to talk document/literal encoding? I understand that default behaviour is rpc/literal. Do I have to specify something in configuration? If yes how to do that?

              • 5. Re: j2me webservice client (jsr172) possible?
                sfrind Newbie

                I have to admit that I don't understand this part of the wiki.
                I don't understand
                - where can I find the generated wsdd file when I deploy my web service?
                - why does JBossWS complain about missing serializer for my operation?
                In the given sample JBossWS complains about a non basic class that is instance variable of an argument class for this service. It does not complain about the operation itself.
                Here my corresponding wsdl snipped:
                <definitions name="ComplexService" targetNamespace="http://gfd.de/wsdl" xmlns:tns="http://gfd.de/wsdl" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:ns2="http://gfd.de/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">

                <schema targetNamespace="http://gfd.de/types" xmlns:tns="http://gfd.de/types" xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://www.w3.org/2001/XMLSchema">

















                ...
                I don't understand why I should provider a serializer for the operation (webservice method) itself and how it should look like.