Product是php服务端定义的类型
bcb导入wsdl之后是这样的
/ ************************************************************************ //
// Namespace : urn:GetProductsByCode
// ************************************************************************ //
class Product : public TRemotable {
private:
  AnsiString      FName;
  AnsiString      FCode;
  TXSDecimal*    FPrice;
  int            FAmmount;
public:
  __fastcall ~Product();
__published:
  __property AnsiString      Name = { read=FName, write=FName };
  __property AnsiString      Code = { read=FCode, write=FCode };
  __property TXSDecimal*      Price = { read=FPrice, write=FPrice };
  __property int          Ammount = { read=FAmmount, write=FAmmount };
};

typedef DynamicArray <Product*>    ProductArray;  /* "urn:GetProductsByCode" */

// ************************************************************************ //
// Namespace : urn:GetProductsByCode
// soapAction: urn:GetProductsByCode#GetProducts
// transport : http://schemas.xmlsoap.org/soap/http
// style    : rpc
// binding  : GetProductsByCodeBinding
// service  : GetProductsByCode
// port      : GetProductsByCodePort
// URL      : http://localhost/g/soap_server4.php
// ************************************************************************ //
__interface INTERFACE_UUID("{80806902-DF5B-B30C-EB6E-5534DC1AA3D0}") GetProductsByCodePortType : public IInvokable
{
public:
  virtual ProductArray    GetProducts(const AnsiString user, const Product* other) = 0;
};
typedef DelphiInterface <GetProductsByCodePortType> _di_GetProductsByCodePortType;

_di_GetProductsByCodePortType GetGetProductsByCodePortType(bool useWSDL=false, AnsiString addr="");
但是我发现这个类型在bcb中用作函数返回值可以
用作参数就会出错
服务端好像不能解析作为参数的Product

Product* p = new Product();
p->Name = "ddd";
p->Code = "88";
p->Ammount = 1;
ProductArray pa;

pa = GetGetProductsByCodePortType()->GetProducts("user",p);//这里出错,服务端解析不了p这个参数

没有用过复杂类型参数的WebService,帮你up

我看了几天前写的一个列子程序
可以在参数里使用复杂类型
现在爆的异常是
No Native to Message converter set
不知各位是否遇到过?????

wo 是楼主,
试了一下午,感觉bcb6的soap不稳定,
传递数据类型简单点还好,如果传递个稍微复杂点的自定义类型,就会挂掉
我php写server和client均调试ok,
但用bcb6来写client就出错
大家能否发表点意见??
下面是我实验的代码
// Pull in the NuSOAP code
require_once('lib/nusoap.php');
// Create the server instance
$server = new soap_server();
// Initialize WSDL support
$server->configureWSDL('GetProductsByCode', 'urn:GetProductsByCode');
// Register the data structures used by the service

$server->wsdl->addComplexType(
  'Product',
  'complexType',
  'struct',
  'all',
  '',
  array(
      'Name' => array('name'=>'name','type'=>'xsd:string'),
      'Code' => array('name'=>'product_number','type'=>'xsd:string'),
      'Ammount' => array('name'=>'quantity','type'=>'xsd:int')
  )
);

$server->wsdl->addComplexType(
  'ProductArray',
  'complexType',
  'array',
  '',
  'SOAP-ENC:Array',
  array(),
  array(
      array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:Product[]')
  ),
  'tns:Product'
);

$server->wsdl->addComplexType(
  'comp',
  'complexType',
  'struct',
  'all',
  '',
  array(
      'index' => array('name'=>'index','type'=>'xsd:int'),
      'inname' => array('name'=>'inname','type'=>'xsd:string'),
      'arr' => array('name'=>'arr','type'=>'tns:ProductArray')
  )
);

$server->wsdl->addComplexType(
  'resulttt',
  'complexType',
  'struct',
  'all',
  '',
  array(
      'msg' => array('name'=>'msg','type'=>'xsd:string'),
      'rettt' => array('name'=>'arr','type'=>'tns:comp')
  )
);

