更改wsdl:part名称 [英] Changing wsdl:part name
本文介绍了更改wsdl:part名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以更改WSDL中消息部分的 name
?我在WSDL上有这个标签:
Is there any way of changing the name
of a message part in the WSDL? I have this on my WSDL:
<wsdl:message name="getDataRequestMsg">
<wsdl:part name="getData" element="tns:getData"/>
</wsdl:message>
<wsdl:message name="getDataRequestMsg_Headers">
<wsdl:part name="Header" element="tns:Header"/>
</wsdl:message>
<wsdl:message name="getDataResponseMsg">
<wsdl:part name="getDataResponse" element="tns:getDataResponse"/>
</wsdl:message>
<wsdl:message name="getDataResponseMsg_Headers">
<wsdl:part name="Header" element="tns:Header"/>
</wsdl:message>
我使用的是 MessageContractAttribute
,实际上我可以使用 MessageBodyMemberAttribute
上的重复的 name
属性更改名称,但它也会更改 element
名称,这不是我想要的.我的MessageContract如下:
I'm using a MessageContractAttribute
and I can actually change the name using the respetive name
attribute on the MessageBodyMemberAttribute
, but it also changes the element
name and that's not what I intended. My MessageContract is as follows:
[System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
public partial class getDataRequestMsg
{
[System.ServiceModel.MessageHeaderAttribute()]
public Header[] Header;
[System.ServiceModel.MessageBodyMemberAttribute()]
public getData getData;
public getDataRequestMsg()
{
}
public getDataRequestMsg(Header[] Header, getData getData)
{
this.Header = Header;
this.getData = getData;
}
}
[System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
public partial class getDataResponseMsg
{
[System.ServiceModel.MessageHeaderAttribute()]
public Header[] Header;
[System.ServiceModel.MessageBodyMemberAttribute()]
public getDataResponse getDataResponse;
public getDataResponseMsg()
{
}
public getDataResponseMsg(Header[] Header, getDataResponse getDataResponse)
{
this.Header = Header;
this.getDataResponse = getDataResponse;
}
}
推荐答案
[WebMethod()]
[return: System.Xml.Serialization.XmlElement("your_element_name")]
public your_type YourMethod()
{
// your code
}
这篇关于更改wsdl:part名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文