ArrayOfString from .NET WCF

[email protected] ("M.Knuth")
Newsgroups php.soap
Message-ID <[email protected]>
Hello,

I do have a serious Problem in creating a SOAP-request in nonWSDL-Mode. I use a .NET WCF Server and I am trying to consume its 
webservice with SOAP PHP.

Here is what a .NET testclient would request:

<s:Envelope
 xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
 <s:Body>
  <CreateMediaEntity xmlns="http://wtf.core.MediaManager">
   <unit
    xmlns:a="http://WTF.WTFCore.Modules.Media"
    xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
    <a:Uri>http://dogz.de/myfile.avi</a:Uri>
    <a:Mimetype>myvideo</a:Mimetype>
    <a:Lossless>true</a:Lossless>
    <a:Md5>mymd5</a:Md5>
    <a:PublicURL>http://dogz.de/myfile.avi</a:PublicURL>
    <a:Keys xmlns:b="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
     <b:string>a</b:string>
     <b:string>b</b:string>
     <b:string>v</b:string>
    </a:Keys>
   </unit>
  </CreateMediaEntity>
 </s:Body>
</s:Envelope>

And here is what I ve got with PHP so far:

<SOAP-ENV:Envelope
 xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
 xmlns:ns1="http://wtf.core.MediaManager"
 xmlns:ns2="http://WTF.WTFCore.Modules.Media"
 xmlns:ns3="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
 <SOAP-ENV:Body>
  <ns1:CreateMediaEntity>
   <unit>
    <ns2:Uri>http://tmp.wtf.com/</ns2:Uri>
    <ns2:Mimetype>video/avi</ns2:Mimetype>
    <ns2:Lossless>true</ns2:Lossless>
    <ns2:Md5/>
    <ns2:PublicURL>http://files.wtf.com/biuvuzvui/</ns2:PublicURL>
    <ns2:Keys>
     <ns3:item>item1</ns3:item>
     <ns3:item>item2</ns3:item>
    </ns2:Keys>
   </unit>
  </ns1:CreateMediaEntity>
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

What's  wrong are those <ns3:item>..</ns3:item> nodes. I created this request with the following code:

 $uri = new SoapVar($unit->uri, XSD_STRING,'','','Uri','http://WTF.WTFCore.Modules.Media');
  $mimetype = new SoapVar($unit->mimetype, XSD_STRING,'','','Mimetype','http://WTF.WTFCore.Modules.Media');
  $lossless = new SoapVar($unit->lossless, XSD_BOOLEAN,'','','Lossless','http://WTF.WTFCore.Modules.Media');
  $md5 = new SoapVar($unit->md5, XSD_STRING,'','','Md5','http://WTF.WTFCore.Modules.Media');
  $publicURL = new SoapVar($unit->publicURL, XSD_STRING,'','','PublicURL','http://WTF.WTFCore.Modules.Media');

  $keyVars = array();
  $keyVars[] =  new SoapVar('item1',XSD_STRING  ,'string','','','http://schemas.microsoft.com/2003/10/Serialization/Arrays');
  $keyVars[] =  new SoapVar('item2',XSD_STRING  ,'string','','','http://schemas.microsoft.com/2003/10/Serialization/Arrays');
  $ke = new SoapVar($keyVars, null  ,'string','', '', 'http://WTF.WTFCore.Modules.Media');

  $unit = new stdClass();
  $unit->Uri = $uri;
  $unit->Mimetype = $mimetype;
  $unit->Lossless = $lossless;
  $unit->Md5 = $md5;
  $unit->PublicURL = $publicURL;
  $unit->Keys = $ke;
  $un = new SoapParam(new SoapVar($unit,SOAP_ENC_OBJECT),'unit');

I ve tried each and any combination of SoapVar-parameters, but I don't manage to create those <ns3:string>...</ns3:string> instead 
of <ns3:item>...</ns3:item> so that the .NET WCF server recognises the entries as part of the ArrayOfString? The request will end 
up in a "null" at server side since it cant be parsed correctly.

Any help would be great.

-- 
Marcus Knuth
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.