0

我正在测试对 XML 存档的访问,但没有成功。你能帮帮我吗?

第一个存档:

<?php

include 'traffic.php';

$xmlstr = utf8_encode(file_get_contents('traffic.xml'));

$client = new SimpleXMLElement($xmlstr);

$maplink_key_soap = 'ymUFb0RjwnO6N1zXGKpFauF1vwLPTLvrGLSvaBVybCBPTM9qGBu9QR==';

class City {
    var $name = 'São Paulo';
    var $state = 'SP';
}

class Address {
    var $street = 'Funchal';
    var $district = '129' ;
    var $houseNumber;
    var $zip;
    var $city;

    public function __construct() {
        $this->city = new City();
    }
}

class ResultRange {
    var $pageIndex = 1;
    var $recordsPerPage = 10;
}

//Classe AddressOptions
class ao{
    var $matchType = 0;
    var $searchType = 2;
    var $usePhonetic = true;
    var $resultRange;

    public function __construct() {
        $this->resultRange = new ResultRange();
    }

}

$address = new Address();
$city = new City();
$ao = new ao();
$resultRange = new ResultRange();

$result = $client->findAddress(array('token' => $maplink_key_soap, 'address' => $address, 'ao' => $ao));

echo '<pre style=”clear:both;”&gt;'; print_r($result); echo '</pre>';?>

第二个存档:

    <?php 
