如何使用不同的命名空间进行php soap调用

时间:2019-06-24 12:19:32

标签: php xml curl soap soap-client

我有一条带有不同名称空间的普通肥皂消息。

我想像下面这样使用php SoapClient:

$header = array("login" => $username, "password" => $password);

$client = new SoapClient($url, $header); 

然后我要使用该功能。

$result = $client->numberEnquiry("numberEnquiry", $params); 

在下面您看到肥皂信封。我可以使用curl调用,但我想使用PHP SoapClient。

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://www.example.com/number/v1" xmlns:v11="http://www.example.com/ns/Number/v1.0" xmlns:v12="http://www.example.com/ns/nhm/v1.0">
<soapenv:Header/>
<soapenv:Body>
<v1:numberEnquiry>
<numberQueryRequest>
    <v11:numberQueryRequest>
    <v11:serviceHeader>
        <v12:creationTime></v12:creationTime>
    </v11:serviceHeader>
    <v11:queryDetails>
        <v12:resellerProfile>
            <v12:Country>NL</v12:Country>
        </v12:resellerProfile>
        <v12:geoblockDetails>
            <v12:areaCode></v12:areaCode>
            <v12:areaCodeExtn></v12:areaCodeExtn>
        </v12:geoblockDetails>
        <v12:geoblockAddressDetails>
            <v12:address>
                <v12:cityTown></v12:cityTown>
                <v12:state></v12:state>
                <v12:postalZipCode></v12:postalZipCode>
                <v12:country></v12:country>
            </v12:address>
            <v12:blockSize></v12:blockSize>
        </v12:geoblockAddressDetails>
        <v12:nonGeoblockDetails>
            <v12:blockSize>1</v12:blockSize>
            <v12:quantity>9</v12:quantity>
        </v12:nonGeoblockDetails>
        <v12:geoSingleNumbersDetails>
            <v12:areaCode></v12:areaCode>
        </v12:geoSingleNumbersDetails>
        <v12:numberType>Geo</v12:numberType>
        <v12:numberCategory>PHONE</v12:numberCategory>
        <v12:serviceType></v12:serviceType>
        <v12:cliDetails>
            <v12:areaCode></v12:areaCode>
            <v12:areaCodeExtn></v12:areaCodeExtn>
        </v12:cliDetails>
        <v12:transactionId></v12:transactionId>
    </v11:queryDetails>
    </v11:numberQueryRequest>
</numberQueryRequest>
</v1:numberEnquiry>
</soapenv:Body>
</soapenv:Envelope>

我无法使用不同的名称空间和正确的变量来制作工作的肥皂功能。

0 个答案:

没有答案