2012-08-03 113 views
0

我正在用xml命名空间为我的服务生成WSDL时遇到问题。这是我的情况。生成wsdl时发生的问题

我有3个xsd,我已经生成了一个对象图。对象,可以说有效载荷是下面我的服务调用的参数:

interface IService 
{ 
    bool SendRequest(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客户端进行互操作。

感谢, -Mike

回答

0

使用

[DataContract(Name="...", Namespace="http://company.com/schema/series/"] 
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

+0

其实不知道,如果我的回答问题正确,你的WSDL中的负载是不是? – Liam 2012-08-03 11:55:01