Ryan Britton - 335 - Jan 3, 2014

I have a quick question regarding SOAP 1.2 integration via the “Add Service Reference” dialog in Visual Studio. I can access the service in question without any issues using the JsonClient, but when I try to forgo the client and integrate directly using the VS proxy generator I get the following error :

Warning 49 Custom tool warning: Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on.
XPath to wsdl:binding: //wsdl:definitions[@targetNamespace=‘http://api.fnf.co.za/types’]/wsdl:binding[@name=‘WSHttpBinding_IMosaicApi’]
XPath to Error Source: //wsdl:definitions[@targetNamespace=‘http://api.fnf.co.za/types’]/wsdl:service[@name=‘MosaicApiSyncReply’]/wsdl:port[@name=‘WSHttpBinding_IMosaicApi’]

I have read the article on SOAP support on GitHub (https://github.com/ServiceStack/ServiceStack/wiki/SOAP-support) and changed the WSDL namespace as described in this article, then applied correctly namespaced DataContract and DataMember attributes to all of my DTOs and entities - but I am still getting this error.

I’ve published a temporary, reduced version of my service to http://api.fnf.co.za/ where you can see the WSDL.

Any assistance would be greatly appreciated.

Can we see a copy of the DTO’s? Also the http://api.fnf.co.za/ link doesn’t work from here.

Ryan Britton:

 here you go. I’ve included the base classes as well. 

 --------------------------------------------------------------
  [Route("/induction/shipmentandparcels", “POST”)]
    [Api(“induct a shipment and all of its associated parcels”)]
    [DataContract(Namespace = “http://api.fnf.co.za/types”)]
    public class InductShipmentAndParcels : InductShipmentAndParcelsCommand, IReturn<InductShipmentAndParcelsResponse>
    {
        
    }
--------------------------------------------------------------
    [DataContract]
    public class InductShipmentAndParcelsResponse : InductShipmentAndParcelsCommandResult
    {
        
    }
  --------------------------------------------------------------
[DataContract(Namespace=“http://api.fnf.co.za/types”)]
    public class InductShipmentAndParcelsCommand : ICommand<InductShipmentAndParcelsCommandResult>
    {
        [DataMember]
        public string ImportBatchIdentifier { get; set; }
        [DataMember]
        public ShipmentInfo ShipmentInfo { get; set; }
        [DataMember]
        public InsuranceInfo InsuranceInfo { get; set; }
        [DataMember]
        public ContactInfo SenderInfo { get; set; }
        [DataMember]
        public ContactInfo RecipientInfo { get; set; }
        [DataMember]
        public AddressInfo DeliveryAddressInfo { get; set; }
        [DataMember]
        public AddressInfo CollectionAddressInfo { get; set; }
        [DataMember]
        public List<ParcelInfo> ParcelsInfo { get; set; }
        [DataMember]
        public WaybillInfo WaybillInfo { get; set; }
        [DataMember]
        public string AccountCode { get; set; }
        [DataMember]
        public string ServiceCode { get; set; }
    }
 --------------------------------------------------------------
    [DataContract(Namespace=“http://api.fnf.co.za/types”)]
    public class InductShipmentAndParcelsCommandResult : ICommandResult
    {
        [DataMember]
        public string WaybillNumber { get; set; }
        [DataMember]
        public bool WasDuplicate { get; set; }
    }
--------------------------------------------------------------

An issue might be trying to use inheritance in SOAP, it’s very brittle and you would need to use the [KnownType] markers on each base class so the WCF serializer can find all the impls, but I’d recommend against using inheritance at all. 

Ryan Britton:

ok - thanks Demis. I’ll encapsulate the command rather than inheriting from it and see if that works…

Dan Barua:

It seems counterintuitive but it’s ok to violate DRY when designing messaging DTOs. http://blog.ploeh.dk/2011/05/31/AttheBoundaries,ApplicationsareNotObject-Oriented/