My company has been using ASMX web services for some time but is now moving toward WCF. I have created a new WCF service (my first) using basicHttpBinding and I can get it to work. The service exposes a type that I created (a custom class) who has simple
type properties.
A (Java) client application needs to use this web service so they wanted to get the WSDL for it so they could generate their client class. After inspecting the WSDL, there is nothing in it specifying how the custom class is defined.
I created a separte project having an ASMX web service in it and created a copy of the custom class within it and create a method that returns that type, just like the WCF version did. When I compare the WSDLs for each service type, I notice that the WCF
service has an empty <wsdl:types> element while the ASMX one has information about my custom type. I did remember to add the DataContract and DataMember attributes to my custom type for the WCF service and in the ASMX service I added the Serializable attribute.
Strangely, if I create a console test app and connect to the WCF service, it knows the return type (my custom class) and I can get Intellsense to recognize all of it's properties. I do not have a reference to the assembly which contains the class in question.
This makes me think that there's something wrong with my configuration. Is there something I need to do in the WCF service project's web.config to get this to work? They want to do a demo soon and I need to get this working. Thanks
Yes it does. After further analysis I see that there are import statements that link to other files and if I look at those the information is there. That's why my code works.
desertfoxaz
Member
307 Points
358 Posts
Custom types not defined in WSDL of WCF service
Feb 29, 2012 08:33 PM|LINK
My company has been using ASMX web services for some time but is now moving toward WCF. I have created a new WCF service (my first) using basicHttpBinding and I can get it to work. The service exposes a type that I created (a custom class) who has simple type properties.
A (Java) client application needs to use this web service so they wanted to get the WSDL for it so they could generate their client class. After inspecting the WSDL, there is nothing in it specifying how the custom class is defined.
I created a separte project having an ASMX web service in it and created a copy of the custom class within it and create a method that returns that type, just like the WCF version did. When I compare the WSDLs for each service type, I notice that the WCF service has an empty <wsdl:types> element while the ASMX one has information about my custom type. I did remember to add the DataContract and DataMember attributes to my custom type for the WCF service and in the ASMX service I added the Serializable attribute.
Strangely, if I create a console test app and connect to the WCF service, it knows the return type (my custom class) and I can get Intellsense to recognize all of it's properties. I do not have a reference to the assembly which contains the class in question.
This makes me think that there's something wrong with my configuration. Is there something I need to do in the WCF service project's web.config to get this to work? They want to do a demo soon and I need to get this working. Thanks
ramanselva
Contributor
2064 Points
324 Posts
Re: Custom types not defined in WSDL of WCF service
Mar 01, 2012 09:01 AM|LINK
Hi,
Have u enabled in WCF config
<serviceBehaviors>
<behavior name="BEHAVIOURNAME">
<serviceMetadata httpsGetEnabled="true"/>
</behavior>
</serviceBehaviors>
This can be beneficial to other community members reading the thread.
Regards,
Rama Selvam M.
desertfoxaz
Member
307 Points
358 Posts
Re: Custom types not defined in WSDL of WCF service
Mar 01, 2012 02:19 PM|LINK
Yes it does. After further analysis I see that there are import statements that link to other files and if I look at those the information is there. That's why my code works.