小编Ama*_*ams的帖子

WSDL PHP函数返回null,而其他函数返回预期结果

摘要

在这里,我将列出我为解决这个问题而采取的所有步骤,作为其他人的参考.

PHP,愚蠢地,"监听"函数的输入消息,以定义它应该使用的函数.因此,即使它使用相同的类型或元素,也要为每个函数提供不同的输入消息.您可能认为这对您来说很有帮助,但可以这样做:

<xsi:complexType name="UserCredentials">
<xsi:attribute name="customerID" type="xsi:int"/>
</xsi:complexType>

<xsi:element name="UserCredentials" type="types:UserCredentials"/>
<xsi:element name="UserCredentials1" type="types:UserCredentials"/>

<wsdl:message name="getCustomerCredentials">
 <wsdl:part name="body" element="types:UserCredentials"/>
</wsdl:message>
<wsdl:message name="getCustomerCredentials1">
<wsdl:part name="body" element="types:UserCredentials1"/>
</wsdl:message>
Run Code Online (Sandbox Code Playgroud)

接下来,Visual Studio抱怨,我花了几天时间想出这个愚蠢的愚蠢的简单的事情,只需告诉程序你刚刚设置了对象属性:

 UserCredentials.customerID = User.CustomerID;
 UserCredentials.customerIDSpecified = true;
Run Code Online (Sandbox Code Playgroud)

就是这样.我自己也不敢相信.我花了1.5周,解决方案是两个步骤,请给这个在下面回答一些票的人.

更新

我的输入对象不会开始解析为XML.

//固定:

您必须告诉程序该属性设置如下:

UserCredentials.customerID = User.CustomerID;
UserCredentials.customerIDSpecified = true;
Run Code Online (Sandbox Code Playgroud)

提琴手说明了这一点:

输入

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<UserCredentials2 xmlns="http://5.157.80.21/servicehandler/wsdl_service.wsdl"/>   
</s:Body>
</s:Envelope>
Run Code Online (Sandbox Code Playgroud)

产量

<?xml version="1.0" encoding="UTF-8"?> 
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="types">
<SOAP-ENV:Body>
<ns1:PersoonArray/>
</SOAP-ENV:Body>
</SOAP-ENV:E??nvelope>
Run Code Online (Sandbox Code Playgroud)

这段代码有问题吗?

    public static List<Klant> GetAllPersonen()
    {
        List<Klant> list = new List<Klant>();

        WeGotchaService.Persoon[] …
Run Code Online (Sandbox Code Playgroud)

php null soap wsdl

12
推荐指数
1
解决办法
2484
查看次数

标签 统计

null ×1

php ×1

soap ×1

wsdl ×1