$server->register(
  'GetProducts',
  array('a'=>'xsd:int','b'=>'xsd:string','p'=>'tns:Product','pa'=>'tns:ProductArray','co'=>'tns:comp'),
  array('return'=>'tns:resulttt'),
  'urn:GetProductsByCode',                        // namespace
  'urn:GetProductsByCode#GetProducts',                  // soapaction
  'rpc',                                    // style
  'encoded',                                // use
  'GetProductsByCode'        // documentation
  );

  // Define the method as a PHP function
  function GetProducts($a,$b,$p,$pa,$co)
  {
      $dp = print_r($p,true);
      $dpa = print_r($pa,true);
      $dco = print_r($co,true);
      //$msg = $a . " <br />" . $b . " <br />"  . $dp . " <br />"  . $dpa . " <br />"  . $dco . " <br />"  . $msg . " <br />" ;
      //file_put_contents($msg);
      $r = array(
            'msg' => $msg,
            'rettt'=> $co
      );
      return $r;

      /*
      $pro[] =  array(
                'Name' => 'name1',
                'Code' => '1',
                'Price'=>10.10,
                'Ammount'=>1
                );
      $pro[] =  array(
                'Name' => 'name2',
                'Code' => '2',
                'Price'=>20.10,
                'Ammount'=>2
                );
      $pro[] =  array(
                'Name' => 'name3',
                'Code' => '3',
                'Price'=>30.10,
                'Ammount'=>3
                );

      return $pro;
      */
  }

  // Use the request to (try to) invoke the service
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
bcb端我写的代码:
Product *p = new Product();
p->Name = "product name";
p->Code = "product code";
p->Ammount = 1;
//————–
Product *p1 = new Product();
p1->Name = "product name1";
p1->Code = "product code1";
p1->Ammount = 1;
//—————
ProductArray pa;
pa.set_length(5);
pa[0] = p;
pa[1] = p1;
//—————
comp *co = new comp();
co->index = 1;
co->inname = "inname";
co->arr = pa;
resulttt *r = GetGetProductsByCodePortType()->GetProducts(1,"b", p, pa, co);
ShowMessage(r->msg);
ShowMessage(r->rettt->inname);

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
bcb端导入wsdl自动生成的代码
namespace NS_comp {

// ************************************************************************ //
// The following types, referred to in the WSDL document are not being represented
// in this file. They are either aliases[@] of other types represented or were referred
// to but never[!] declared in the document. The types from the latter category
// typically map to predefined/known XML or Borland types; however, they could also
// indicate incorrect WSDL documents that failed to declare or import a schema type.
// ************************************************************************ //
// !:string          - "http://www.w3.org/2001/XMLSchema"
// !:int            - "http://www.w3.org/2001/XMLSchema"

class  Product;
class  comp;
class  resulttt;

// ************************************************************************ //
// Namespace : urn:GetProductsByCode
// ************************************************************************ //
class Product : public TRemotable {
private:
  AnsiString      FName;
  AnsiString      FCode;
  int            FAmmount;
public:
__published:
  __property AnsiString      Name = { read=FName, write=FName };
  __property AnsiString      Code = { read=FCode, write=FCode };
  __property int          Ammount = { read=FAmmount, write=FAmmount };
};

typedef DynamicArray <Product*>    ProductArray;  /* "urn:GetProductsByCode" */

// ************************************************************************ //
// Namespace : urn:GetProductsByCode
// ************************************************************************ //
class comp : public TRemotable {
private:
  int            Findex;
  AnsiString      Finname;
  ProductArray    Farr;
public:
  __fastcall ~comp();
__published:
  __property int            index = { read=Findex, write=Findex };
  __property AnsiString    inname = { read=Finname, write=Finname };
  __property ProductArray        arr = { read=Farr, write=Farr };
};

// ************************************************************************ //
// Namespace : urn:GetProductsByCode
// ************************************************************************ //
class resulttt : public TRemotable {
private:
  AnsiString      Fmsg;
  comp*          Frettt;
public:
  __fastcall ~resulttt();
__published:
  __property AnsiString        msg = { read=Fmsg, write=Fmsg };
  __property comp*          rettt = { read=Frettt, write=Frettt };
};

// ************************************************************************ //
// Namespace : urn:GetProductsByCode
// soapAction: urn:GetProductsByCode#GetProducts
// transport : http://schemas.xmlsoap.org/soap/http
// style    : rpc
// binding  : GetProductsByCodeBinding
// service  : GetProductsByCode
// port      : GetProductsByCodePort
// URL      : http://127.0.0.1/g/comp.php
// ************************************************************************ //
__interface INTERFACE_UUID("{80806902-DF5B-B30C-EB6E-5534DC1AA3D0}") GetProductsByCodePortType : public IInvokable
{
public:
  virtual resulttt*      GetProducts(const int a, const AnsiString b, const Product* p, const ProductArray pa, const comp* co) = 0;
};
typedef DelphiInterface <GetProductsByCodePortType> _di_GetProductsByCodePortType;

_di_GetProductsByCodePortType GetGetProductsByCodePortType(bool useWSDL=false, AnsiString addr="");

php生成的wsdl
  <?xml version="1.0" encoding="ISO-8859-1" ?>
- <definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:GetProductsByCode" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:GetProductsByCode">
- <types>
- <xsd:schema targetNamespace="urn:GetProductsByCode">
  <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
  <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
- <xsd:complexType name="Product">
- <xsd:all>
  <xsd:element name="Name" type="xsd:string" />
  <xsd:element name="Code" type="xsd:string" />
  <xsd:element name="Ammount" type="xsd:int" />
  </xsd:all>
  </xsd:complexType>
- <xsd:complexType name="ProductArray">
- <xsd:complexContent>
- <xsd:restriction base="SOAP-ENC:Array">
  <xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:Product[]" />
  </xsd:restriction>
  </xsd:complexContent>
  </xsd:complexType>
- <xsd:complexType name="comp">
- <xsd:all>
  <xsd:element name="index" type="xsd:int" />
  <xsd:element name="inname" type="xsd:string" />
  <xsd:element name="arr" type="tns:ProductArray" />
  </xsd:all>
  </xsd:complexType>
- <xsd:complexType name="resulttt">
- <xsd:all>
  <xsd:element name="msg" type="xsd:string" />
  <xsd:element name="rettt" type="tns:comp" />
  </xsd:all>
  </xsd:complexType>
  </xsd:schema>
  </types>
- <message name="GetProductsRequest">
  <part name="a" type="xsd:int" />
  <part name="b" type="xsd:string" />
  <part name="p" type="tns:Product" />
  <part name="pa" type="tns:ProductArray" />
  <part name="co" type="tns:comp" />
  </message>
- <message name="GetProductsResponse">
  <part name="return" type="tns:resulttt" />
  </message>
- <portType name="GetProductsByCodePortType">
- <operation name="GetProducts">
  <documentation>GetProductsByCode </documentation>
  <input message="tns:GetProductsRequest" />
  <output message="tns:GetProductsResponse" />
  </operation>
  </portType>
- <binding name="GetProductsByCodeBinding" type="tns:GetProductsByCodePortType">
  <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
- <operation name="GetProducts">
  <soap:operation soapAction="urn:GetProductsByCode#GetProducts" style="rpc" />
- <input>
  <soap:body use="encoded" namespace="urn:GetProductsByCode" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
  </input>
- <output>
  <soap:body use="encoded" namespace="urn:GetProductsByCode" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
  </output>
  </operation>
  </binding>
- <service name="GetProductsByCode">
- <port name="GetProductsByCodePort" binding="tns:GetProductsByCodeBinding">
  <soap:address location="http://localhost/g/comp.php" />
  </port>
  </service>
  </definitions>