标签: wscf

为什么我的WCF客户端/服务会收到ActionNotSupportedException?

我正在学习WCF,特别是我正在学习如何将它们写成合同,ala wscf.blue

我可以创建一个WCF客户端/服务合同的最后一种方式(微软)我可以创建一个WCF客户端/服务合同的第一种方式(WSCF)

但是,如果我创建合同第一个服务,然后尝试添加Microsoft方式(服务参考)而不是WSCF.blue方式(共享合同和生成客户端)它不起作用.

它会抛出一条ActionNotSupportedException消息The message with Action 'urn:test-com:simple:testMethodIn' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).

我不知道这意味着什么.

这是我的测试合同:

SimpleModel.xsd

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns="urn:test-com:simple" xmlns:mstns="urn:test-com:simple" …
Run Code Online (Sandbox Code Playgroud)

c# wcf svcutil.exe wscf xmlserializer

13
推荐指数
1
解决办法
8349
查看次数

从WCF中的WSDL生成代码保持返回消息与默认值不匹配

好吧,这让我疯了.我一直在尝试从预定义的wsdl构建服务实现代码,并且它一直在服务契约/接口上返回一条消息:

// CODEGEN: Generating message contract since the wrapper name (GetMetricsRequest) of message GetMetricsRequest does not match the default value (GetMetrics)

    [System.ServiceModel.OperationContractAttribute(Action="GetMetrics", ReplyAction="*")]
    [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)]
    GetMetricsResponse GetMetrics(GetMetricsRequest request);
Run Code Online (Sandbox Code Playgroud)

我尝试使用svcutil.exe和WSCF的Generate Service代码向导执行此操作,并且都返回相同的结果.

下面是我正在使用的WSDL.我在这里添加了类型,我确实把它们分成了一个单独的xsd,只是不想发布它们.使用此wsdl(嵌入了所有类型)也会产生相同的问题.

我已经回顾了这篇博客文章(http://pzf.fremantle.org/2007/05/handlign.html),这是我能找到的关于这个问题的全部内容.我想我已经完成了它要做的一切,但我仍然遇到问题.

还有其他人遇到过这个吗?这真是令人生气,也许我错过了一些明显的东西.任何帮助将不胜感激.

<wsdl:definitions
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
 xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
 xmlns:xs="http://www.w3.org/2001/XMLSchema"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:tns="urn:MyNameSpace:V1_0"        


 targetNamespace="urn:MyNameSpace:V1_0">


 <wsdl:types>
  <xs:schema targetNamespace="urn:MyNameSpace:V1_0">
   <xs:element name="GetMetricsRequest">
    <xs:complexType>
     <xs:sequence>
      <xs:element  nillable="true" name="GetMetricRequestElement" type="tns:GetMetricRequestType"/>
     </xs:sequence>
    </xs:complexType>
   </xs:element>   
   <xs:element name="GetMetricResponse">
    <xs:complexType>
     <xs:sequence>
      <xs:element  nillable="true" maxOccurs="unbounded" name="GetMetricResponseElement" type="tns:GetMetricResponseType"/>
     </xs:sequence>
    </xs:complexType>
   </xs:element>

   <xs:complexType name="GetMetricResponseType">
    <xs:sequence>
     <xs:element  nillable="true" name="Metrics" type="tns:MetricsType"/>
    </xs:sequence>
   </xs:complexType>

   <xs:complexType name="GetMetricRequestType">
    <xs:sequence>
     <xs:element …
Run Code Online (Sandbox Code Playgroud)

c# wcf wsdl svcutil.exe wscf

7
推荐指数
1
解决办法
8429
查看次数

像在XSD中一样使用精确命名空间生成DataContracts

我们必须将我们的项目与后端Oracle平台集成.这种集成是通过各种Web服务实现的.我有所有这些集成的WSDL和XSD.我需要从这些WSDL和XSD生成DataContracts.
现在的问题是,大多数这些集成共享一些常见的数据类型.我想重复使用它们.
例如,

Integration1: oracle/common/commonDataTypes.xsd
              oracle/integration1/someXSD.xsd
              oracle/ebo/baseTypes.xsd
Integration2: oracle/common/commonDataTypes.xsd
              oracle/integration2/someXSD.xsd
              oracle/ebo/baseTypes.xsd
Integration3: oracle/commonDataTypes.xsd
              oracle/integration2/someXSD.xsd
              oracle/ebo/baseTypes.xsd

在这种情况下,我想在integration1和2之间重用oracle.common.CommonDataTypes.
到目前为止,我已经尝试了WSCF.blue和WSCF.但是这些工具在单个文件夹(和单个命名空间)中生成所有代码而不遵循命名空间.
我想下生成像甲骨文,oracle.commonData,oracle.integration1命名空间类,oracle.ebo等,所以是生成Datacontracts任何方式如下确切的命名空间的符号为XSD文件有哪些?

c# xsd wsdl wscf

5
推荐指数
1
解决办法
1172
查看次数

.NET中的XmlSerializer与XmlSchemaForm.Unqualified

鉴于以下代码:

using System;
using System.Xml.Schema;
using System.Xml.Serialization;

namespace XmlSerializationTest
{
    [XmlType(Namespace = "http://www.test.com")]
    public class Element
    {
        [XmlElement]
        public int X;
    }

    [XmlRoot(Namespace = "http://www.test.com")]
    public class Root
    {
        [XmlElement(Form = XmlSchemaForm.Unqualified)]
        public Element Element;
    }

    public static class Program
    {
        public static void Main(string[] args)
        {
            var root = new Root { Element = new Element { X = 1 } };
            var xmlSerializer = new XmlSerializer(typeof(Root));
            xmlSerializer.Serialize(Console.Out, root);
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

输出是:

<?xml version="1.0" encoding="ibm852"?>
<Root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" …
Run Code Online (Sandbox Code Playgroud)

.net c# xml-serialization xml-namespaces wscf

5
推荐指数
1
解决办法
7111
查看次数

从WSDL生成服务合同

我有一个WSDL,我需要生成一个ServiceContract(OperationContract,DataContract)...

我找到了一种方法为ASMX WebServices做到这一点,但似乎无法在WCF中找到如何做到这一点.

我试过跑步

svcutil AuthPartnerWSDL.wsdl  /i /messagecontract /tcv:version35
Run Code Online (Sandbox Code Playgroud)

但是生成的接口不会反序列化进入的调用,因此服务实现的所有请求参数都是 null

.net wcf wsdl contract-first wscf

2
推荐指数
1
解决办法
3299
查看次数