PHP SOAP çağrı isteğe bağlı parametreleri ekleme

0 Cevap php

Benim SOAP çağrı biçimi olması gerekir:

<?xml version="1.0" encoding="UTF-8"?>  
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org/">  
<SOAP-ENV:Body>  
    <ns1:FunctionName>  
        <ns1:HostUserName>hostuser</ns1:HostUserName>  
        <ns1:HostPassword>pass</ns1:HostPassword>  
        <ns1:OwnerName>owner</ns1:OwnerName>  
        <ns1:UserName>user</ns1:UserName>  
        <ns1:OptionalParam>  
            <ns1:Parameters>  
                <ns1:Parameter Name="FirstName">First<ns1:/Parameter>  
                <ns1:Parameter Name="LastName">Last<ns1:/Parameter>  
            <ns1:/Parameters>  
        </ns1:OptionalParam>  
<ns1:/FunctionName>  
</SOAP-ENV:Body>  

How do I represent this in a PHP request? I build the request like this:

    $client = new SoapClient($url,array('trace' => 1)); 
    $data['HostUserName']=$this->hostname;
    $data['HostPassword']=$this->hostpassword;
    $data['OwnerName']=$this->ownername;
    $data['UserName']=$username;
    $data['FirstName']=$FirstName;
    $data['LastName']=$LastName;
    $result = $client->FunctionName($data);

I've tried a few combinations of building arrays, SOAPVAR and SOAPPARAM but nothing has worked. The target SOAP server is .NET based.

Herhangi bir öneriniz?

Teşekkürler

0 Cevap