2011-11-08 3 views
0

는이 같은 SOAP 요청을 작성해야합니다 : 지금까지 내가 중첩 된 배열을 사용할 필요가 이해SOAP에서 요청하는 XML 속성을 추가하는 방법은 무엇입니까?

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:stor="http://storage.xdoc.xx/"> 
    <soapenv:Header/> 
    <soapenv:Body> 
     <stor:createDocument> 
     <parentEntryId>workspace://SpacesStore/15f33e3a-32ba-4a5d-976f-c9e2096e1112</parentEntryId> 
     <name>test.txt</name> 
     <properties module="" name="Content" type="Binary"> 
      <valueBinary> 
       <bytes>cXdlcnR5</bytes> 
      </valueBinary> 
     </properties> 
     </stor:createDocument> 
    </soapenv:Body> 
</soapenv:Envelope> 

을하지만, 문제는 XML 속성입니다. SoapVar는 내가 원하는 것만 큼은 아닌 것처럼 보입니다.

$client->__callSoap("createDocument", 
           array(new SoapParam($name, "name"), 
             new SoapParam(
               new SoapParam(
                 new SoapParam(
                   $contents, 
                   "bytes" 
                 ), 
                 "valueBinary" 
               ), 
               "properties" 
             ) 
           ) 
         ); 

방법 속성에 "속성"을 추가 :

지금 나는 그런 전화를?

미리 감사드립니다.

답변

-1

나는이 일을 몇 가지 변종을 시도했습니다 - 중첩 된 배열 및 stdClass 및 SoapVar 등 배열, 조합, enconded하지만이 제대로 작동 할 수있는 유일한 변형 즉 :

$parameters = new stdClass(); 
$parameters->name = $name; 
$parameters->parentEntryId = $parentEntryId; 
$parameters->properties = new stdClass(); 
$propsSimpleVar = new SoapVar("<properties module=\"\" name=\"Content\" type=\"Binary\"><valueBinary><bytes>" . $cleanContents . "</bytes></valueBinary></properties>", XSD_ANYXML); 

$parameters->properties = $propsSimpleVar; 

$client->createDocument($parameters); 

나는 그것도 속성에 대한 배열과 함께 작동해야한다고 생각합니다. 희망이 있으면 다른 사람에게 유용 할 것입니다.

+0

Hackish solutin with XSD_ANYXML ... –

관련 문제