using xsd.exe to generate c# files from ereg association - c#

I am trying to convert the XSD to some C# classes. I've done this with plenty of other files, but I am wondering why this one is not working.
The schema information contains a link in the download section to the XSD file which I've downloaded to my local disk. Then ran the XSD command from the ms dev tools.
This is the dump from the command prompt:
C:\temp\XSD>xsd version-13-draft-ivi-xsd-scheme.xsd /classes /namespace:MyNamespace
Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 4.6.1055.0]
Copyright (C) Microsoft Corporation. All rights reserved.
Schema validation warning: The 'http://www.w3.org/2000/09/xmldsig:Signature' element is not declared. Line 17, position 5.
Warning: Schema could not be validated. Class generation may fail or may produce incorrect results.
Error: Error generating classes for schema 'version-13-draft-ivi-xsd-scheme'.
- The element 'http://www.w3.org/2000/09/xmldsig#:Signature' is missing.
If you would like more help, please type "xsd /?".
It seems like the XSD validator can not download the signature namespace. But I an not sure what exactly is happening. Can someone explain what is going wrong?

Download http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd to your local directory, and add it as another parameter to your command:
xsd version-13-draft-ivi-xsd-scheme.xsd xmldsig-core-schema.xsd /Classes
The xsd you are wanting to import contains a reference to that file, on line 7:
<xs:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema.xsd"/>

Related

SSIS C# OpenXML to generate Excel File Failing

I am using OpenXML to generate Excel file using C# in an SSIS package.
I did this because we do not have Excel installed on the Server so this should work without needing Excel installed.
This works locally, but is failing when moving to the PROD server. It is failing on the script task and I am getting this error:
Executed as user: MI\SQLAgentAccount. Microsoft (R) SQL Server Execute Package Utility Version 11.0.5058.0 for 64-bit Copyright (C) Microsoft Corporation. All rights reserved. Started: 10:46:49 AM Error: 2015-10-15 10:46:50.49 Code: 0x00000001 Source: Save To Excel Without Excel Description: Exception has been thrown by the target of an invocation. End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 10:46:49 AM Finished: 10:46:50 AM Elapsed: 0.827 seconds. The package execution failed. The step failed.
I am including in the references the OpenXML and WindowBase objects and adding them with the "using" statements.
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Spreadsheet;
Do these need to be registered with the GAC? Or is there a way to include them in the project (inside the script task within SSIS)? There is the setting for "Copy To Local" inside the C# script task in SSIS, but not sure what/how this would work inside SSIS.
Any help would be appreciated.
Yes, you need to ensure you have it available from the GAC and also copy the assembly to C:\WINDOWS\Microsoft.NET\Framework\
Just doing some research on this myself and found the following link that confirmed the issue and resolution:
http://beyondrelational.com/modules/2/blogs/81/posts/11263/referencing-an-assembly-inside-ssis-script-task.aspx

How to use proxy authentication with xsd.exe

I'm trying to use xsd.exe to create a c# class. In particular I'm trying to use http://schemas.opengis.net/wms/1.1.1/capabilities_1_1_1.xml to generate the xsd to then generate the class. I managed to get a class from the 1.3.0 version of the specification via xsd.exe in windows command line but when I try to do the same for this version I get a proxy authentication error like below.
Does anyone know why I would be getting this error when I didn't for the other translation? Also if it really is my proxy blocking xsd then how do I tell xsd to use my credentials for http requests?
![Proxy error image][2]
Let me know if you need more information. Thanks for your time in advance
[2]: http://i.stack.imgur.com/CIbHM.jpg
EDIT: The image doesn't seem to be working for me so I'll just write the error message -
C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin>xsd.exe capabilities_1_1_1.xml
Microsoft (R) XML Schemas/Datatypes support utility
[Microsoft (R) .NET Framework, Version 2.0.50727.3038]
Copyright (C) Microsoft Corporation. All Rights Reserved.
Error: There was an error processing 'capabilities_1_1_1.xml".
- The remote server returned an error: (407) Proxy Authentication Required.
If you would like more help, please type "xsd /?".
For this one I figured out that the WMS.xml provided by the OGC does NOT have all it's namespaces working correctly. In particular one of the URL references (http://www.digitalearth.gov/wmt/xml/capabilities_1_1_1.dtd) does NOT exist anymore which was confusing my network hence returning a 407 proxy authentication required error.
THE SOLUTION:
Change the DTD referenced in OGCs capabilities.xml file to point to the DTD on their website. Why it doesn't already point to that by default I DO NOT KNOW. digitalearth.gov looks like it's been down since 2006 so it's very old. Anyway once the reference for the DTD was changed I was able to create the XSD and c# class with ease.

How can I correct the WSDL when the policy expression's "normalized form was too large"

