1

I've already posted this topic several times, but no luck. I'll try again.

We have a project where we should create WCF service based on XSD files we get from our client and fixed service contract that looks as following:

Message CustomAction(Message inputMessage);

So, the operation will be the same, but XSD files will change.

All that we should do programmatically.

Here are my questions:

1) How to programmatically create WSDL file from XSD files knowing how service would look like (see above)?

2) How to use WSDL file generated in 1) to create WCF service programmatically?

3) How to read the body of input/request and output/response SOAP messages from the service above?

There is more than 1 approach and I don't know which one is right. I'm not close to solution.

There's an approach to write WSDL file programmatically using ServiceDescription class, but it's complicated, how to do it correctly, what to do after creation of WSDL file, etc.

There's an approach to use IXmlSerializable interface, but I don't need to create C# types because I only have XSD files. Everything should be done programmatically.

I suppose I should use raw messages, but how to connect that approach with existing XSD files from which I should create WSDL file and how to pass that WSDL file to... where?

Thank you in advance.

Regards,

Goran

tesicg
  • 3,971
  • 16
  • 62
  • 121
  • You're wrong. The questions are in correlation, which means they are going together. I've searched the internet a lot, found something similar, but not the same, asked some people - no help. Therefore, I've asked exactly what I don't know how to do. I think people don't know the answer, but I'll try once again. Maybe somebody would help in some way. I know the task is not simple, but that's the task. Thank you. – tesicg Oct 09 '12 at 07:04
  • If the task is not simple then perhaps the task is wrong. You need to think if you have searched a lot for a solution and there is none then maybe you should be questioning your whole approach. – tom redfern Oct 09 '12 at 07:22
  • Ok. I've edited my original post and added some details what I've tried so far. – tesicg Oct 09 '12 at 07:22
  • @hugh, That's exactly why I didn't mention what I've tried to do. The task is not simple at all, but I don't know if it's wrong. So, I'm asking here if somebody can help in some way. – tesicg Oct 09 '12 at 07:24

1 Answers1

0

You should probably at this point question whether you are asking the right questions. You have posted 4 times about this problem already (1), (2), (3), but not once have you actually explained, in plain language, what you are trying to achieve.

If you just ask for a solution without sharing your problem then it's difficult for people to answer properly.

Yes what you want to do is possible, but it's not something I'd like to attempt myself.

In answer to your questions:

  1. This is exactly what WSCF.blue does. Go download their sourcecode.

  2. Using powershell or some other automation environment, run the wsdl against svcutil.exe and generate the types to be exposed on the service. Then compile the code. Then inject the types into the service code as dependencies using some kind of IoC container at runtime (I think Castle Windsor has a load of WCF integration).

  3. Using powershell or some other automation environment, point svcutil.exe at your running service and generate a code proxy. Compile code then inject proxy into your client code at runtime similar to above.

Community
  • 1
  • 1
tom redfern
  • 30,562
  • 14
  • 91
  • 126
  • 1. WSCF.blue is Visual Studio Add-In. I've tried it and it works. But, it doesn't fit to our case because everything should be done programmaticaly. We use VS2008 and .NET Framework 3.5. – tesicg Oct 09 '12 at 07:55
  • 2. and 3. We can't go to 2. and 3. because we can't pass 1. How to create WSDL programmatically using only XSD files and fixed service contract? – tesicg Oct 09 '12 at 07:57
  • What I mean is that WSCF.blue has already solved this problem, so the answer must be in their source code. – tom redfern Oct 09 '12 at 08:24
  • 1
    the key point i'd take from this answer is this: "If you just ask for a solution without sharing your problem then it's difficult for people to answer properly. " – Chris Oct 09 '12 at 10:16
  • Ok Chris. I agree. I've written everything in original post now. I know this problem is really unusual and I'm trying to explain it. For example, let's take just this - how to use existing WSDL file to programmatically create WCF service. I can't find any code example on internet. – tesicg Oct 09 '12 at 10:47