0

xml 名前空間を使用してサービスの WSDL を生成しているときに問題が発生しました。これが私の状況です。

3 つの xsd があり、そこからオブジェクト グラフを生成しました。オブジェクトは、ペイロードが以下のように私のサービス呼び出しのパラメーターであるとしましょう:

interface IService
{
  bool SendRequest(Payload payload)
}

私の Payload クラスには、次のような属性があります。

    [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
        [System.SerializableAttribute()]
        [System.Diagnostics.DebuggerStepThroughAttribute()]
        [System.ComponentModel.DesignerCategoryAttribute("code")]
        [System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://company.com/schema/series/2")]
        [System.Xml.Serialization.XmlRootAttribute("Payload", Namespace = "http://company.com/schema/series/2",
            IsNullable = false)]    
public class Payload
{
}

wsdl を見ると、ペイロード クラスの c# 名前空間への参照があります。正確なスキーマ名前空間で適切な wsdl を生成するにはどうすればよいですか? この wsdl は外部に渡され、システムは Java クライアントから相互運用します。

ありがとう -マイク

4

2 に答える 2

0

ペイロードをDataContract

[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://company.com/schema/series/2")]
[System.Xml.Serialization.XmlRootAttribute("Payload", Namespace="http://company.com/schema/series/2",IsNullable = false)]   
[DataContract] 
public class Payload
{
}

http://msdn.microsoft.com/en-us/library/ms733127.aspxを参照してください。

于 2012-08-03T11:49:31.343 に答える
0

使用する

[DataContract(Name="...", Namespace="http://company.com/schema/series/"]
于 2012-08-03T13:31:13.063 に答える