SOAP :: WSDL返回错误不能使用未定义的值作为ARRAY引用

时间:2019-11-01 18:22:48

标签: perl soap wsdl

我有一个访问肥皂服务器的perl程序。通过SoapUI测试肥皂服务器时,它可以工作,但是使用我的Perl程序时,我得到

不能在/Library/Perl/5.18/SOAP/WSDL.pm第222行使用未定义的值作为ARRAY引用。

这是我的perl脚本。

use SOAP::WSDL;

my $data = 'some data here';

$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;

my $client = SOAP::WSDL->new( 'wsdl' => "link_to_wsdl" );
my $result = $client->call('MyMethod', $data);

use Data::Dumper;
print Dumper($result);

这是WSDL

<?xml version="1.0"?>
<wsdl:definitions 
    name="Test"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:tns="urn:APISoapServer"
    targetNamespace="urn:APISoapServer"
> 
  <wsdl:types>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      targetNamespace="urn:APISoapServer">
      <xsd:element name="MyMethod">
        <xsd:complexType>
          <xsd:complexContent mixed="true">
            <xsd:restriction base="xsd:anyType">
              <xsd:sequence>
                <xsd:element name="operand1" type="xsd:string" maxOccurs="unbounded"/>
              </xsd:sequence>
            </xsd:restriction>
          </xsd:complexContent>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="MyMethodResponse">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="Confirmation" maxOccurs="unbounded">
              <xsd:complexType>
                <xsd:complexContent>
                  <xsd:restriction base="xsd:anyType">
                    <xsd:attribute name="response" type="xsd:string"/>
                  </xsd:restriction>
                </xsd:complexContent>
              </xsd:complexType>
            </xsd:element>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
    </xsd:schema>
  </wsdl:types>      

  <wsdl:message name="MYAPIRequest">
    <wsdl:part name="MYAPIRequestPart" element="tns:MyMethod"/>
  </wsdl:message>
  <wsdl:message name="MYAPIResponse">
    <wsdl:part name="MYAPIResponsePart" element="tns:MyMethodResponse"/>
  </wsdl:message>

  <wsdl:portType name="MYAPIServerPort">
    <wsdl:operation name="MyMethod">
      <wsdl:input name="MyMethodInput" message="tns:MYAPIRequest"/>
      <wsdl:output name="MyMethodOutput" message="tns:MYAPIResponse"/>
    </wsdl:operation>
  </wsdl:portType>

  <wsdl:binding name="MYAPIServerBinding" type="tns:MYAPIServerPort">
    <soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="MyMethod">
      <soap12:operation style="document" soapAction="urn:APISoapServer#MyMethod" />
      <wsdl:input name="MyMethodInput">
        <soap12:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="MyMethodOutput">
        <soap12:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>

  <wsdl:service name="MYAPIService">
    <wsdl:port name="MYAPIPort" binding="tns:MYAPIServerBinding">
      <soap12:address location="https://my.site.com/api/my_api_server.pl"/>
    </wsdl:port>
  </wsdl:service>

</wsdl:definitions>

0 个答案:

没有答案