"John Saunders [MVP]" wrote:
"Pierre" <Pi****@discussions.microsoft.comwrote in message
news:C4**********************************@microsof t.com...
Hello,
I have a .NET 2.0 web service that is consumed by a Delphi application.
The Delphi application calls a method from the .NET web service with
parameters.
Theses parameters are in the call message, which we can see through a HTTP
proxy. But the ASP.NET application does not received the parameter values,
it
recevices only null values.
When tagging the ASP.NET method parameters with
<System.Xml.Serialization.XmlElement(Form:=System. Xml.Schema.XmlSchemaForm.Unqualified)>,
parameters are received, but the Delphi application requires that all
parameters are object, ie from a complex type.
Does anyone have an idea ?
This sounds like a namespace issue. Which XML namespace are the parameters
in? You have not specified a namespace in your XmlElementAttribute.
What do you mean that Delphi requires "object"? I don't know Delphi, so I
don't know what you mean.
--
John Saunders [MVP]
The namespace is well defined in the ASP.NET web service on the class level
through the class attribute :
<System.Web.Services.WebService(Namespace:="http ://myweb.com/services/")_
Here is the request which is emitted by the Delphi consumer :
<?xml version="1.0"?>'#$D#$A'<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><NS1:MultiplyIntegers
xmlns:NS1="http://myweb.com/services/"><a xsi:type="xsd:int">30</a><b
xsi:type="xsd:int">25</b></NS1:MultiplyIntegers></SOAP-ENV:Body></SOAP-ENV:Envelope>
And here, the response of the ASP.NET webservice :
<?xml version="1.0" encoding="utf-8"?><soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><MultiplyIntegersResponse
xmlns="http://myweb.com/services/"><MultiplyIntegersResult>890</MultiplyIntegersResult></MultiplyIntegersResponse></soap:Body></soap:Envelope>
The 890 result means that a and b are empty in the ASP.NET webservice.
So, in this context, I added the XmlElement attribute for each parameters
(<System.Xml.Serialization.XmlElement(Form:=System .Xml.Schema.XmlSchemaForm.Unqualified)>).
At this point, parameters are well received by the ASP.NET web service
listener, but one the Delphi side, parameters aren't keep simple, as
explained above.
And so, to answer to the second point, when generating the proxy with the
WSDL file, Delphi sees complex data type even when a parameter is an int or a
string.
For example, for the multiplyinterger(a,b), Delphi exposes not a simple int
for a and b, but an object type in which there is a property named a and a
other one named b.
It is really bizarre. I ever thought that web services were universal, but
those compatibility issues are very perturbating.
Thanks for your help.
Pierre.