So - I've been tasked with creating a proxy client to the following service, but I'm having a heck of a time generating a client that's happy with the requirements. The WSDL is located here: https://ws.conf.ebs.health.gov.on.ca:1441/EDTService/EDTService?wsdl
When I run svcutil, I get the following output:
C:\Temp>"C:\Program Files (x86)\Microsof
t SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\svcutil.exe" /t:code https://ws.conf.
ebs.health.gov.on.ca:1441/EDTService/EDTService?wsdl /out:ebs.cs /config:ebs.con
fig
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 4.0.30319.32559]
Copyright (c) Microsoft Corporation. All rights reserved.
Attempting to download metadata from 'https://ws.conf.ebs.health.gov.on.ca:1441/
EDTService/EDTService?wsdl' using WS-Metadata Exchange or DISCO.
Warning: The policy expression was not fully imported because its normalized for
m was too large.
XPath:"XPath Unavailable"
Error: Cannot import wsdl:binding
Detail: Object reference not set to an instance of an object.
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://edt.health.on
tario.ca/']/wsdl:binding[#name='EDTPortBinding']
Error: Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is depend
ent on.
XPath to wsdl:binding: //wsdl:definitions[#targetNamespace='http://edt.health.on
tario.ca/']/wsdl:binding[#name='EDTPortBinding']
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://edt.health.on
tario.ca/']/wsdl:service[#name='EDTService']/wsdl:port[#name='EDTPort']
Error: Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is depend
ent on.
XPath to wsdl:binding: //wsdl:definitions[#targetNamespace='http://edt.health.on
tario.ca/']/wsdl:binding[#name='EDTPortBinding']
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://edt.health.on
tario.ca/']/wsdl:service[#name='EDTService']/wsdl:port[#name='EDTPort.2']
I've tried the same command using versions: 3.0.4506.2152, 4.0.30319.18020 and 4.0.30319.32559 with the same outcome. Any ideas?
I have created a proxy using WSDL.exe (inheriting from Microsoft.Web.Services3.WebServicesClientProtocol) at some point but I've had to config everything myself and I'm running into exceptions every time I receive a response (catch the exception, decrypt the response body manually and repeat). Also, I have to use MTOM which makes this custom code work even less.

sqlmetal.exe returns Using the generic type 'System.Data.Linq.Table' requires 1 type arguments

I am using sqlmetal.exr to generate the mapping code for me. I am calling sql metal by using.
cd C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin
SqlMetal.exe /server:servername\SQL /database:mydb /code:mycode.cs
The output is a cs file and the command promt says:
Microsoft (R) Database Mapping Generator 2008 version 1.00.30729 for
Microsoft (R) .NET Framework version 3.5 Copyright (C) Microsoft
Corporation. All rights reserved.
When I add the file to my project and try to build it I get the following error:
Using the generic type 'System.Data.Linq.Table' requires 1 type
arguments
This is in my mycode.cs file. I am referencing System.Data.Linq and System.Data. What referennce is missing to get this to work?
Update
Make sure you have System.Data.Linq in your GAC and that the assembly
version is 3.5.0.0. Also make sure that's the version your project is
referencing.
Double-check that your application's target framework hasn't somehow
been changed to something other than 3.5. The Linq To SQL features
only work with the 3.5 framework.
if the problem persist here are a list of things you can try to resolve the issue
A few things to check/try:
Make sure you have System.Data.Linq in your GAC and that the assembly version is 3.5.0.0. Also make sure that's the version your project is referencing.
When you look at the project references is there a yellow "!" icon next to the reference? If so, that indicates that the version of System.Data.Linq your project references is not being found by VS. You should try deleting the reference and adding a new one.
Double-check that your application's target framework hasn't somehow been changed to something other than 3.5. The Linq To SQL features only work with the 3.5 framework.

svcutil.exe - Error: Cannot import wsdl:portType

I have to integrate several existing webservices in my .net application. But unfortunately, invoking the svcutil tool results in an error with the message:
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.2152]
Copyright (c) Microsoft Corporation. All rights reserved.
Error: Cannot import wsdl:binding
Detail: Cannot find definition for http://grupobancolombia.com/intf/Clientes/GestionClientes/EnviarRespuestaVerificarIdentidadCliente/V1.0:EnviarRespuestaVerifi
carIdentidadCliente. Service Description with namespace http://grupobancolombia.com/intf/Clientes/GestionClientes/EnviarRespuestaVerificarIdentidadCliente/V1.0
is missing.
Parameter name: name
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://grupobancolombia.com/intf/Clientes/GestionClientes/EnviarRespuestaVerificarIdentidadCliente/E
nlace/V1.0']/wsdl:binding[#name='EnviarRespuestaVerificarIdentidadCliente_HttpBinding']
Error: 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://grupobancolombia.com/intf/Clientes/GestionClientes/EnviarRespuestaVerificarIdentidadCliente/E
nlace/V1.0']/wsdl:binding[#name='EnviarRespuestaVerificarIdentidadCliente_HttpBinding']
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://grupobancolombia.com/intf/Clientes/GestionClientes/EnviarRespuestaVerificarIdentidadCliente/E
nlace/V1.0']/wsdl:service[#name='EnviarRespuestaVerificarIdentidadCliente']/wsdl:port[#name='EnviarRespuestaVerificarIdentidadCliente_HttpPort']
Generating files...
Warning: No code was generated.
If you were trying to generate a client, this could be because the metadata documents did not contain any valid contracts or services
or because all contracts/services were discovered to exist in /reference assemblies. Verify that you passed all the metadata documents to the tool.
Warning: If you would like to generate data contracts from schemas make sure to use the /dataContractOnly option.
Has anyone an idea what causes this problem?
I'm seeing the same issue. I have a set of 30-odd wsdl files in a folder and am trying to create C# client classes for them all.
If I do the following
svcutil /noconfig /namespace:*,My.Required.Namespace *.wsdl
I see a lot of the error you mention (Cannot import wsdl:binding).
However, picking one file at a time
svcutil /noconfig /namespace:*,My.Required.Namespace a.wsdl
Frequently works; sometimes I have to include another file, e.g.
svcutil /noconfig /namespace:*,My.Required.Namespace b.wsdl c.wsdl
This is necessary when attempting to run svcutil on b.wsdl fails due to a dependency on c.wsdl.
Bottom line: I am not sure why I can't create contracts for all of these service definitions in one go, but it doesn't seem possible. I still have a big problem with shared types across the files; this means I effectively have to edit either third-party wsdl or the automatically generated code in order to get things to compile and run correctly.

Categories