Results 1 to 14 of 14
  1. #1
    butny is offline Member
    Join Date
    Nov 2011
    Posts
    14
    Rep Power
    0

    Default Null response object from Java Web Service

    Hi all,

    I did not found any anything specific to web service, hence though of posting my question here:

    I tried running the Web Service as a java application by adding a main method in the service, i got all the model values getting populated perfectly. There are some DAO operations with Oracle 10g DB, have classes12.jar in my classpath.

    Then i created a wsdl and tested it in SOAP UI. There I can see that the service is returning a null object as response.

    The wsdl was created using Apache AXIS v1.4.

    This means the wsdl getting generated is not correct since all my code is working fine when i run it as java client application.

    Additional Info:

    When the return type of a method present in the web service is integer, then the value is getting returned correctly while invoking the Web Service using SOAP UI. But when i try to return a model, a null response object is returned.

    WSDL:

    Java Code:
    <!--WSDL created by Apache Axis version: 1.4
     Built on Apr 22, 2006 (06:55:48 PDT)-->
     <wsdl:types>
      <schema elementFormDefault="qualified" targetNamespace="http://service.com"   xmlns="http://www.w3.org/2001/XMLSchema">
      <import namespace="http://model.com"/>
      <element name="getAge">
       <complexType/>
      </element>
      <element name="getAgeResponse">
       <complexType>
        <sequence>
         <element name="getAgeReturn" type="xsd:int"/>
        </sequence>
       </complexType>
      </element>
      <element name="fetchEmployeeDetails">
       <complexType>
        <sequence>
         <element name="empId" type="xsd:int"/>
        </sequence>
       </complexType>
      </element>
      <element name="fetchEmployeeDetailsResponse">
       <complexType>
        <sequence>
         <element name="fetchEmployeeDetailsReturn" type="tns1:EmployeeDetails"/>
        </sequence>
       </complexType>
      </element>
     </schema>
     <schema elementFormDefault="qualified" targetNamespace="http://model.com"    xmlns="http://www.w3.org/2001/XMLSchema">
      <complexType name="EmployeeDetails">
       <sequence>
        <element name="age" type="xsd:int"/>
        <element name="deptId" type="xsd:int"/>
        <element name="empId" type="xsd:int"/>
        <element name="empName" nillable="true" type="xsd:string"/>
        <element name="sex" nillable="true" type="xsd:string"/>
       </sequence>
      </complexType>
     </schema>
    </wsdl:types>
    
      <wsdl:message name="fetchEmployeeDetailsResponse">
    
      <wsdl:part element="impl:fetchEmployeeDetailsResponse" name="parameters">
    
      </wsdl:part>
    
      </wsdl:message>
    
      <wsdl:message name="getAgeRequest">
    
         <wsdl:part element="impl:getAge" name="parameters">
    
         </wsdl:part>
    
      </wsdl:message>
    
      <wsdl:message name="getAgeResponse">
    
         <wsdl:part element="impl:getAgeResponse" name="parameters">
    
         </wsdl:part>
    
      </wsdl:message>
    
      <wsdl:message name="fetchEmployeeDetailsRequest">
    
         <wsdl:part element="impl:fetchEmployeeDetails" name="parameters">
    
         </wsdl:part>
    
      </wsdl:message>
    
      <wsdl:portType name="WebService1">
    
         <wsdl:operation name="getAge">
    
            <wsdl:input message="impl:getAgeRequest" name="getAgeRequest">
    
          </wsdl:input>
    
            <wsdl:output message="impl:getAgeResponse" name="getAgeResponse">
    
          </wsdl:output>
    
         </wsdl:operation>
    
         <wsdl:operation name="fetchEmployeeDetails">
    
            <wsdl:input message="impl:fetchEmployeeDetailsRequest" name="fetchEmployeeDetailsRequest">
    
          </wsdl:input>
    
            <wsdl:output message="impl:fetchEmployeeDetailsResponse" name="fetchEmployeeDetailsResponse">
    
          </wsdl:output>
    
         </wsdl:operation>
    
      </wsdl:portType>
    
      <wsdl:binding name="WebService1SoapBinding" type="impl:WebService1">
    
         <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    
         <wsdl:operation name="getAge">
    
            <wsdlsoap:operation soapAction=""/>
    
            <wsdl:input name="getAgeRequest">
    
               <wsdlsoap:body use="literal"/>
    
            </wsdl:input>
    
            <wsdl:output name="getAgeResponse">
    
               <wsdlsoap:body use="literal"/>
    
            </wsdl:output>
    
         </wsdl:operation>
    
         <wsdl:operation name="fetchEmployeeDetails">
    
            <wsdlsoap:operation soapAction=""/>
    
            <wsdl:input name="fetchEmployeeDetailsRequest">
    
               <wsdlsoap:body use="literal"/>
    
            </wsdl:input>
    
            <wsdl:output name="fetchEmployeeDetailsResponse">
    
               <wsdlsoap:body use="literal"/>
    
            </wsdl:output>
    
         </wsdl:operation>
    
      </wsdl:binding>
    
      <wsdl:service name="WebService1Service">
    
         <wsdl:port binding="impl:WebService1SoapBinding" name="WebService1">
    
            <wsdlsoap:address location="http://localhost:8045/WebService1/services/WebService1"/>
    
         </wsdl:port>
    
      </wsdl:service>
    Please help. Ask if you want some specific information about the same.

    Regards,

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is online now Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,234
    Rep Power
    19

    Default Re: Null response object from Java Web Service

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    butny is offline Member
    Join Date
    Nov 2011
    Posts
    14
    Rep Power
    0

    Default Re: Null response object from Java Web Service

    Reason:

    I did not get any reply, hence thought of posting it in different forums.

    If you knw the reason, then can you please reply?

    Regards,

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,006
    Rep Power
    20

    Default Re: Null response object from Java Web Service

    What does your response look like?
    You should be able to get it from something like soap ui if you;re not already logging it.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    butny is offline Member
    Join Date
    Nov 2011
    Posts
    14
    Rep Power
    0

    Default Re: Null response object from Java Web Service

    Quote Originally Posted by Tolls View Post
    What does your response look like?
    You should be able to get it from something like soap ui if you;re not already logging it.
    The response is basically a model with some values. You can get the model details from the WSDL as well.

    Another thing to notice is like when i create the WSDL, the the _SEI file is not getting generate for my service, nor the _helper, _ser and _deser are getting generated for the model.

    Regards,

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,006
    Rep Power
    20

    Default Re: Null response object from Java Web Service

    I tend to go from WSDl to code, and not vice-versa.
    Anyway, when I asked what it looks like, I meant what it looks like.
    When you fire off your request what do you get back?
    You say you get a null response object, but I want to know what you see with soap ui.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  7. #7
    butny is offline Member
    Join Date
    Nov 2011
    Posts
    14
    Rep Power
    0

    Default Re: Null response object from Java Web Service

    Java Code:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
       <soapenv:Body>
          <fetchEmployeeDetailsResponse xmlns="http://service.com">
             <fetchEmployeeDetailsReturn>
                <age>0</age>
                <deptId>0</deptId>
                <empId>0</empId>
                <empName xsi:nil="true"/>
                <sex xsi:nil="true"/>
             </fetchEmployeeDetailsReturn>
          </fetchEmployeeDetailsResponse>
       </soapenv:Body>
    </soapenv:Envelope>
    This is what i am getting back in SOAP UI
    Last edited by butny; 09-03-2012 at 06:26 PM.

  8. #8
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,006
    Rep Power
    20

    Default Re: Null response object from Java Web Service

    So it's not a null response.
    There's data in there, coming from that service.
    If that data is wrong then I would be looking at the service and not the WSDL.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  9. #9
    butny is offline Member
    Join Date
    Nov 2011
    Posts
    14
    Rep Power
    0

    Default Re: Null response object from Java Web Service

    Hi,

    But that is not the expected data. What may be the problem?

    Regards,

  10. #10
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,006
    Rep Power
    20

    Default Re: Null response object from Java Web Service

    Something in your web service is populating the data incorrectly.
    Debug it.
    See where in the service it gets to.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  11. #11
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,006
    Rep Power
    20

    Default Re: Null response object from Java Web Service

    Quote Originally Posted by butny View Post
    Hi Bill/James,
    Pardon?
    Quote Originally Posted by butny View Post
    I got a clue but not sure why

    i have this piece of code for fetching the connection object:

    Java Code:
    public static Connection getConnection(){         
            try{  
                  
                Class.forName("oracle.jdbc.OracleDriver");  
                conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/orcl","userId","password");  
                System.out.println("Connected Successfully!!!");  
            }catch (Exception e) {  
                e.getMessage();  
            }  
            return conn;  
        }
    When i try to debug it using main method(as a POJO, then its working fine.

    But when i test it using SOAP UI, then the below line is throwing a NullPointerException i.e. the Connection object is having NULL values.

    Why is it like working when tested using POJO but not working when tested using SOAP UI? I have classes12.jar in my classpath.

    I dont have a answer for the same :(

    Please tell how to resolve this :(

    Regards,
    You never log the exception anywhere, because there *is* an exception.
    And then you continue happily on.
    Throw the Exception, since you cannot recover from it.
    It will then precolate back to your client and you can finally see what the problem is.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  12. #12
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,006
    Rep Power
    20

    Default Re: Null response object from Java Web Service

    Oh yes, and unless you are using Java 1.2 or 1.3 then you should really be using ojdbc4.jar against 10g.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  13. #13
    butny is offline Member
    Join Date
    Nov 2011
    Posts
    14
    Rep Power
    0

    Default Re: Null response object from Java Web Service

    The problem was with the connection with DB issue. I placed the jar file classes12.jar in the lib folder of WEB_INF and it worked for me. Anyways, moving forward i will take care of replacing the older jar with odbc4.jar

    I am not able to understand a few things:

    1) Why is there no _SEI, ser, deser and helper created (i asked in the previous post)

    2) what are the use of _SEI, ser, deser and helper files? In IBM RSA and WebSphere i can see these files (in that case I use the RPC approach, use the webservices.jar rather than using axis.jar). Is it like these generated files are needed for AXIS but not for IBM RPC?

    Totally confused with these two questions

    Please clear my confusion.

    Regards,

  14. #14
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,006
    Rep Power
    20

    Default Re: Null response object from Java Web Service

    No idea.
    They're not needed for a web service, or even JAXB, so I suspect it's some Axis thing or even server specific.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Replies: 2
    Last Post: 06-01-2011, 09:44 AM
  2. Null Pointer Exception in web service
    By sameerk in forum Web Frameworks
    Replies: 0
    Last Post: 05-11-2011, 05:39 AM
  3. Replies: 0
    Last Post: 04-07-2011, 03:09 PM
  4. not getting response from web service within time window
    By pankaj_salwan in forum Advanced Java
    Replies: 0
    Last Post: 09-21-2010, 05:48 AM
  5. Send object via web service, with a java.sql.Timestamp attribute
    By diegofsza in forum Enterprise JavaBeans (EJB)
    Replies: 0
    Last Post: 08-15-2009, 11:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •