How to import this UBL schema?

Topics: General Discussion Forum, Service Factory Modeling Edition Forum
Apr 4, 2008 at 11:18 PM
Edited Apr 4, 2008 at 11:20 PM

I have a small WCF web service (Generated by the modelling tool and later modified to perform a test) and tried to create in the model an operation that would receive a string containing the ID of a Purchase Order , and in response it would send the purchass order, which is described by the UBL 2.0 Purchase Order schema.

I modelled the test to use DataContractSerializer as its serializer, and when I try to validate all, it gives this error:
Error	2	The file name 'UBL-Order-2.0.xsd' is not compliant with the DataContractSerializer. Type 'OrderType' in namespace 'urn:oasis:names:specification:ubl:schema:xsd:Order-2' cannot be imported. Ref to element 'UBLExtensions' in 'urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2' namespace is not supported. Either change the schema so that the types can map to data contract types or use ImportXmlType or use a different serializer.	C:\SFHOL\MyOwn\MX2_WS_Tests\MX2_WS_Tests\VendorMgmt.servicecontract	0	1	MX2_WS_Tests

Now, I tried changing the serializer type to XmlSerializer, but then when validating I get the following error.

Error	2	You must use the DataContractSerializer on the Service Contract model since there are message contracts on the Service contract model referencing a Data Contract Model which uses the WCF extender	C:\SFHOL\MyOwn\MX2_WS_Tests\MX2_WS_Tests\VendorMgmt.servicecontract	0	1	MX2_WS_Tests

I cannot change the schema because it woulb be agaisnt the purpose of using a standar schema.

After changing all the extensions to be ASMX instead of WCF, it compiled ok and validated OK (i havent run it yet). The problem is that I need the project to use WCF extensions (to be able to use the secutiry features).

What options do I have?

Thanks a lot!

Apr 7, 2008 at 3:31 PM
From what you describe, it seems that you have in you SC model both references to DC (in your DC model) and XSD Message/s poiting to your schema. You may change to XmlSerializer and get your schema generate code but you should remove your DC references (and ideally add them to your schema).
The problem here is that your schema does not support DCSerialization and at the same time you have refs to DCs. Another solution may be update your shcema in order to support DCSerializer but as you mentioned, you cannot do this so I would go with the first option.
Jan 28, 2013 at 1:53 PM
Edited Jan 28, 2013 at 1:53 PM

I have just successfully generated proxies and objects using UBL 2.0. We hand craft our wsdl specifications for ws2007* binding and host them together with the XSD's on a standard web server. The resources are then included as WEB references in a standard VS project.

Since UBL 2.0 uses elements and not attributes, the DataContractSerializer should be fine. I have tested the hosting of and the calling of a service.

I can see the generated objects and types and the service executes with no problems.