XML Attributes in your payload

Friday, June 27, 2008

If you want to have xml attributes in your message payload you have to design a WSDL so that it contains schema types with attributes. For an example

<xs:complexType name=\"myType\">
<xs:sequence>
<xs:element name=\"demo1\" type=\"xs:string\"/>
<xs:element name=\"demo2\" type=\"xs:string\"/>
</xs:sequence>
<xs:attribute name=\"demo3\" type=\"tns:derivedType\"/>
</xs:complexType>



PHP webservices demo site have samples WSDLs that defines attributes http://labs.wso2.org/wsf/php/solutions/wsdl_mode/AttributeService.php?wsdl. And you can test a sample service setting your clients endpoint to http://labs.wso2.org/wsf/php/solutions/wsdl_mode/AttributeService.php. Write your client with the help of the generated code for the WSDL. You can try it online from Here. And make sure you have installed WSF/PHP to do all of these.

No comments: