在PHP中构建对SoapClient的调用

I am new to SOAP and trying to figure out how to build a call to a SOAP server. Here is the definition of what I am trying to get:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:prov="http://bridgewatersystems.com/xpc/subscribermetering/service/provisioning/">
   <soapenv:Header/>
       <soapenv:Body>
          <prov:GetMeteringStateRequest>
              <subscriber subscriber-id="USERID" />
          </prov:GetMeteringStateRequest>
       </soapenv:Body>
    </soapenv:Envelope>

Here is the PHP I am using to test (and not working of course):

$user_id = "REALIDHERE";

$parameters->subscriber_id = $user_id;
$parameters->MIN = "test";
$parameters->partition_key = "test";

try {
  $client = new SoapClient("http://SOAPIP:32010/soap/services/SubscriberMeteringProvisionAPI.wsdl");

  echo "trying...
";
  print( $client->GetMeteringState( new SoapParam("subscriber", $parameters ) ) );
} catch (SoapFault $e) {
  //var_dump($e);
}

Any help on getting the call to GetMeteringState() to work would be great.

Thanks.

I'd recommend checking out the XML that is generated by your request. This is explained pretty well here, but here's an example:

// prepare SoapClient
$client = new SoapClient("http://.../SubscriberMeteringProvisionAPI.wsdl");
print( $client->GetMeteringState( new SoapParam("subscriber", $parameters ) ) );

// output the XML request
echo "<pre>".$client->__getLastRequest()."</pre>";