WCF服务引用生成从WSDL无效的方法 [英] WCF service reference generates void methods from WSDL

查看:504
本文介绍了WCF服务引用生成从WSDL无效的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我第一次尝试尝试使用WCF,所以我猜我做得不正确。
我想在 HTTP访问由WSDL定义的SOAP服务:// confluence.atlassian.com/rpc/soap-axis/confluenceservice-v1?wsdl 我使用VS2010,我添加一个服务引用我的项目,它指向的URL有(或者说,我们的内网安装它),但是当我使用对象浏览器来查看服务,界面上的操作是不带参数ALL无效的方法。似乎WCF不正确读出的类型信息。它不给错误的,但它提供了大量的警告类似如下:

This is my first try trying to use WCF, so I'm guessing I'm doing something incorrect. I'm trying to access a soap service defined by the WSDL at http://confluence.atlassian.com/rpc/soap-axis/confluenceservice-v1?wsdl I'm using VS2010, and I add a Service Reference to my project and point it to the URL there (or rather, our intranet install of it), but when I use the Object Browser to view the service, the operations on the interface are ALL void methods with no parameters. It seems that WCF is not reading the type information correctly. It doesn't give errors, but it's giving tons of warnings like the following:

警告1自定义工具警告:故障

操作getPermissions命名InvalidSessionException不能输入
。不支持WSDL,故障
消息部分必须引用
元素。此故障消息并不
参考的元素。如果你有编辑
WSDL文档访问,您可以
通过参考使用'元素'
属性的
模式元素解决问题。 Z:\TestLibrary\Service
References\Confluence\Reference.svcmap 1 TestLibrary

Warning 1 Custom tool warning: Fault named InvalidSessionException in operation getPermissions cannot be imported. Unsupported WSDL, the fault message part must reference an element. This fault message does not reference an element. If you have edit access to the WSDL document, you can fix the problem by referencing a schema element using the 'element' attribute. Z:\TestLibrary\Service References\Confluence\Reference.svcmap 1 1 TestLibrary

报警2自定义工具警告:
可选的WSDL扩展元素身体$ b $从命名空间
b'http://schemas.xmlsoap.org/wsdl/soap/'
没有处理。 XPath的:
//wsdl:definitions[@targetNamespace='http://confluence.atlassian.com/rpc/soap-axis/confluenceservice-v1']/wsdl:binding[@name='confluenceservice-v1SoapBinding ] / WSDL:操作[@名称='getPermissions'] / WSDL:输入[@名称='getPermissionsRequest'] Z:\TestLibrary\Service
References\Confluence\Reference.svcmap 1 TestLibrary

Warning 2 Custom tool warning: The optional WSDL extension element 'body' from namespace 'http://schemas.xmlsoap.org/wsdl/soap/' was not handled. XPath: //wsdl:definitions[@targetNamespace='http://confluence.atlassian.com/rpc/soap-axis/confluenceservice-v1']/wsdl:binding[@name='confluenceservice-v1SoapBinding']/wsdl:operation[@name='getPermissions']/wsdl:input[@name='getPermissionsRequest'] Z:\TestLibrary\Service References\Confluence\Reference.svcmap 1 1 TestLibrary

我在做什么错了?我试图改变服务的配置与选项的组合,但我从来没有在类型从WSDL拉正确。我一直在假设WCF将与服务接口以及自动生成的类型等级。我应该弄清楚是在WSDL使用什么类型和创建类和数据收缩自己,或者是其他什么东西?

What am I doing wrong? I tried changing the config of the service with a combinations of options, but I could never pull in the types from the WSDL correctly. I've been assuming that WCF will auto-generate the type classes along with the service interface. Am I supposed to figure out what types are in use in the WSDL and create the classes and data contracts myself, or is it something else?

推荐答案

HHMM ...有趣 - 我跑 svcutil.exe的从针对您所提供的网址的命令行,而我得到一吨的警告有关WSDL的问题,我也得到了一些代码 - 是这样的:

Hhmm... interesting - I ran svcutil.exe from the command line against that URL you provided, and while I get a ton of warnings about WSDL issues, I do also get some code - something like:

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.4952
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(Namespace="http://confluence.atlassian.com/rpc/soap-axis/confluenceservice-v1", ConfigurationName="ConfluenceSoapService")]
public interface ConfluenceSoapService
{
    // CODEGEN: Generating message contract since the wrapper namespace (http://soap.rpc.confluence.atlassian.com) of message getPermissionsRequest does not match the default value (http://confluence.atlassian.com/rpc/soap-axis/confluenceservice-v1)
    [System.ServiceModel.OperationContractAttribute(Action="", ReplyAction="*")]
    [System.ServiceModel.XmlSerializerFormatAttribute(Style=System.ServiceModel.OperationFormatStyle.Rpc, Use=System.ServiceModel.OperationFormatUse.Encoded)]
    getPermissionsResponse getPermissions(getPermissionsRequest request);

    // CODEGEN: Generating message contract since the wrapper namespace (http://soap.rpc.confluence.atlassian.com) of message searchRequest does not match the default value (http://confluence.atlassian.com/rpc/soap-axis/confluenceservice-v1)
    [System.ServiceModel.OperationContractAttribute(Action="", ReplyAction="*")]
    [System.ServiceModel.XmlSerializerFormatAttribute(Style=System.ServiceModel.OperationFormatStyle.Rpc, Use=System.ServiceModel.OperationFormatUse.Encoded)]
    [System.ServiceModel.ServiceKnownTypeAttribute(typeof(RemoteException))]
    [System.ServiceModel.ServiceKnownTypeAttribute(typeof(Vector))]
    [System.ServiceModel.ServiceKnownTypeAttribute(typeof(RemotePermission))]
    [System.ServiceModel.ServiceKnownTypeAttribute(typeof(RemoteNodeStatus))]
    [System.ServiceModel.ServiceKnownTypeAttribute(typeof(RemotePageHistory))]
    [System.ServiceModel.ServiceKnownTypeAttribute(typeof(RemoteContentPermission))]
    [System.ServiceModel.ServiceKnownTypeAttribute(typeof(AbstractRemotePageSummary))]
    [System.ServiceModel.ServiceKnownTypeAttribute(typeof(RemoteSpaceSummary))]
    [System.ServiceModel.ServiceKnownTypeAttribute(typeof(RemoteSearchResult))]
    searchResponse search(searchRequest request);



所以,我会尝试使用 svcutil.exe的通过命令行来生成 ConfluenceSoapService.cs 文件,然后用它来跟你汇流服务。

So I would try to use svcutil.exe from the command line to generate your ConfluenceSoapService.cs file and then use that to talk to your Confluence service.

这篇关于WCF服务引用生成从WSDL无效的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