Nikeru

Hi.

I am making an application using WCF. I replacing Old Web Service with WCF Service. It is need for me that new WCF Service will interoperable with old clients, which works with old Web Service.

Here example of WCF Service code and generated wsdl:
WCF Service:

using System;

using System.Collections.Generic;

using System.Text;

using System.ServiceModel;

using System.Runtime.Serialization;

namespace WCF_Add

{

[ServiceContract(Name = "Probe1")]

public interface IService1

{

[OperationContract]

Double Add(Double dbl_One, Double dbl_Two);

}

public class service1 : IService1

{

public Double Add(Double dbl_One, Double dbl_Two)

{

return (dbl_One + dbl_Two);

}

}

WSDL:

< xml version="1.0" encoding="utf-8" >
- <wsdlBig Smileefinitions name="service1" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlnsTongue Tiedoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlnsTongue Tiedoapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlnsTongue Tiedoap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex">
- <wsdl:types>
- <xsdTongue Tiedchema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="http://localhost:8080/service1 xsd=xsd0" namespace="http://tempuri.org/" />
<xsd:import schemaLocation="http://localhost:8080/service1 xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
</xsdTongue Tiedchema>
</wsdl:types>
- <wsdl:message name="Probe1_Add_InputMessage">
<wsdlStick out tongueart name="parameters" element="tns:Add" />
</wsdl:message>
- <wsdl:message name="Probe1_Add_OutputMessage">
<wsdlStick out tongueart name="parameters" element="tns:AddResponse" />
</wsdl:message>
- <wsdlStick out tongueortType name="Probe1">
- <wsdlSurpriseperation name="Add">
<wsdl:input wsaw:Action="http://tempuri.org/Probe1/Add" message="tnsStick out tonguerobe1_Add_InputMessage" />
<wsdlSurpriseutput wsaw:Action="http://tempuri.org/Probe1/AddResponse" message="tnsStick out tonguerobe1_Add_OutputMessage" />
</wsdlSurpriseperation>
</wsdlStick out tongueortType>
- <wsdl:binding name="BasicHttpBinding_Probe1" type="tnsStick out tonguerobe1">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdlSurpriseperation name="Add">
<soapSurpriseperation soapAction="http://tempuri.org/Probe1/Add" style="document" />
- <wsdl:input>
<soap:body use="literal" />
</wsdl:input>
- <wsdlSurpriseutput>
<soap:body use="literal" />
</wsdlSurpriseutput>
</wsdlSurpriseperation>
</wsdl:binding>
- <wsdlTongue Tiedervice name="service1">
- <wsdlStick out tongueort name="BasicHttpBinding_Probe1" binding="tns:BasicHttpBinding_Probe1">
<soap:address location="http://localhost:8080/service1" />
</wsdlStick out tongueort>
</wsdlTongue Tiedervice>
</wsdlBig Smileefinitions>
I don't understand where definitions of tns:Add and tns:AddResponse in section <wsdl:types>.
Please help!


Re: Windows Communication Foundation (Indigo) Empty <wsdl:types>

Christian Weyer

IMO, you should first learn about the possible issues when trying to migrate from an 'old Web Service' (I guess you mean ASMX) to WCF. Nice article with links to more:
http://weblogs.manas.com.ar/waj/2007/05/31/asmx-to-wcf-migration/






Re: Windows Communication Foundation (Indigo) Empty <wsdl:types>

Nikeru

Hi Christian Weyer, thank you for your answer. I read this article, but it is need for me to create new WCF service, which will be compatible old wsdl-file. All good, but in old wsdl file I had section

......

- <wsdl:types>
- <sTongue Tiedchema elementFormDefault="qualified" targetNamespace=http://MyName/>
- <s:element name="Add">
- <s:complexType>
- <sTongue Tiedequence>
<s:element minOccurs="1" maxOccurs="1" name="dbl_One" type="sBig Smileouble" />
<s:element minOccurs="1" maxOccurs="1" name="dbl_Two" type="sBig Smileouble" />
</sTongue Tiedequence>
</s:complexType>
</s:element>
- <s:element name="AddResponse">
- <s:complexType>
- <sTongue Tiedequence>
<s:element minOccurs="1" maxOccurs="1" name="AddResult" type="sBig Smileouble" />
</sTongue Tiedequence>
</s:complexType>
</s:element>
</sTongue Tiedchema>
</wsdl:types>
.......
And now I have only:
.....
<wsdl:types>
- <xsdTongue Tiedchema targetNamespace="http://WCF_Add.com/Imports">
<xsd:import schemaLocation="http://localhost:8080/service1 xsd=xsd0" namespace="http://WCF_Add.com" />
</xsdTongue Tiedchema>
</wsdl:types>
......
Why I don't have definitions of tns:Add and tns:AddResponse




Re: Windows Communication Foundation (Indigo) Empty <wsdl:types>

Christian Weyer

Try this please (includes an explanation why it is the way it is Smile ):
http://blogs.thinktecture.com/cweyer/archive/2007/05/10/414840.aspx






Re: Windows Communication Foundation (Indigo) Empty <wsdl:types>

Nikeru

Thank you very much!!! Your answer and your blogs - is great!!!

www.thinktecture.com - now in MyFavorite folder.

I create application and use your example - all work very good!

But now I have a new problem. Can I create parameters as XmlAttribute, not as XmlElement

Now I have such WSDL:

...

- <wsdl:types>
- <xsdTongue Tiedchema elementFormDefault="qualified" targetNamespace="http://MyName/">
- <xsd:element name="Add">
- <xsd:complexType>
- <xsdTongue Tiedequence>
<xsd:element minOccurs="1" maxOccurs="1" name="dbl_One" type="xsdBig Smileouble" />
<xsd:element minOccurs="1" maxOccurs="1" name="dbl_Two" type="xsdBig Smileouble" />
</xsdTongue Tiedequence>
</xsd:complexType>
</xsd:element>

....

And I want to have:

...

- <wsdl:types>
- <sTongue Tiedchema elementFormDefault="qualified" targetNamespace="http://MyName/">
- <s:element name="Add">
- <s:complexType>
<s:attribute name="dbl_One" type="sTongue Tiedtring" />
<s:attribute name="dbl_Two" type="sTongue Tiedtring" />
</s:complexType>
</s:element>
...
Thank you once again!!!




Re: Windows Communication Foundation (Indigo) Empty <wsdl:types>

Christian Weyer

The default DataContractSerializer does not support XSD attributes - so please try switching to XmlSerializer by applying the [XmlSerializerFormat] to your ServiceContract.






Re: Windows Communication Foundation (Indigo) Empty <wsdl:types>

Nikeru

Thank for your answer. I already use XmlSerializer and use XmlAttribute:

public MyReply GetSt(string ID, string Handle, out ServerStatus Status)

{

Status = new Status();

...

MyReply myRP= new MyReply();

...

return new MyReply();

}

[XmlType()]

public partial class MyReply

{

private DateTime rcvTimeField;

private DateTime replyTimeField;

[XmlAttribute]

public DateTime RcvTime

{

get ...

set ...

}

[XmlAttribute]

public DateTime ReplyTime

{

get ...

set ...

}

}

[XmlType()]

public partial class ServerStatus

{

private string InfoField;

private string VersionField;

[XmlElement(Order = 1)]

public string Info

{

get ...

set ...

}

[XmlAttribute]

public string Version

{

get ...

set ...

}

}

All work good, in wsdl I see:

......

- <xsd:complexType name="MyReply">
<xsd:attribute name="RcvTime" type="xsdBig SmileateTime" use="required" />
<xsd:attribute name="ReplyTime" type="xsdBig SmileateTime" use="required" />
</xsd:complexType>
.......
- <xsd:complexType name="ServerStatus">
- <xsdTongue Tiedequence>
<xsd:element minOccurs="0" maxOccurs="1" name="Info" type="xsdTongue Tiedtring" />
</xsdTongue Tiedequence>
<xsd:attribute name="Version" type="xsdTongue Tiedtring" />
</xsd:complexType>
.......
Where I can define ID and Handle with XmlAttribute
Now I have:
.......
- <xsd:element name="GetSt">
- <xsd:complexType>
- <xsdTongue Tiedequence>
<xsd:element minOccurs="0" maxOccurs="1" name="ID" type="sTongue Tiedtring" />
<xsd:element minOccurs="0" maxOccurs="1" name="Handle" type="sTongue Tiedtring" />
</xsdTongue Tiedequence>
</xsd:complexType>
</xsd:element>
.......
But I try to get:
.......
- <s:element name="GetSt">
- <s:complexType>
<s:attribute name="ID" type="sTongue Tiedtring" />
<s:attribute name="Handle" type="sTongue Tiedtring" />
</s:complexType>
</s:element>
......
Can I create such wsdl as result
Thank you.
I




Re: Windows Communication Foundation (Indigo) Empty <wsdl:types>

Christian Weyer

Can you send me code offline through my blog






Re: Windows Communication Foundation (Indigo) Empty <wsdl:types>

Nikeru

I send code by this address http://blogs.thinktecture.com/cweyer/contact.aspx .

Is this right

Thank you.





Re: Windows Communication Foundation (Indigo) Empty <wsdl:types>

Christian Weyer

I tried a number of things...

But it seems not to be possible.


"XmlSerializer attribute System.Xml.Serialization.XmlAttributeAttribute is
not valid in ID. Only XmlElement, XmlArray, XmlArrayItem and XmlAnyElement
attributes are supported in MessageContract"

The problem is that [XmlAttribute] seems not valid in MessageContract Sad

Maybe someone from MS can confirm