Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/276.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用PHP使用Java web服务时获取NullPointerException_Php_Web Services_Jax Ws - Fatal编程技术网

使用PHP使用Java web服务时获取NullPointerException

使用PHP使用Java web服务时获取NullPointerException,php,web-services,jax-ws,Php,Web Services,Jax Ws,尝试使用PHP使用Java web服务时,我遇到以下错误:Java.lang.NullPointerException 我想。但是,这个链接在我的例子中不起作用(提供stdClass对象) 下面是WSDL的相关部分 ... <message name="queryByPartyId"> <part name="parameters" element="tns:queryByPartyId"/> </message> ... <operation

尝试使用PHP使用Java web服务时,我遇到以下错误:
Java.lang.NullPointerException

我想。但是,这个链接在我的例子中不起作用(提供stdClass对象)

下面是WSDL的相关部分

...
<message name="queryByPartyId">
    <part name="parameters" element="tns:queryByPartyId"/>
</message>
...
<operation name="queryByPartyId">
    <soap:operation soapAction=""/>
    <input><soap:body use="literal"/></input>
    <output><soap:body use="literal"/></output>
    <fault name="ServiceFault"><soap:fault name="ServiceFault" use="literal"/></fault>
</operation>
$theResponse
的格式化转储:

object(SoapFault)#9 (10) { 
    ["message":protected]=> string(30) "java.lang.NullPointerException" 
    ["string":"Exception":private]=> string(0) "" 
    ["code":protected]=> int(0) 
    ["file":protected]=> string(51) "/path/to/index.php" 
    ["line":protected]=> int(82) 
    ["trace":"Exception":private]=> array(2) { 
        [0]=> array(6) { 
            ["file"]=> string(51) "/path/to/index.php" 
            ["line"]=> int(82) 
            ["function"]=> string(6) "__call" 
            ["class"]=> string(10) "SoapClient" 
            ["type"]=> string(2) "->" 
            ["args"]=> array(2) { 
                [0]=> string(14) "queryByPartyId" 
                [1]=> array(1) { 
                    [0]=> array(1) { 
                        ["queryByPartyId"]=> int(12345) 
                    } 
                } 
            } 
        } 
        [1]=> array(6) { 
            ["file"]=> string(51) "/path/to/index.php" 
            ["line"]=> int(82) 
            ["function"]=> string(14) "queryByPartyId" 
            ["class"]=> string(10) "SoapClient" 
            ["type"]=> string(2) "->" 
            ["args"]=> array(1) { 
                [0]=> array(1) { 
                    ["queryByPartyId"]=> int(12345) 
                } 
            } 
        } 
    } 
    ["previous":"Exception":private]=> NULL 
    ["faultstring"]=> string(30) "java.lang.NullPointerException" 
    ["faultcode"]=> string(8) "S:Server" 
    ["detail"]=> object(stdClass)#6 (1) { 
        ["exception"]=> object(stdClass)#7 (1) { 
            ["stackTrace"]=> object(stdClass)#8 (1) { 
                ["frame"]=> array(40) { 
                    [0]=> string(0) "" 
                    [1]=> string(0) "" 
                    [2]=> string(0) "" 
                    [3]=> string(0) "" 
                    [4]=> string(0) "" 
                    [5]=> string(0) "" 
                    [6]=> string(0) "" 
                    [7]=> string(0) "" 
                    [8]=> string(0) "" 
                    [9]=> string(0) "" 
                    [10]=> string(0) "" 
                    [11]=> string(0) "" 
                    [12]=> string(0) "" 
                    [13]=> string(0) "" 
                    [14]=> string(0) "" 
                    [15]=> string(0) "" 
                    [16]=> string(0) "" 
                    [17]=> string(0) "" 
                    [18]=> string(0) "" 
                    [19]=> string(0) "" 
                    [20]=> string(0) "" 
                    [21]=> string(0) "" 
                    [22]=> string(0) "" 
                    [23]=> string(0) "" 
                    [24]=> string(0) "" 
                    [25]=> string(0) "" 
                    [26]=> string(0) "" 
                    [27]=> string(0) "" 
                    [28]=> string(0) "" 
                    [29]=> string(0) "" 
                    [30]=> string(0) "" 
                    [31]=> string(0) ""
                    [33]=> string(0) ""
                    [35]=> string(0) "" 
                    [36]=> string(0) "" 
                    [37]=> string(0) "" 
                    [38]=> string(0) "" 
                    [39]=> string(0) "" 
                } 
            } 
        } 
    } 
} 
更新#1

WSDL注释:
由JAX-WSRI在http://jax-ws.dev.java.net. RI的版本是JAX-WSRI 2.1.7-b01-

更新#2

在WSDL中未找到元素标记,但存在架构位置。加载时,找到以下元素标记

<xs:complexType name="queryByPartyId">
    <xs:sequence>
        <xs:element name="queryByPartyIdInMsg" type="tns:queryByPartyIdInMessage" minOccurs="0"/>
    </xs:sequence>
</xs:complexType>
<xs:complexType name="queryByPartyIdInMessage">
    <xs:sequence>
        <xs:element name="partyId" type="xs:string" minOccurs="0"/>
    </xs:sequence>
</xs:complexType>

找到元素结构后,.

再看一看wsdl文件,在其中的某个地方,您将看到如下内容:

<element name="queryByPartyId">
    <complexType>
        <element name="foobar" type="foo:int"/>
    </complexType>
</element>
wsdl还应包含服务将返回的内容的描述:

<element name="queryByPartyIdResponse">
    <complexType>
        <element name="PartyReturn" type="xs:SomeType" />
    </complexType>
</element>

或者,您可能需要将
querypartyidinmsg
子数组包装到另一个数组中,因为这两个复杂类型的minOccurs都是0(表示数组)

再看一下wsdl文件,在其中的某个地方,您会看到类似这样的内容:

<element name="queryByPartyId">
    <complexType>
        <element name="foobar" type="foo:int"/>
    </complexType>
</element>
wsdl还应包含服务将返回的内容的描述:

<element name="queryByPartyIdResponse">
    <complexType>
        <element name="PartyReturn" type="xs:SomeType" />
    </complexType>
</element>

或者,您可能需要将
querypartyidinmsg
子数组包装到另一个数组中,因为这两个复杂类型的最小值都是0(建议使用数组)

您是否能够使用soap客户端(那些现成的测试一次)@devzero我知道我们的另一个应用程序,在.Net中,正在无任何问题地访问此web服务。我将尽快研究使用另一个SOAP客户端进行测试。您是否能够使用SOAP客户端成功执行调用(那些现成的测试一次)@devzero我知道我们的另一个应用程序,在.Net中,正在访问此web服务,没有任何问题。我将尽快使用另一个SOAP客户端进行测试。请参阅更新2,找到您也在暗示的信息(直到架构位置)…请参阅更新2,找到您也在暗示的信息(直到架构位置)。。。
<element name="queryByPartyIdResponse">
    <complexType>
        <element name="PartyReturn" type="xs:SomeType" />
    </complexType>
</element>
$response = $soapClient->queryByPartyId(
    array('queryByPartyIdInMsg' => array('PartyId' => 123456))
);