dongzhuo1930 2019-07-16 21:07
浏览 189

通过Soap WSDL发送数组的问题 - PHP

I have problem with send SOAP query. For some reason my code [numerNadania] isn't good. I guess it's some problem with structure.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:e=http://e-nadawca.poczta-polska.pl 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Header/>
    <soapenv:Body>
        <e:addReklamacje>
            <reklamowanaPrzesylka 
            dataNadania="2018-05-22" 
            urzadNadania="260578" 
            powodReklamacjiOpis="TEST TEST TEST" 
odszkodowanie="0" oplata="0" oczekiwaneOdszkodowanie="0">
                <przesylka 
                    guid="262A34BA2C1111116237B659B312F5EB" 
                    numerNadania="00159007738099827991"
                    opis="TEST" 
                    planowanaDataNadania="2018-05-22"
                    xsi:type="e:przesylkaBiznesowaType"/>
            <powodReklamacji 
idPowodGlowny="4" 
powodGlownyOpis="TEST TEST TEST">
                    <powodSzczegolowy 
idPowodSzczegolowy="9" powodSzczegolowyOpis="TEST TEST TEST"/>
            </powodReklamacji>
            </reklamowanaPrzesylka>
        </e:addReklamacje>
    </soapenv:Body>
</soapev:Envelope>
    $options["login"] = "***";
    $options["password"] = "***";
    $options["soap_version"] = SOAP_1_2;

    $wsdl = 'en.wsdl';

    try {
        $client = new SoapClient($wsdl,$options);
    }

    catch(Throwable $e) {
        echo 'Wystąpił problem z połączniem API';
    }

    $params = array(
        'reklamowanaPrzesylka' => array (
            'przesylka' => array (
                'guid' => getGuid(),
                'numerNadania' => $id,
            ),
            'powodReklamacji' => "Czas dostawy",
        )
    );

    $problem = $client->addReklamacje($params);
stdClass Object ( [errorNumber] => 13250 [errorDesc] => Numer nadania dla składanych reklamacji jest wymagany [guid] => F8CF816CDF4DD8151116C0EE340C4031 )

Numer nadania dla składanych reklamacji jest wymagany - Send number is required [TRANSLATE]

  • 写回答

1条回答 默认 最新

  • duanjiancong4860 2019-07-16 21:45
    关注

    In the past i have been using wsdl2php converters to create client code that resolves most of this type of issues.

    See this one for example: https://github.com/rquadling/wsdl2php

    They all work pretty much the same, you need to provide ?wsdl endpoint, run script and it will produce client code and output it in to file. Than you can include file and use generated classes and methods.

    Hope this helps.

    评论

报告相同问题?

悬赏问题

  • ¥15 WPF 大屏看板表格背景图片设置
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示