Pergunta

I have a solution with two projects in VS2012. One is an old ASMX web service project and one is a DLL project called Utils.

The Web Service project makes alot of use of the Utils project and the idea is that this DLL will also be shipped to clients because they will need functionality from it as well.

So a WebMethod in the Web Service project looks like this:

using Utils;

[WebMethod]
[XmlType(Namespace = "http://url/invoice")]
public void CheckInvoice(CToken token) { ... }

So in this example the Web Method CheckInvoice expects an instance of class CToken, which is in the Utils namespace.

But when i generate the proxy class of the Web Service, then the exposed method CheckInvoice expects a CToken instance from the ServiceProxy namespace instead of the Utils namespace.

But the clients also have the Utils DLL. So how can i force generation of the proxy to use the CToken class from the Utils namespace and not from the (default) ServiceProxy namespace?

--

When i add the Service Reference then i checked the Reuse types in referenced assemblies checkbox and also Reuse types in all referenced assemblies. But this doesn't make any difference. Maybe this only works for WCF web services? I'm looking for a solution for ASMX web services.

Anyone any idea how to solve this problem?

Foi útil?

Solução

Been there ! I would love to know if there was a way of doing this properly as you described. However, I found a workaround which converts the new type into the desired type. See my post as a suggested answer here: Is it possible to convert an object to another object when both classes are identical?

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top