svilla 17 Junior Poster in Training

I have a Web Service I setup on the iSeries. It works when using SOAPUI and it works from the Built in test facility in the Native Web server. But when I try to access it form the following PHP program it fails to return any data. I am obviously fairly new to this and I am not sure what I am missing.

<?php
echo 'Start of Soap Request<br />';
$client = new SoapClient("http://iseriesdev.wdm.int:10010/web/services/getItemDesc?wsdl");
print_r($client);
echo '<br />Start of Var_Dump<br />';
var_dump($client);
echo '<br />Result Print<br />';
$result = $client->testws(array("PEITEM" => "1020000000", "PEMSG" =>" "));
print_r($result);

?>

That accesses a web service on my iSeries. I can get the Web Service to work in SOAP UI, but for some reason it does not work when called from this very short program. I seem to be missing something. I have tried to look at the error logs on the iSeries, but all I have been able to find is a Null Pointer Error:

[ERROR] Exception occurred while trying to invoke service method testws
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:600)
    at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:256)
    at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:117)
    at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
    at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:114)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:201)
    at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:176)
    at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:163)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1661)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:937)
    at com.ibm.pvc.internal.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:85)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:500)
    at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:91)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:864)
    at com.ibm.wsspi.webcontainer.WebContainer.handleRequest(WebContainer.java:95)
    at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:54)
    at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:457)
    at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:360)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:632)
Caused by: java.lang.NullPointerException
    at iseries.wsbeans.getitemdesc.GetItemDescServices.testws(GetItemDescServices.java:34)
    ... 24 more

When installing a web service on the iSeries it automatically generates the WSDL. Here is the WSDL that was generated by the iSeries.

Again it works when testing with SOAPUI so hopefully it is an option or something I can use on the SoapClient instantiation.

<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:ns="http://getitemdesc.wsbeans.iseries/xsd" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:tns="http://getitemdesc.wsbeans.iseries" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://getitemdesc.wsbeans.iseries">
    <wsdl:documentation>getItemDesc</wsdl:documentation>
    <wsdl:types>
        <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://getitemdesc.wsbeans.iseries/xsd">
            <xs:element name="testws_XML">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element minOccurs="0" name="args0" nillable="true" type="ns:TESTWSInput"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:complexType name="TESTWSInput">
                <xs:sequence>
                    <xs:element minOccurs="0" name="PEITEM" nillable="true" type="xs:string"/>
                    <xs:element minOccurs="0" name="PEMSG" nillable="true" type="xs:string"/>
                </xs:sequence>
            </xs:complexType>
            <xs:element name="testws_XMLResponse">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="testws">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element minOccurs="0" name="args0" nillable="true" type="ns:TESTWSInput"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="testwsResponse">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element minOccurs="0" name="return" nillable="true" type="ns:TESTWSResult"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:complexType name="TESTWSResult">
                <xs:sequence>
                    <xs:element minOccurs="0" name="PEMSG" nillable="true" type="xs:string"/>
                </xs:sequence>
            </xs:complexType>
        </xs:schema>
    </wsdl:types>
    <wsdl:message name="testwsRequest">
        <wsdl:part name="parameters" element="ns:testws"/>
    </wsdl:message>
    <wsdl:message name="testwsResponse">
        <wsdl:part name="parameters" element="ns:testwsResponse"/>
    </wsdl:message>
    <wsdl:message name="testws_XMLRequest">
        <wsdl:part name="parameters" element="ns:testws_XML"/>
    </wsdl:message>
    <wsdl:message name="testws_XMLResponse">
        <wsdl:part name="parameters" element="ns:testws_XMLResponse"/>
    </wsdl:message>
    <wsdl:portType name="getItemDescPortType">
        <wsdl:operation name="testws">
            <wsdl:input message="tns:testwsRequest" wsaw:Action="urn:testws"/>
            <wsdl:output message="tns:testwsResponse" wsaw:Action="urn:testwsResponse"/>
        </wsdl:operation>
        <wsdl:operation name="testws_XML">
            <wsdl:input message="tns:testws_XMLRequest" wsaw:Action="urn:testws_XML"/>
            <wsdl:output message="tns:testws_XMLResponse" wsaw:Action="urn:testws_XMLResponse"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="getItemDescSoap11Binding" type="tns:getItemDescPortType">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
        <wsdl:operation name="testws">
            <soap:operation soapAction="urn:testws" style="document"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="testws_XML">
            <soap:operation soapAction="urn:testws_XML" style="document"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="getItemDesc">
        <wsdl:port name="getItemDescHttpSoap11Endpoint" binding="tns:getItemDescSoap11Binding">
            <soap:address location="http://ISERIESDEV.WDM.INT:10010/web/services/getItemDesc.getItemDescHttpSoap11Endpoint/"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.