.NET Framework Bookmark and Share   
 index > ASMX Web Services and XML Serialization > Manually Creating WSDL - Problem with Attributes
 

Manually Creating WSDL - Problem with Attributes

I'm creating a WSDL in PHP to be consumed by a .NET app. The issue I'm having is with Attributes on my elements. Here's what I have in the WSDL:

 <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://ws.myapp.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">

<xsd:complexType name="SynchronizationTransaction">

 <xsd:sequence>

  <xsd:element name="SynchronizationTransactionHeader" type="tns:SynchronizationTransactionHeaderType" /> 

  </xsd:sequence>

  </xsd:complexType>

 <xsd:complexType name="SynchronizationTransactionHeaderType">

<xsd:sequence>

  <xsd:element name="test" type="xsd:string" /> 

  </xsd:sequence>

  <xsd:attribute name="date" type="xsd:string" /> 

  </xsd:complexType>

  </schema>

When I try to connect my .NET simulator to it, I get this message:
"Attributes are not supported with encoded SOAP. Please change definition of schema type 'SynchronizationTransactionHeaderType' from namespace 'http://ws.myapp.com': use elements (not attributes) for fields/parameters."

The XML schema is set by the client, so I'm forced to have these attributes.

Thanks.

PS I'm normally a .NET developer and I HATE PHP. :-)
MShanahan
The issue was not with my WSDL, but rather with the PHP framework we were using and how it was setting up the rest of the web service message. In the Input and Output section of the WSDL, it was assigning an encoding to the soap element. I created a sample Web Service project with VS, looked at how it does it, and changed this PHP framework to do the same thing. My soap element now looks like this:

<soap:body use="literal" /> 
After changing this, Attributes worked perfectly it seems.
MShanahan
The issue was not with my WSDL, but rather with the PHP framework we were using and how it was setting up the rest of the web service message. In the Input and Output section of the WSDL, it was assigning an encoding to the soap element. I created a sample Web Service project with VS, looked at how it does it, and changed this PHP framework to do the same thing. My soap element now looks like this:

<soap:body use="literal" /> 
After changing this, Attributes worked perfectly it seems.
MShanahan
Thanks for posting the solution!
edhickey

You can use google to search for other answers

Custom Search

More Threads

• XMLElement Attribute
• WSDL validation fails using MessageName attribute
• XmlException From Web Service
• Interop-problem between .NET-WebService and Java (HTTPS)
• How to retrieve a list of active sessions?
• Receiving progress events from a long-running web service
• SSL certificate problem calling a webservice from an executable file, and this from a web application
• Datatype error while generating Classes through XSD Utility
• Web Service Soap exception related to SQL Server 2005 DB access
• solve