views:

1781

answers:

2

I just ported a project from Visual Studio 2005 format to Visual Studio 2008. This project makes heavy use of consuming web services.

We use our own custom parent class for the generated proxy classes (Reference.cs) that Visual Studio generates up.

I added a new web reference using Visual Studio 2008, and it did not generate the proxy class, just a reference.map file. It appears that perhaps it builds these on the fly. This won't work for my needs, as I need to modify the code to fit our framework.

Note, this is Web References, not service references.

Does anyone know of a way to make VS2k8 work like 2k5 for me?

A: 

Perhaps you ought to use svcutil.exe or wsdl.exe to generate proxy class files.

Andrew Hare
svcutil generates .net 3.0 and newer style proxy's. I still need the old 2.0 style that wsdl.exe generates.
FlySwat
Have you tried wsdl.exe then?
Andrew Hare
What do you think?
FlySwat
I don't know, that's why I asked. Nowhere in your post did you indicate that you had. Since you apparently have tried wsdl, perhaps you could edit your question to include details about why wsdl didn't work.
Andrew Hare
A: 

After a bit of mucking about, I found this post on the internet.

Turns out that the WSDL provided had a snippet like:

<wsdl:message name="someMessageRequest">
    <wsdl:part name="parameters" element="ns0:someMessageRequest"/>
</wsdl:message>
<wsdl:message name="someMessageResponse">
    <wsdl:part name="parameters" element="ns0:someMessageResponse"/>
</wsdl:message>

... SNIP ...

<soap:operation style="document" soapAction="someMessage"/>
<wsdl:input>
     <soap:body use="literal" parts="parameters"/>
</wsdl:input>
<wsdl:output>
     <soap:body use="literal" parts="parameters"/>
</wsdl:output>

Because it uses the same name for both request and response parameters, wsdl.exe is unable to resolve it and dies.

My fix:

<wsdl:message name="someMessageRequest">
    <wsdl:part name="parametersRequest" element="ns0:someMessageRequest"/>
</wsdl:message>
<wsdl:message name="someMessageResponse">
    <wsdl:part name="parametersResponse" element="ns0:someMessageResponse"/>
</wsdl:message>

... SNIP ...

<soap:operation style="document" soapAction="someMessage"/>
<wsdl:input>
     <soap:body use="literal" parts="parametersRequest"/>
</wsdl:input>
<wsdl:output>
     <soap:body use="literal" parts="parametersResponse"/>
</wsdl:output>

Now the proxy is generated.

Part of the fun of SoA is that you can never trust the WSDL's you are provided to work :)

FlySwat