NullPointer Calling iSeries Web Service

General discussion on Zend Core for IBM System i
Post Reply
sodonnell
Posts: 9
Joined: Wed Jun 10, 2009 8:49 pm

NullPointer Calling iSeries Web Service

Post by sodonnell » Wed Dec 30, 2009 7:22 pm

I am attempting to call an iSeries web service from PHP and I keep getting a Null Pointer exception error.

If I call this web serivce via SoapUI, it works fine, so I think I'm just not passing my variables correctly when calling it from PHP.

TheWSDL of the service is at the bottom of this message and I am calling the wgetcasn method. (there are two I could call but that's the the one I called for this test. Either works the same).

It contains one input variable (casenumber) and one output variable (casename). Both are character fields.


This is the PHP code I am using:

$casename="";
$casenum = "09CF405";

$client = new SoapClient( "http://MYURL:25001/GetCaseName/services ... vices.wsdl");

try
{
$casename = $client->wgetcasn($casenum);
}
catch (Exception $e)
{
echo "Exception is: ".$e;
}
echo "The case Name for case number 2009CF594 is: ".$casename;



The error I get is:


Exception is: SoapFault exception: [soapenv:Server.generalException] java.lang.NullPointerException in C:\wamp\www\APS\SimpleClientGetCaseName.php:12 Stack trace: #0 [internal function]: SoapClient->__call('wgetcasn', Array) #1 C:\wamp\www\APS\SimpleClientGetCaseName.php(12): SoapClient->wgetcasn('09CF405') #2 {main}The case Name for case number 2009CF594 is:

Can somone suggest a possible solution for this?

Thanks!


WSDL Code:

<?xml version="1.0" encoding="UTF-8" ?>
- <wsdl:definitions targetNamespace="http://wGETCASN" xmlns:impl="http://wGETCASN" xmlns:intf="http://wGETCASN" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <wsdl:types>
- <schema targetNamespace="http://wGETCASN" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <complexType name="WGETCASNInput">
- <sequence>
<element name="INCASE" nillable="true" type="xsd:string" />
</sequence>
</complexType>
- <element name="wgetcasnResponse">
- <complexType>
- <sequence>
<element name="wgetcasnReturn" nillable="true" type="impl:WGETCASNResult" />
</sequence>
</complexType>
</element>
- <element name="wgetcasn_XML">
- <complexType>
- <sequence>
<element name="inputData" nillable="true" type="impl:WGETCASNInput" />
</sequence>
</complexType>
</element>
- <element name="wgetcasn_XMLResponse">
- <complexType>
- <sequence>
<element name="wgetcasn_XMLReturn" nillable="true" type="xsd:string" />
</sequence>
</complexType>
</element>
- <element name="wgetcasn">
- <complexType>
- <sequence>
<element name="inputData" nillable="true" type="impl:WGETCASNInput" />
</sequence>
</complexType>
</element>
- <complexType name="WGETCASNResult">
- <sequence>
<element name="OUTNAME" nillable="true" type="xsd:string" />
</sequence>
</complexType>
</schema>
</wsdl:types>
- <wsdl:message name="wgetcasnResponse">
<wsdl:part element="impl:wgetcasnResponse" name="parameters" />
</wsdl:message>
- <wsdl:message name="wgetcasn_XMLRequest">
<wsdl:part element="impl:wgetcasn_XML" name="parameters" />
</wsdl:message>
- <wsdl:message name="wgetcasn_XMLResponse">
<wsdl:part element="impl:wgetcasn_XMLResponse" name="parameters" />
</wsdl:message>
- <wsdl:message name="wgetcasnRequest">
<wsdl:part element="impl:wgetcasn" name="parameters" />
</wsdl:message>
- <wsdl:portType name="WGETCASNServices">
- <wsdl:operation name="wgetcasn">
<wsdl:input message="impl:wgetcasnRequest" name="wgetcasnRequest" />
<wsdl:output message="impl:wgetcasnResponse" name="wgetcasnResponse" />
</wsdl:operation>
- <wsdl:operation name="wgetcasn_XML">
<wsdl:input message="impl:wgetcasn_XMLRequest" name="wgetcasn_XMLRequest" />
<wsdl:output message="impl:wgetcasn_XMLResponse" name="wgetcasn_XMLResponse" />
</wsdl:operation>
</wsdl:portType>
- <wsdl:binding name="WGETCASNServicesSoapBinding" type="impl:WGETCASNServices">
<wsaw:UsingAddressing wsdl:required="false" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" />
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="wgetcasn">
<wsdlsoap:operation soapAction="wgetcasn" />
- <wsdl:input name="wgetcasnRequest">
<wsdlsoap:body use="literal" />
</wsdl:input>
- <wsdl:output name="wgetcasnResponse">
<wsdlsoap:body use="literal" />
</wsdl:output>
</wsdl:operation>
- <wsdl:operation name="wgetcasn_XML">
<wsdlsoap:operation soapAction="wgetcasn_XML" />
- <wsdl:input name="wgetcasn_XMLRequest">
<wsdlsoap:body use="literal" />
</wsdl:input>
- <wsdl:output name="wgetcasn_XMLResponse">
<wsdlsoap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <wsdl:service name="WGETCASNServicesService">
- <wsdl:port binding="impl:WGETCASNServicesSoapBinding" name="WGETCASNServices">
<wsdlsoap:address location="http://MYURL:25001/GetCaseName/services ... SNServices" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

dabbeer
Posts: 1
Joined: Fri Jan 22, 2010 9:14 pm

Re: NullPointer Calling iSeries Web Service

Post by dabbeer » Fri Jan 22, 2010 9:34 pm

I was having the same issue thanks to Jon Paris I solved it by making the input $casenum(in your code) an array

Post Reply