开发者

how to map complex type to an existent class

开发者 https://www.devze.com 2023-01-10 13:28 出处:网络
i want to map an existent type to wsdl type the wsdl complex type <types> <xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://www.example.org/service1/\"&g

i want to map an existent type to wsdl type

the wsdl complex type

 <types>
  <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/service1/">
   <xsd:complexType name="RequestDescriptor">
    <xsd:all>
     <xsd:element name="language" type="xsd:string" default="xx"></xsd:element>
     <xsd:element name="siteAPIKey" type="xsd:string" default="xxxx"></xsd:element>
     <xsd:element name="userID" type="xsd:int" default="-1"></xsd:element>
     &l开发者_如何转开发t;xsd:element name="sessionID" type="xsd:string" default="-1"></xsd:element>
     <xsd:element name="returnDataFormat" type="xsd:string" default="XX"></xsd:element>
    </xsd:all>
   </xsd:complexType>
  </xsd:schema>
 </types>

and i call it like

<wsdl:message name="getXXRequest">
  <wsdl:part name="requestDescriptor" type="xsd1:RequestDescriptor"/>
 </wsdl:message>
 <wsdl:message name="getXXResponse">
  <wsdl:part name="getXXResponse" type="xsd:anytype"/>
 </wsdl:message>

in the php i use this code to map complex type

$soapClient = new SoapClient($soapServiceURL,array("classmap"=>array("RequestDescriptor","RequestDescriptor")));

when i call any function i got in the server log this message

PHP Catchable fatal error: Argument 1 passed to xx::XXX() must be an instance of RequestDescriptor, instance of stdClass given

but it run and return the result as expected any clue how to fix this {PHP Catchable fatal error}


Does your RequestDescriptor class you claim to send have any further functionality besides being a struct / variable holder? If not, drop the classmap thing and keep on throwing stdClass objects in it.

If it does something else, you'll have to track down where an stdClass object is passed instead of an RequestDescriptor instance (probably at a location you don't expect, as the request would fail AFAIK, so there are more requests handled). A backtrace from that instance could help you a lot, possibly extend your soapclient class with another having a custom __call() method which explicitly tests for this, does a debug_print_backtrace() when the error condition occurs, or just calls parent::__call() when all's fine.

0

精彩评论

暂无评论...
验证码 换一张
取 消