$xmlstr = <<<XML
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns = "http://services.maplink.com.br/webservices/v3/AddressFinder/AddressFinder.asmx?wsdl" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://webservices.maplink2.com.br" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace="http://webservices.maplink2.com.br" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <wsdl:types>
    <s:schema elementFormDefault="qualified" targetNamespace="http://webservices.maplink2.com.br">
      <s:element name="findPOI">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="name" type="s:string" />
            <s:element minOccurs="1" maxOccurs="1" name="city" type="tns:City" />
            <s:element minOccurs="1" maxOccurs="1" name="resultRange" type="tns:ResultRange" />
            <s:element minOccurs="0" maxOccurs="1" name="token" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:complexType name="City">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="1" name="name" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="state" type="s:string" />
        </s:sequence>
      </s:complexType>
      <s:complexType name="ResultRange">
        <s:sequence>
          <s:element minOccurs="1" maxOccurs="1" name="pageIndex" type="s:int" />
          <s:element minOccurs="1" maxOccurs="1" name="recordsPerPage" type="s:int" />
        </s:sequence>
      </s:complexType>
      <s:element name="findPOIResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="1" name="findPOIResult" type="tns:POIInfo" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:complexType name="POIInfo">
        <s:sequence>
          <s:element minOccurs="1" maxOccurs="1" name="recordCount" type="s:int" />
          <s:element minOccurs="1" maxOccurs="1" name="pageCount" type="s:int" />
          <s:element minOccurs="0" maxOccurs="1" name="poiLocations" type="tns:ArrayOfPOILocation" />
        </s:sequence>
      </s:complexType>
      <s:complexType name="ArrayOfPOILocation">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="unbounded" name="POILocation" type="tns:POILocation" />
        </s:sequence>
      </s:complexType>
      <s:complexType name="POILocation">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="1" name="name" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="district" type="s:string" />
          <s:element minOccurs="1" maxOccurs="1" name="carAccess" type="s:boolean" />
          <s:element minOccurs="0" maxOccurs="1" name="dataSource" type="s:string" />
          <s:element minOccurs="1" maxOccurs="1" name="city" type="tns:City" />
          <s:element minOccurs="1" maxOccurs="1" name="point" type="tns:Point" />
        </s:sequence>
      </s:complexType>
      <s:complexType name="Point">
        <s:sequence>
          <s:element minOccurs="1" maxOccurs="1" name="x" type="s:double" />
          <s:element minOccurs="1" maxOccurs="1" name="y" type="s:double" />
        </s:sequence>
      </s:complexType>
      <s:element name="findAddress">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="1" name="address" type="tns:Address" />
            <s:element minOccurs="1" maxOccurs="1" name="ao" type="tns:AddressOptions" />
            <s:element minOccurs="0" maxOccurs="1" name="token" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:complexType name="Address">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="1" name="street" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="houseNumber" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="zip" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="district" type="s:string" />
          <s:element minOccurs="1" maxOccurs="1" name="city" type="tns:City" />
        </s:sequence>
      </s:complexType>
      <s:complexType name="AddressOptions">
        <s:sequence>
          <s:element minOccurs="1" maxOccurs="1" name="matchType" type="s:int" />
          <s:element minOccurs="1" maxOccurs="1" name="usePhonetic" type="s:boolean" />
          <s:element minOccurs="1" maxOccurs="1" name="searchType" type="s:int" />
          <s:element minOccurs="1" maxOccurs="1" name="resultRange" type="tns:ResultRange" />
        </s:sequence>
      </s:complexType>
      <s:element name="findAddressResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="1" name="findAddressResult" type="tns:AddressInfo" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:complexType name="AddressInfo">
        <s:sequence>
          <s:element minOccurs="1" maxOccurs="1" name="recordCount" type="s:int" />
          <s:element minOccurs="1" maxOccurs="1" name="pageCount" type="s:int" />
          <s:element minOccurs="0" maxOccurs="1" name="addressLocation" type="tns:ArrayOfAddressLocation" />
        </s:sequence>
      </s:complexType>
      <s:complexType name="ArrayOfAddressLocation">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="unbounded" name="AddressLocation" type="tns:AddressLocation" />
        </s:sequence>
      </s:complexType>
      <s:complexType name="AddressLocation">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="1" name="key" type="s:string" />
          <s:element minOccurs="1" maxOccurs="1" name="address" type="tns:Address" />
          <s:element minOccurs="0" maxOccurs="1" name="zipL" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="zipR" type="s:string" />
          <s:element minOccurs="1" maxOccurs="1" name="carAccess" type="s:boolean" />
          <s:element minOccurs="0" maxOccurs="1" name="dataSource" type="s:string" />
          <s:element minOccurs="1" maxOccurs="1" name="point" type="tns:Point" />
        </s:sequence>
      </s:complexType>
      <s:element name="getAddress">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="1" name="point" type="tns:Point" />
            <s:element minOccurs="0" maxOccurs="1" name="token" type="s:string" />
            <s:element minOccurs="1" maxOccurs="1" name="tolerance" type="s:double" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="getAddressResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="1" name="getAddressResult" type="tns:AddressLocation" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="getXY">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="1" name="address" type="tns:Address" />
            <s:element minOccurs="0" maxOccurs="1" name="token" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="getXYResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="1" name="getXYResult" type="tns:Point" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="getXYRadiusWithMap">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="1" name="address" type="tns:Address" />
            <s:element minOccurs="1" maxOccurs="1" name="mo" type="tns:MapOptions" />
            <s:element minOccurs="1" maxOccurs="1" name="radius" type="s:int" />
            <s:element minOccurs="0" maxOccurs="1" name="token" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:complexType name="MapOptions">
        <s:sequence>
          <s:element minOccurs="1" maxOccurs="1" name="scaleBar" type="s:boolean" />
          <s:element minOccurs="1" maxOccurs="1" name="mapSize" type="tns:MapSize" />
        </s:sequence>
      </s:complexType>
      <s:complexType name="MapSize">
        <s:sequence>
          <s:element minOccurs="1" maxOccurs="1" name="width" type="s:int" />
          <s:element minOccurs="1" maxOccurs="1" name="height" type="s:int" />
        </s:sequence>
      </s:complexType>
      <s:element name="getXYRadiusWithMapResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="1" name="getXYRadiusWithMapResult" type="tns:MapInfo" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:complexType name="MapInfo">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="1" name="url" type="s:string" />
          <s:element minOccurs="1" maxOccurs="1" name="extent" type="tns:Extent" />
        </s:sequence>
      </s:complexType>
      <s:complexType name="Extent">
        <s:sequence>
          <s:element minOccurs="1" maxOccurs="1" name="XMin" type="s:double" />
          <s:element minOccurs="1" maxOccurs="1" name="YMin" type="s:double" />
          <s:element minOccurs="1" maxOccurs="1" name="XMax" type="s:double" />
          <s:element minOccurs="1" maxOccurs="1" name="YMax" type="s:double" />
        </s:sequence>
      </s:complexType>
      <s:element name="findCity">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="1" name="cidade" type="tns:City" />
            <s:element minOccurs="1" maxOccurs="1" name="ao" type="tns:AddressOptions" />
            <s:element minOccurs="0" maxOccurs="1" name="token" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="findCityResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="1" name="findCityResult" type="tns:CityLocationInfo" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:complexType name="CityLocationInfo">
        <s:sequence>
          <s:element minOccurs="1" maxOccurs="1" name="recordCount" type="s:int" />
          <s:element minOccurs="1" maxOccurs="1" name="pageCount" type="s:int" />
          <s:element minOccurs="0" maxOccurs="1" name="cityLocation" type="tns:ArrayOfCityLocation" />
        </s:sequence>
      </s:complexType>
      <s:complexType name="ArrayOfCityLocation">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="unbounded" name="CityLocation" type="tns:CityLocation" />
        </s:sequence>
      </s:complexType>
      <s:complexType name="CityLocation">
        <s:sequence>
          <s:element minOccurs="1" maxOccurs="1" name="city" type="tns:City" />
          <s:element minOccurs="1" maxOccurs="1" name="point" type="tns:Point" />
          <s:element minOccurs="1" maxOccurs="1" name="carAccess" type="s:boolean" />
          <s:element minOccurs="0" maxOccurs="1" name="zipRangeStart" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="zipRangeEnd" type="s:string" />
          <s:element minOccurs="1" maxOccurs="1" name="capital" type="s:boolean" />
        </s:sequence>
      </s:complexType>
      <s:element name="GetCrossStreetXY">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="1" name="cidade" type="tns:City" />
            <s:element minOccurs="0" maxOccurs="1" name="firstStreet" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="secondStreet" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="token" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="GetCrossStreetXYResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="GetCrossStreetXYResult" type="tns:ArrayOfCrossStreetLocation" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:complexType name="ArrayOfCrossStreetLocation">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="unbounded" name="CrossStreetLocation" nillable="true" type="tns:CrossStreetLocation" />
        </s:sequence>
      </s:complexType>
      <s:complexType name="CrossStreetLocation">
        <s:sequence>
          <s:element minOccurs="1" maxOccurs="1" name="city" type="tns:City" />
          <s:element minOccurs="1" maxOccurs="1" name="point" type="tns:Point" />
          <s:element minOccurs="0" maxOccurs="1" name="crossStreet" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="district" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="street" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="zip" type="s:string" />
        </s:sequence>
      </s:complexType>
      <s:element name="GetCrossStreetAddress">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="1" name="point" type="tns:Point" />
            <s:element minOccurs="0" maxOccurs="1" name="token" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="GetCrossStreetAddressResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="GetCrossStreetAddressResult" type="tns:ArrayOfAddressLocation" />
          </s:sequence>
        </s:complexType>
      </s:element>
    </s:schema>
  </wsdl:types>
  <wsdl:message name="findPOISoapIn">
    <wsdl:part name="parameters" element="tns:findPOI" />
  </wsdl:message>
  <wsdl:message name="findPOISoapOut">
    <wsdl:part name="parameters" element="tns:findPOIResponse" />
  </wsdl:message>
  <wsdl:message name="findAddressSoapIn">
    <wsdl:part name="parameters" element="tns:findAddress" />
  </wsdl:message>
  <wsdl:message name="findAddressSoapOut">
    <wsdl:part name="parameters" element="tns:findAddressResponse" />
  </wsdl:message>
  <wsdl:message name="getAddressSoapIn">
    <wsdl:part name="parameters" element="tns:getAddress" />
  </wsdl:message>
  <wsdl:message name="getAddressSoapOut">
    <wsdl:part name="parameters" element="tns:getAddressResponse" />
  </wsdl:message>
  <wsdl:message name="getXYSoapIn">
    <wsdl:part name="parameters" element="tns:getXY" />
  </wsdl:message>
  <wsdl:message name="getXYSoapOut">
    <wsdl:part name="parameters" element="tns:getXYResponse" />
  </wsdl:message>
  <wsdl:message name="getXYRadiusWithMapSoapIn">
    <wsdl:part name="parameters" element="tns:getXYRadiusWithMap" />
  </wsdl:message>
  <wsdl:message name="getXYRadiusWithMapSoapOut">
    <wsdl:part name="parameters" element="tns:getXYRadiusWithMapResponse" />
  </wsdl:message>
  <wsdl:message name="findCitySoapIn">
    <wsdl:part name="parameters" element="tns:findCity" />
  </wsdl:message>
  <wsdl:message name="findCitySoapOut">
    <wsdl:part name="parameters" element="tns:findCityResponse" />
  </wsdl:message>
  <wsdl:message name="GetCrossStreetXYSoapIn">
    <wsdl:part name="parameters" element="tns:GetCrossStreetXY" />
  </wsdl:message>
  <wsdl:message name="GetCrossStreetXYSoapOut">
    <wsdl:part name="parameters" element="tns:GetCrossStreetXYResponse" />
  </wsdl:message>
  <wsdl:message name="GetCrossStreetAddressSoapIn">
    <wsdl:part name="parameters" element="tns:GetCrossStreetAddress" />
  </wsdl:message>
  <wsdl:message name="GetCrossStreetAddressSoapOut">
    <wsdl:part name="parameters" element="tns:GetCrossStreetAddressResponse" />
  </wsdl:message>
  <wsdl:portType name="AddressFinderSoap">
    <wsdl:operation name="findPOI">
      <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Devolve uma lista contendo POI candidatos.</wsdl:documentation>
      <wsdl:input message="tns:findPOISoapIn" />
      <wsdl:output message="tns:findPOISoapOut" />
    </wsdl:operation>
    <wsdl:operation name="findAddress">
      <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Devolve uma lista contendo endereços candidatos.</wsdl:documentation>
      <wsdl:input message="tns:findAddressSoapIn" />
      <wsdl:output message="tns:findAddressSoapOut" />
    </wsdl:operation>
    <wsdl:operation name="getAddress">
      <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Devolve o endereço do ponto informado.</wsdl:documentation>
      <wsdl:input message="tns:getAddressSoapIn" />
      <wsdl:output message="tns:getAddressSoapOut" />
    </wsdl:operation>
    <wsdl:operation name="getXY">
      <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Devolve a coordenada do endereço informado.</wsdl:documentation>
      <wsdl:input message="tns:getXYSoapIn" />
      <wsdl:output message="tns:getXYSoapOut" />
    </wsdl:operation>
    <wsdl:operation name="getXYRadiusWithMap">
      <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Devolve a a coordenada do ponto informado e a URL do mapa.</wsdl:documentation>
      <wsdl:input message="tns:getXYRadiusWithMapSoapIn" />
      <wsdl:output message="tns:getXYRadiusWithMapSoapOut" />
    </wsdl:operation>
    <wsdl:operation name="findCity">
      <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Devolve uma lista contendo dados da cidade informada.</wsdl:documentation>
      <wsdl:input message="tns:findCitySoapIn" />
      <wsdl:output message="tns:findCitySoapOut" />
    </wsdl:operation>
    <wsdl:operation name="GetCrossStreetXY">
      <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Devolve a coordenada de um cruzamento</wsdl:documentation>
      <wsdl:input message="tns:GetCrossStreetXYSoapIn" />
      <wsdl:output message="tns:GetCrossStreetXYSoapOut" />
    </wsdl:operation>
    <wsdl:operation name="GetCrossStreetAddress">
      <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Devolve os cruzamentos de uma coordenada</wsdl:documentation>
      <wsdl:input message="tns:GetCrossStreetAddressSoapIn" />
      <wsdl:output message="tns:GetCrossStreetAddressSoapOut" />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="AddressFinderSoap" type="tns:AddressFinderSoap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="findPOI">
      <soap:operation soapAction="http://webservices.maplink2.com.br/findPOI" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="findAddress">
      <soap:operation soapAction="http://webservices.maplink2.com.br/findAddress" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="getAddress">
      <soap:operation soapAction="http://webservices.maplink2.com.br/getAddress" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="getXY">
      <soap:operation soapAction="http://webservices.maplink2.com.br/getXY" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="getXYRadiusWithMap">
      <soap:operation soapAction="http://webservices.maplink2.com.br/getXYRadiusWithMap" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="findCity">
      <soap:operation soapAction="http://webservices.maplink2.com.br/findCity" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="GetCrossStreetXY">
      <soap:operation soapAction="http://webservices.maplink2.com.br/GetCrossStreetXY" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="GetCrossStreetAddress">
      <soap:operation soapAction="http://webservices.maplink2.com.br/GetCrossStreetAddress" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:binding name="AddressFinderSoap12" type="tns:AddressFinderSoap">
    <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="findPOI">
      <soap12:operation soapAction="http://webservices.maplink2.com.br/findPOI" style="document" />
      <wsdl:input>
        <soap12:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="findAddress">
      <soap12:operation soapAction="http://webservices.maplink2.com.br/findAddress" style="document" />
      <wsdl:input>
        <soap12:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="getAddress">
      <soap12:operation soapAction="http://webservices.maplink2.com.br/getAddress" style="document" />
      <wsdl:input>
        <soap12:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="getXY">
      <soap12:operation soapAction="http://webservices.maplink2.com.br/getXY" style="document" />
      <wsdl:input>
        <soap12:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="getXYRadiusWithMap">
      <soap12:operation soapAction="http://webservices.maplink2.com.br/getXYRadiusWithMap" style="document" />
      <wsdl:input>
        <soap12:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="findCity">
      <soap12:operation soapAction="http://webservices.maplink2.com.br/findCity" style="document" />
      <wsdl:input>
        <soap12:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="GetCrossStreetXY">
      <soap12:operation soapAction="http://webservices.maplink2.com.br/GetCrossStreetXY" style="document" />
      <wsdl:input>
        <soap12:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="GetCrossStreetAddress">
      <soap12:operation soapAction="http://webservices.maplink2.com.br/GetCrossStreetAddress" style="document" />
      <wsdl:input>
        <soap12:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="AddressFinder">
    <wsdl:port name="AddressFinderSoap" binding="tns:AddressFinderSoap">
      <soap:address location="http://services.maplink.com.br/webservices/v3/AddressFinder/AddressFinder.asmx" />
    </wsdl:port>
    <wsdl:port name="AddressFinderSoap12" binding="tns:AddressFinderSoap12">
      <soap12:address location="http://services.maplink.com.br/webservices/v3/AddressFinder/AddressFinder.asmx" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>
XML;
?>

当我运行 index.php 时,我收到此错误:

致命错误:在第 51 行的 C:\wamp\www\xml\index.php 中调用未定义的方法 SimpleXMLElement::findAddress()"

4

1 回答 1

0

你把事情严重混淆了。您的“第一个存档”(无论您的意思是什么)看起来像一个 SOAP 调用,但这些行不适合:

$xmlstr = utf8_encode(file_get_contents('traffic.xml'));

$client = new SimpleXMLElement($xmlstr);

现在取决于您在这里尝试做什么,我看到两个选项:

A)如果traffic.xml是“第二个存档”中的 WSDL,则应将这些行替换为:

$client = new SoapClient('traffic.xml');

但是参数必须是 XML 文件的文件名,而不是像$xmlstr“第二个存档”那样的字符串 - 但如果您必须将WSDL 作为字符串提供,这里有一个解决方案:https ://stackoverflow.com /a/8152694/664108

B)如果它是实际的 XML 数据,则脚本的其余部分没有意义,因为它试图从 Web 服务获取数据。我需要有关 XML 以及您正在尝试做什么的更多信息,以便为您提供帮助。

于 2013-02-05T22:29:58.783 回答