[quoted text, click to view] "Pierre" <Pierre@discussions.microsoft.com> wrote in message
news:B9F178A9-F954-4F55-8E6E-0FF4D30D4DB0@microsoft.com...
>
>
> "John Saunders [MVP]" wrote:
>
>> "Pierre" <Pierre@discussions.microsoft.com> wrote in message
>> news:C47B6FE4-4F5A-409A-B067-1131A175D487@microsoft.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/")>
> _
Try also putting it on the XmlElement/XmlAttribute. I'm sure that the
namespace on WebService sets the targetNamespace for the WSDL, but I'm not
sure what else it does.
[quoted text, click to view] > 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.
Really? Why does it mean this? Could you have your service return -1 or
throw an exception if it sees empty parameters? That way we'd be sure this
is what was happening.
[quoted text, click to view] > 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.
Did you try using the DataType property of XmlElementAttribute?
[quoted text, click to view] > 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.
Web Services _are_ universal. You'll find that if you send and receive SOAP
messages using XML and HTTP, then Web Services will work perfectly. The
problem comes in when we use these darned programming languages, development
tools and software platforms. Sometimes you have to figure out how _they_
expect to deal with Web Services.
--
John Saunders [MVP]