【问题标题】:how to fix php soapclient null value如何修复php soapclient空值
【发布时间】:2013-07-24 23:33:11
【问题描述】:

如果我使用soap-ui我可以获取数据,但我需要使用php soapclient并且它没有获取数据。

soap-ui 上的输出

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://webservice.bc/Interaction">
   <SOAP-ENV:Body>
      <ns1:QueryInteractionResponse>
         <productWarningArray>
            <ProductWarning>
               <Product>
                  <id>10008</id>
               </Product>
               <Color>
                  <id>4</id>
               </Color>
               <Value>Besinler, asetilsalisilik asitin emilimini yavaşlatır. Hızlı analjezi gerekliyse besinlerle birlikte verilmemelidir. Uzun süreli asetilsalisilik asit kullanımında, besinler, mide mukozasını korumaya yardımcı olur.</Value>
            </ProductWarning>
            <ProductWarning>
               <Product>
                  <id>10008</id>
               </Product>
               <Color>
                  <id>4</id>
               </Color>
               <Value>Besinler, psödoefedrinin emilimini yavaşlatır.</Value>
            </ProductWarning>
            <ProductWarning>
               <Product>
                  <id>2322</id>
               </Product>
               <Color>
                  <id>1</id>
               </Color>
               <Value>Besinler sildenafil absorbsiyonunu geciktirir.</Value>
            </ProductWarning>
         </productWarningArray>
      </ns1:QueryInteractionResponse>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

这是真的……

<Value>Besinler, asetilsalisilik asitin emilimini yavaşlatır. Hızlı analjezi gerekliyse besinlerle birlikte verilmemelidir. Uzun süreli asetilsalisilik asit kullanımında, besinler, mide mukozasını korumaya yardımcı olur.</Value>

但是当我使用 php soapclient 时

$client = new SoapClient("http://webservice.bc/web.wsdl", array(
                        'exceptions'=>true,
                        'cache_wsdl'=>WSDL_CACHE_NONE,
                        'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 5,
                        'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
                        'encoding'=>' utf-8'
                    //  'features' => SOAP_SINGLE_ELEMENT_ARRAYS

                ));
                $result = $client->QueryInteraction($requestData);
                echo "<pre>";
                print_r($result);

它没有得到价值......

Array
(
    [productWarningArray] => stdClass Object
        (
            [ProductWarning] => Array
                (
                    [0] => stdClass Object
                        (
                            [Product] => stdClass Object
                                (
                                    [id] => 10008
                                )

                            [Color] => stdClass Object
                                (
                                    [id] => 4
                                )

                            [Value] => stdClass Object
                                (
                                )

                        )

                    [1] => stdClass Object
                        (
                            [Product] => stdClass Object
                                (
                                    [id] => 10008
                                )

                            [Color] => stdClass Object
                                (
                                    [id] => 4
                                )

                            [Value] => stdClass Object
                                (
                                )

                        )

                    [2] => stdClass Object
                        (
                            [Product] => stdClass Object
                                (
                                    [id] => 2322
                                )

                            [Color] => stdClass Object
                                (
                                    [id] => 1
                                )

                            [Value] => stdClass Object
                                (
                                )

                        )

                )

        )

)

它为空...

[Value] => stdClass Object
                            (
                            )

我该如何解决这个问题?

谢谢...

【问题讨论】:

    标签: php soap soapui soap-client


    【解决方案1】:

    已解决:)

    将值元素类型段落更改为字符串时,soap 服务器端的问题已解决。

    <complexType name="ProductInteraction" >
                <sequence >
                    <element name="Product"
                            type="self:Product" />
    
                    <element name="Color"
                            type="self:Color" />
    
                    <element name="Value"
                            type="self:Paragraph" />
    
                </sequence>
            </complexType>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-02-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-04
      • 2010-09-29
      相关资源
      最近更新 更多