0

I have this PHP program:

<?php
echo 'Start of Soap Request<br />';
$client = new SoapClient("http://192.168.201.67: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 access 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

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>

If you made it this far, thanks for looking.

2
Contributors
1
Reply
5
Views
5 Years
Discussion Span
Last Post by maba001
0

Hello svilla,

at least there is nothing obvious. First of all, I would try to omit the second argument. Unfortunatly a "Null pointer exception" in the Java stack dump is not giving a real hint.

In a second step you might want to consider adding some options to the SOAPClient constructor (like SOAP version or encoding, although both of them are unlikely to solve the problem).

In a third step I would try the whole thing in NON-WSDL mode. Just put the plain URL into the attributes of parameter 2 of the constructor and put Null into parameter 1.

Edited by maba001: Be a little more specific

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.