I am trying to create a web service using wdsl and soap. The server is to be written in php.
As of now I am trying out things by adding just one function to the soap server object. My requirement is that this function should take an associative array. Right now it returns a string but its just trial for now and will also be returning an array as per requirement.
For taking an assoc array as input I defined a complexType in the wsdl. Following is the code
<types>
<xsd:schema
targetNamespace="http://projects.kp/test/webservice/StoreService.wsdl"
xmlns="http://www.w3.org/1999/XMLSchema/">
<xsd:complexType name="store">
<xsd:element name="name" type="xsd:string" />
<xsd:element name="subdomain" type="xsd:string" />
</xsd:complexType>
</xsd:schema>
</types>
<message name="StoreRequest">
<part name="store" type="tns:store"/>
</message>
<message name="StoreResponse">
<part name="url" type="xsd:string"/>
</message>
When I run the soap client file in the browser, it gives the following error.
Fatal error: Uncaught SoapFault exception:
[WSDL] SOAP-ERROR: Parsing Schema: unexpected in complexType
If I use a string datatype instead of a complexType, it works properly. I guess i haven't yet understood how complexTypes work so I am unable to debug this.
Also I would like to know if array as the request and response type will work if the client is coded in some other language say .NET.
(Right now I am testing this on a virtual host on a ubuntu desktop and the server and client are on the same vhost and both written in php)
Thanks
我认为你需要在xsd:element之前设置xsd:all或xsd:sequence
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.