14 Replies Latest reply on Oct 26, 2004 8:35 AM by thomas.diesler

    NullpointerException in Axis

    robisz

      I'm trying to access a remote web service from a session bean.
      I have followed the instructions in this Wiki page:
      http://www.jboss.org/wiki/Wiki.jsp?page=WSClientEJB

      Service lookup from JNDI is successful and I can obtain the web service
      port, but when I invoke a method on the service endpoint interface I get
      the following exception:

      2004-10-04 13:24:59,868 ERROR [org.jboss.webservice.client.PortProxy] Port error
      java.lang.NullPointerException
       at org.apache.axis.client.AxisClientProxy.proxyParams2CallParams(AxisClientProxy.java:130)
       at org.apache.axis.client.AxisClientProxy.invoke(AxisClientProxy.java:249)
       at $Proxy284.getPresence(Unknown Source)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:324)
       at org.jboss.webservice.client.PortProxy.invoke(PortProxy.java:93)
       at $Proxy284.getPresence(Unknown Source)
       ....


      Does anyone know what to do?

        • 1. Re: NullpointerException in Axis
          thomas.diesler

          Yes, it seems the wsdl is in document/literal style.
          I want to access a remote webservice and the wsdl comes from
          an external source... Does it means I won't be able to use it?

          • 2. Re: NullpointerException in Axis
            thomas.diesler

            what version of jboss?

            • 3. Re: NullpointerException in Axis
              robisz

              4.0 final

              • 4. Re: NullpointerException in Axis
                yaaarrrgg

                i had some problems with web services in 4.0 as well. i used the wsdl2java pluing from myspotter.com. jboss seems to be missing an axis config file?

                http://sourceforge.net/tracker/index.php?func=detail&aid=1038708&group_id=22866&atid=376685

                -ks

                • 5. Re: NullpointerException in Axis
                  robisz

                  Yes, it seems the wsdl is in document/literal style.
                  I want to access a remote webservice and the wsdl comes from
                  an external source... Does it means I won't be able to use it?

                  • 6. Re: NullpointerException in Axis
                    thomas.diesler

                    I'm seeing the same issue when connecting to www.sforce.com's document/literal services. It's prio one of my todos.

                    • 7. Re: NullpointerException in Axis
                      thomas.diesler

                      BTW, is your service public? Can you provide a test and file an issue on sourceforge?

                      • 8. Re: NullpointerException in Axis
                        robisz

                        I'm sorry, my service is not public... but I've maked a small sample
                        application and I'm perceiving very strange things...

                        I've maked this SEI:

                        package sample.ws;
                        
                        public interface SampleEndpoint extends java.rmi.Remote {
                         public String changeSalary(UserType user, Integer amount) throws java.rmi.RemoteException;
                        }


                        The implementation class:
                        public class SampleEndpointImpl implements SampleEndpoint {
                        
                         public String changeSalary(UserType user, Integer amount)
                         throws RemoteException {
                         return "Hello " + user.getFirstName() + " " + user.getLastName()
                         +"! Your salary is: " + amount;
                         }
                        
                        }


                        I've created a sample servlet wich calls this webservice method and
                        displays the result string.

                        I've generated the wsdl in three ways (with axis Java2WSDL):
                        1. rpc/literal (with --style RPC)
                        2. document/literal (with --style DOCUMENT)
                        3. document/literal wrapped (with --style WRAPPED)

                        In every cases I get different results...

                        1. rpc/literal
                        Everything seems fine. With this method call in servlet...
                        UserType user = new UserType();
                         user.setFirstName("John");
                         user.setLastName("Smith");
                        
                         String info = endpoint.changeSalary(user, new Integer(5000));

                        ...I'm getting correct result:
                        Hello John Smith! Your salary is: 5000


                        2. document/literal
                        In this case I'm getting the following result:
                        Hello John Smith! Your salary is: null


                        It seems all parameters except the first will be null in this case.
                        I think this is a bug.

                        3. document/literal wrapped
                        In this case I'm getting NullPointerExcpetion as above in my first post.
                        Messages in wsdl contain only one part, although my EIS method has two
                        parameters, but I think it's normal in wrapped style.

                        Unfortunately my service's wsdl belongs to the 3rd category...

                        I've posted a bug report contains my sample application.

                        Robisz

                        • 9. Re: NullpointerException in Axis
                          thomas.diesler

                          The wrapped style is not allowed by the BasicProfile. Try generating your wsdl/jaxrpc-mapping.xml with jwsdp-1.4 wscompile.

                          • 10. Re: NullpointerException in Axis
                            dsosnoski

                            If you're referring to the WS-I Basic Profile, wrapped style most certainly is allowed - wrapped is just a set of conventions for one way of structuring doc/lit based on method call definitions.

                            - Dennis

                            Dennis M. Sosnoski
                            Enterprise Java, XML, and Web Services Support
                            http://www.sosnoski.com
                            Redmond, WA 425.885.7197

                            • 11. Re: NullpointerException in Axis
                              thomas.diesler

                              Denis says:

                              If you're referring to the WS-I Basic Profile, wrapped style most certainly is allowed - wrapped is just a set of conventions for one way of structuring doc/lit based on method call definitions.

                              - Dennis

                              Dennis M. Sosnoski
                              Enterprise Java, XML, and Web Services Support http://www.sosnoski.com Redmond, WA 425.885.7197

                              • 12. Re: NullpointerException in Axis
                                robisz

                                Your comment is not visible, please respost it.
                                I wonder about the latest developments :-)

                                Thx
                                robisz

                                • 13. Re: NullpointerException in Axis
                                  robisz

                                  Excuse me for reposting the question but I haven't got any
                                  answer yet.
                                  Is document/literal-wrapped supported by J2EE 1.4 or not?
                                  In doc/lit style could my SEI methods have more than one arguments?

                                  I think the answer is yes, but it doesn't work in JBoss...

                                  Does anybody know whats the truth about it?

                                  Thx

                                  • 14. Re: NullpointerException in Axis
                                    thomas.diesler

                                    > Is document/literal-wrapped supported by J2EE 1.4 or not?

                                    It is not covered by J2EE spec, JBossWS does not support it.

                                    > In doc/lit style could my SEI methods have more than one arguments?

                                    This is poorly supported in Axis, which JBossWS still uses internally. In jboss-4.0.1 there will probably be better support for it. Until then, you should use wrapper objects for multiple parameters.

                                    The jboss-4.0.1 release is scheduled for next week.