- xml - AJAX/Jquery XML 解析
- 具有多重继承的 XML 模式
- .net - 枚举序列化 Json 与 XML
- XML 简单类型、简单内容、复杂类型、复杂内容
我收到了带有一堆 XSD 的 WSDL,我正在使用它们来创建 WCF 服务。我正在使用 svcutil.exe 生成服务类,基本上一切正常 - 除了服务不公开任何方法。
从 svcutil 生成的 .cs 文件包含以下接口(interface):
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(Namespace="http://serviceplatformen.dk/xml/wsdl/soap11/DistributionService/1/port", ConfigurationName="DistributionReceiverWebServicePort")]
public interface DistributionReceiverWebServicePort
{
[System.ServiceModel.OperationContractAttribute(Action="", ReplyAction="*")]
[System.ServiceModel.FaultContractAttribute(typeof(serviceplatformen.dk.xml.wsdl.soap11.DistributionService._1.types.TransportkvitteringType), Action="", Name="TransportKvittering", Namespace="http://serviceplatformen.dk/xml/wsdl/soap11/DistributionService/1/types")]
[System.ServiceModel.XmlSerializerFormatAttribute()]
FordelingsobjektModtagResponse FordelingsobjektModtag(FordelingsobjektModtagRequest request);
}
有问题的类型如下所示:
[System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "4.0.30319.33440")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://serviceplatformen.dk/xml/wsdl/soap11/DistributionService/1/types")]
public partial class ForretningskvitteringType
{
private ForretningsValideringsKodeType forretningsValideringsKodeField;
private string begrundelseField;
private FejlType[] fejlListeField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Order=1)]
public string Begrundelse
{
get
{
return this.begrundelseField;
}
set
{
this.begrundelseField = value;
}
}
...
}
我注意到没有任何类型是用 DataContract/DataMember 属性修饰的。这是必需的,还是类型的其他属性涵盖了它们?
我的服务(没有任何操作)暴露的 WSDL 是这样的:
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions name="FKService" targetNamespace="http://serviceplatformen.dk/xml/wsdl/soap11/DistributionService/1/port" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://serviceplatformen.dk/xml/wsdl/soap11/DistributionService/1/port" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
<wsp:Policy wsu:Id="MetadataExchangeHttpBinding_DistributionReceiverWebServicePort_policy">
<wsp:ExactlyOne>
<wsp:All>
<wsaw:UsingAddressing/>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
<wsdl:types/>
<wsdl:portType name="DistributionReceiverWebServicePort"/>
<wsdl:binding name="BasicHttpBinding_DistributionReceiverWebServicePort" type="tns:DistributionReceiverWebServicePort">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
</wsdl:binding>
<wsdl:binding name="MetadataExchangeHttpBinding_DistributionReceiverWebServicePort" type="tns:DistributionReceiverWebServicePort">
<wsp:PolicyReference URI="#MetadataExchangeHttpBinding_DistributionReceiverWebServicePort_policy"/>
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
</wsdl:binding>
<wsdl:service name="FKService">
<wsdl:port name="BasicHttpBinding_DistributionReceiverWebServicePort" binding="tns:BasicHttpBinding_DistributionReceiverWebServicePort">
<soap:address location="http://localhost:8082/FKService/"/>
</wsdl:port>
<wsdl:port name="MetadataExchangeHttpBinding_DistributionReceiverWebServicePort" binding="tns:MetadataExchangeHttpBinding_DistributionReceiverWebServicePort">
<soap12:address location="http://localhost:8082/FKService/mex"/>
<wsa10:EndpointReference>
<wsa10:Address>http://localhost:8082/FKService/mex</wsa10:Address>
</wsa10:EndpointReference>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
我想我遗漏了一些非常明显的东西,但是什么?
最佳答案
显然 svcutil 将 ReplyAction="*"添加到操作合约中,这导致了奇怪的行为。
删除 OperationContractAttribute
的规范后,问题就消失了。
[System.ServiceModel.ServiceContractAttribute(Namespace="http://tempuri.org/xml/wsdl/soap11/DistributionService/1/port", ConfigurationName="DistributionReceiverWebServicePort")]
public interface DistributionReceiverWebServicePort
{
[System.ServiceModel.OperationContractAttribute(Action="")]
[System.ServiceModel.FaultContractAttribute(typeof(TransportkvitteringType), Action="", Name="TransportKvittering", Namespace="http://tempuri.org/xml/wsdl/soap11/DistributionService/1/types")]
[System.ServiceModel.XmlSerializerFormatAttribute()]
FordelingsobjektModtagResponse FordelingsobjektModtag(FordelingsobjektModtagRequest request);
}
另见
https://shishkin.wordpress.com/2007/03/21/wcf-actions-asterisk-and-metadata/
和
关于xml - WCF 契约(Contract)第一个 : No methods are exposed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28365682/
我正在尝试构建某种形式的动态 Corda 合约,该合约具有一个可以保存独立合约列表和这些合约的独立状态的状态。 为了揭开这个概念的神秘面纱,请将“动态 Corda 合约”视为一个抽象类,它具有 Lis
怀念Collections.unmodifiableMap(),我一直在实现基于this discussion 的只读IDictionary 包装器,我的单元测试很快就遇到了问题: Assert.Ar
在消费者测试结束时我需要执行两个步骤: 完成模拟服务器 将协议(protocol)发布给经纪人。 一开始我是先发布再定稿,像这样: var opts = { //broker info } pac
关闭。这个问题是opinion-based .它目前不接受答案。 想要改进这个问题? 更新问题,以便 editing this post 可以用事实和引用来回答它. 关闭 3 年前。 Improve
您好, WCF 中数据/服务契约(Contract)的默认命名空间是 "http://tempuri.org/" .通过设置 ServiceContract.Namespace和 ServiceBeh
Using Attachments页面状态: Attachments are ZIP/JAR files referenced from a transaction by hash, but not
说我有一个方法 public void PrintStuff(string stuff, Color color, PageDimensions dimensions) { Assert.I
Mortgage.new({ from: ownerAccount, gas: defaultGas }).then( function(loanInstance) { loa
有很多问题询问是否混合异步和同步代码。 大多数答案都说为异步方法公开同步包装器和为同步方法公开异步包装器是个坏主意。 但是,没有一个答案解决您必须混合使用异步和同步代码的特定场景,以及如何避免由此产生
我是来自 PHP/Larvel、Ruby/Rails 和 Python/Django 的 Spring 新手。来自这些框架,我习惯于只看到模型(Entity/Dao?),其他一切都由 Framewor
我正在尝试为一些广泛使用的接口(interface)编写契约(Contract)测试: 沿着: public abstract class MyInterfaceContractTest extend
这是来自自定义 Microsoft .NET 运行时实现的代码,我有以下问题: public static string ToBase64String(byte[] inArray, int
我正在用遗留代码重构一个巨大的 C 库,其中许多函数在参数列表上都有指针。我还为新创建的函数编写单元测试以确保我没有破坏任何东西(除了来自单元测试的所有好东西,这是我的主要动机)。我也不允许更改库的
我的类有一个内部属性返回 List ,并且我想使用静态检查来帮助我不在我的程序集中做任何愚蠢的事情,并可能向该集合添加 null。 我在 foreach 的循环变量上收到这个静态警告在属性(prope
我在这个问题上花了几个小时...这是我的代码: public static IEnumerable Generate(this Func generator) where T : class {
我有兴趣了解更多关于contract-first 网络服务的信息,包括如何将它们组合在一起。 谁能推荐有用的资源来解释所需的方面/组件以及如何生成它们? 除了 Spring 的契约优先 Web 服务之
我刚刚将我的联系方式、银行和税务详细信息上传到 iTunes Connect;这个处理通常需要多长时间?我只能找到 5 年以上的信息。 最佳答案 契约(Contract)审核过程大约需要 20 分钟。
假设我们有一个类 Student使用以下构造函数: /** Initializes a student instance. * @param matrNr matriculation numb
使用 CXF 创建契约(Contract)最后的 Web 服务似乎是快速创建基于 SOAP 或 REST 的 Web 服务的有效方式。但是,我不清楚/不确定以下内容,非常感谢您提供见解/反馈: con
引自 Effective Java - Second Edition by Joshua Bloch For floating-point fields, use Double.compare or
我是一名优秀的程序员,十分优秀!