Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
446 views
in Technique[技术] by (71.8m points)

wsdl - WCF: Svcutil generates invalid client proxy, Apache AXIS Web Service, overload operations

I'm using a 3rd party web service written in Java and using Apache Axis 1.3. The service has many overload operations. When the WCF Svcutil generates the proxy, it renames the overloaded operation by appending a number after the operation name. For example:

getDataResponse getData(getDataRequest request);

getDataResponse1 getData1(getDataRequest1 request);

This by itself isn't a problem, but when Svcutil generates the request/response messages, it neglects to change the WrapperName property of the MessageContracts.

    [MessageContractAttribute(
        WrapperName = "getData", 
        WrapperNamespace = "http://namespace.com", 
        IsWrapped = true)]
    public partial class getDataRequest1 {  ..  }

When the client application attempts to open the proxy, the following exception is thrown:

InvalidOperationException: RPC Message getDataRequest1 in operation getData1 has an invalid body name getData. It must be getData1

If I change WrapperName = "getData1" the proxy will open, however...

  1. I am unable to call the operation because the service doesn't recognize "getData1"
  2. The service has almost 1100 operations, of which nearly half are overloads

Is there any way to generate and/or modify the proxy so that all operations work with WCF?

Mark

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

For what it is worth (4 years later), it seems that by calling WSDL.exe manually and passing the /protocol:SOAP parameter, this problem can be avoided. Generating a service client through the UI still seems to cause this issue as of VS2012 for services generated by Apache Axis.

Example usage:

c:Program FilesMicrosoft SDKsWindowsv7.1BinNETFX 4.0 Tools>wsdl /l:cs /protocol:SOAP http://rxnav.nlm.nih.gov/RxNormDBService.xml /out:c:drop
xnavapi.cs

Edit: sphinxxx correctly noted that the SOAP protocol option is exposed in UI as "Add Web Reference", so executing wsdl.exe directly is not necessary.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...