2 Replies Latest reply on May 22, 2006 7:16 AM by thomas.diesler

    java.lang.NullPointerException

    deanhans

      Hi, I deployed web services well, but run client with wrong message:java.lang.NullPointerException

      wsdl file:
      <?xml version="1.0" encoding="UTF-8"?>

      <definitions name="TaxService" targetNamespace="http://tax.webservice.com/" xmlns:tns="http://tax.webservice.com/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">










      <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/>

      <soap:operation soapAction=""/>

      <soap:body use="literal" namespace="http://tax.webservice.com/"/>

      <soap:body use="literal" namespace="http://tax.webservice.com/"/>


      <soap:address location="REPLACE_WITH_ACTUAL_URL"/>

      client file:

      public class TaxClient{
      public static void main( String[] args ) throws Exception {
      try{
      String urlstr = "http://mypc:8080/TaxEJB/Tax?wsdl";

      System.out.println( "Contacting webservice at " + urlstr );

      URL url = new URL(urlstr);

      QName qName = new QName("http://tax.webservice.com/","TaxService");

      ServiceFactory factory = ServiceFactory.newInstance();
      Service service = factory.createService( url, qName );

      Tax proxy = ( Tax ) service.getPort(Tax.class );

      System.out.println( "output:" + proxy.calculateTax(5000d));

      }catch (Exception e){
      System.err.println(e.toString());
      }
      }
      }


      what's wrong with my code?

      thanks!

      Dean

        • 1. Re: java.lang.NullPointerException
          deanhans

          wsdl file:

          <?xml version="1.0" encoding="UTF-8"?>
          
          <definitions name="TaxService" targetNamespace="http://tax.webservice.com/" xmlns:tns="http://tax.webservice.com/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
           <types/>
           <message name="Tax_calculateTax">
           <part name="double_1" type="xsd:double"/></message>
           <message name="Tax_calculateTaxResponse">
           <part name="result" type="xsd:double"/></message>
           <portType name="Tax">
           <operation name="calculateTax" parameterOrder="double_1">
           <input message="tns:Tax_calculateTax"/>
           <output message="tns:Tax_calculateTaxResponse"/></operation></portType>
           <binding name="TaxBinding" type="tns:Tax">
           <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/>
           <operation name="calculateTax">
           <soap:operation soapAction=""/>
           <input>
           <soap:body use="literal" namespace="http://tax.webservice.com/"/></input>
           <output>
           <soap:body use="literal" namespace="http://tax.webservice.com/"/></output></operation></binding>
           <service name="TaxService">
           <port name="TaxPort" binding="tns:TaxBinding">
           <soap:address location="REPLACE_WITH_ACTUAL_URL"/></port></service></definitions>


          • 2. Re: java.lang.NullPointerException
            thomas.diesler

            What is the NPE stack trace?