2 Replies Latest reply on Oct 8, 2008 3:17 AM by Rixhon Vincent

    CXF Apache: null pointer problem with my reponse

    Rixhon Vincent Newbie

      Hello,

       

      I have a big problem with reception of a CXF answer and i'm looking for a solution since many days. In my aut-generated classes, i have a null pointer.

      I use "apache-cxf-2.1.2". From a wsdl file, with https, i've auto-generated many classes with wsdl2java. My application send a request to LDAP server with webservice (using https). Communication work fine: my request is sent and web service send me a correct response. I think my problem is in these auto-generated classes with wsdl2java, because at the reception of the response, inside of the response class (a bean), the pointer to another class (an other bean), is null and my response (in log) is correct and well formed (like in util soapUI).

       

      For more information, here is my request xml:

       

                  <!You may enter the following 2 items in any order>

                   

       

      Here is the auto-generated code with wsdl2java for response:

      @XmlAccessorType(XmlAccessType.FIELD)

      @XmlType(name = "connectResponseType", propOrder = {

                "_return"

      })

       

      public class ConnectResponseType {

       

          @XmlElement(name = "return", required = true)

          protected ConnectedUser _return;

       

          public ConnectedUser getReturn() {

              return _return;

          }

       

          public void setReturn(ConnectedUser value) {

              this._return = value;

          }

      }

       

      The "_return" pointer has value null at response time.

       

      Here is my call code:

      URL wsdlURL = new URL("https://adress/ldaplogon?wsdl");

      QName SERVICE_NAME = new QName("urn:ldaplogonwsdl", "ldaplogonwsdl");

      Ldaplogonwsdl ss = new Ldaplogonwsdl(wsdlURL, SERVICE_NAME);

      LdaplogonwsdlPortType port = ss.getLdaplogonwsdlPort(); 

      org.apache.cxf.endpoint.Client client = ClientProxy.getClient(port);

      HTTPConduit httpConduit = (HTTPConduit) client.getConduit();  

      TLSClientParameters tlsParams = new TLSClientParameters();

      tlsParams.setSecureSocketProtocol("SSL");

      httpConduit.setTlsClientParameters(tlsParams);

      HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();

      httpClientPolicy.setConnectionTimeout(36000);

      httpClientPolicy.setAllowChunking(false);

      httpClientPolicy.setReceiveTimeout(32000);

      httpConduit.setClient(httpClientPolicy);

      ConnectRequestType connectparameters = new ConnectRequestType();

      User myUser = new User();

      myUser.setLogin(username);

      myUser.setPwd(password);

      connectparameters.setUser(myUser);

      ConnectResponseType connect_return = port.connect(_connect_parameters);

      System.out.println("_connect__return=" + connect_return);

      ConnectedUser connectedUser = (ConnectedUser) connect_return.getReturn();

       

      And connectedUser has null value.

      Please, could you help me?

       

      Thank you in advance,

      Vincent

        • 1. Re: CXF Apache: null pointer problem with my reponse
          Daniel Kulp Newbie

          The soap:body information doesn't show in the above post.  Any chance you can include that?

           

          The USUAL cause of this is that the qualification on the elements is not correct according to the schema.  To diagnose that, I'd need to see the schema as well as the soap messages.  

           

          For example, if the schema has an defaultElementForm="unqualified", (or no elementForm since the default is unqualified) but the soap message sets a default namespace, that will usually cause issues.  

           

          One thing you could try  is to turn on schema validation.

          ((BindingProvider)port).getRequestContext().put("schema-validation-enabled", "true");

           

          and seeing of an error is reported.

          • 2. Re: CXF Apache: null pointer problem with my reponse
            Rixhon Vincent Newbie

            Hello,

             

            Thanks for your response.

            Here is the wsdl file for the schema:

             

             

             

            Edited by: vincerix on Oct 8, 2008 3:16 AM