I have created a WCF service, but the service WSDL does not show my classes (complex types).
Below is the service:
[ServiceContract]
public interface IFedexService
{
[OperationContract]
ShipmentReply CreateMultiFedExShipment(RxRdShipment shipment);
[OperationContract]
ShipmentReply CreateFedExShipment(RxRdShipment shipment);
}
And my class definition is :
[DataContract]
public class ShipmentReply
{
[DataMember]
public string ReferenceNumber { get; set; }
[DataMember]
public string MasterTrackingNumber { get; set; }
[DataMember]
public List<ReplyPackage> Packages { get; set; }
[DataMember]
public bool Response { get; set; }
[DataMember]
public RxNotification Notification { get; set; }
}
My problem is I did not find this ShipmentReply
class in WSDL
. What is the problem of mine?
Thank you, Arefin
Yes, that's normal for WCF. By default, WCF will show just the operations in the WSDL itself - the data structures are documented in XSD files that are linked to the WSDL file.
I'm betting if you look at your WSDL, you'll see something similar to this almost at the top of your WSDL:
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="http://localhost:8000/HelloIndigo?xsd=xsd0"
namespace="http://tempuri.org/" />
<xsd:import schemaLocation="http://localhost:8000/HelloIndigo?xsd=xsd1"
namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
<xsd:import schemaLocation="http://localhost:8000/HelloIndigo?xsd=xsd2"
namespace="http://schemas.datacontract.org/2004/07/WCF_Simple_Service" />
</xsd:schema>
These are links to the XSD files needed - type in the URL's into your browser, and one of them (most likely the one with the highest number - but doesn't have to be that one) will contain your complex type definition.
Try this URL in your browser (adapt the port and actual URL to what you have):
http://localhost:8080/HelloIndigo?xsd=xsd2
This should give you the XSD for your complex type
This feature has caused some issues over the past years - some clients cannot deal with this (100% correct and perfectly fine) syntax. So in .NET 4.5, WCF will have a new parameter (...?singlewsdl
) to output your entire WSDL including all XSD elements - see What's new in WCF 4.5? A single WSDL file for some more info on that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With