我花了太多时间在这里,所以现在是时候减少损失并张贴到SO上了。
有问题的服务是用C#编写的WCF .NET 4.7.2端点。各个部分如下:
目标命名空间
public const string AcordNamespace = "http://ACORD.org/Standards/Life/2";
服务合同
[XmlSerializerFormat]
[ServiceContract(Name = "PolicyAdministrationPort", Namespace = Constants.AcordNamespace)]
public interface IPolicyAdministration
{
[OperationContract]
[return: MessageParameter(Name = "TXLife")]
Task<TXLife_Type> StraightThroughCyberlife([MessageParameter(Name = "TXLife")] TXLife_Type request);
}
服务行为
[ServiceBehavior(Namespace = Constants.AcordNamespace)]
public class PolicyAdministration : IPolicyAdministration
{
public async Task<TXLife_Type> StraightThroughCyberlife(TXLife_Type request)
{
}
}
TXLife_Type
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3190.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://ACORD.org/Standards/Life/2")]
[System.Xml.Serialization.XmlRootAttribute("TXLife", Namespace = "http://ACORD.org/Standards/Life/2", IsNullable = false)]
public partial class TXLife_Type : EntityBase<TXLife_Type>
{
}
WSDL
<wsdl:definitions
name="PolicyAdministration"
targetNamespace="http://ACORD.org/Standards/Life/2"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:wsa10="http://www.w3.org/2005/08/addressing"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy"
xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://ACORD.org/Standards/Life/2"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<wsdl:types>
<xsd:schema targetNamespace="http://ACORD.org/Standards/Life/2/Imports">
<xsd:import schemaLocation="http://localhost/StraightThroughCyberLife.Web/PolicyAdministration.svc?xsd=xsd0" namespace="http://ACORD.org/Standards/Life/2"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="PolicyAdministrationPort_StraightThroughCyberlife_InputMessage">
<wsdl:part name="parameters" element="tns:StraightThroughCyberlife"/>
</wsdl:message>
<wsdl:message name="PolicyAdministrationPort_StraightThroughCyberlife_OutputMessage">
<wsdl:part name="parameters" element="tns:StraightThroughCyberlifeResponse"/>
</wsdl:message>
<wsdl:portType name="PolicyAdministrationPort">
<wsdl:operation name="StraightThroughCyberlife">
<wsdl:input wsaw:Action="http://ACORD.org/Standards/Life/2/PolicyAdministrationPort/StraightThroughCyberlife" message="tns:PolicyAdministrationPort_StraightThroughCyberlife_InputMessage"/>
<wsdl:output wsaw:Action="http://ACORD.org/Standards/Life/2/PolicyAdministrationPort/StraightThroughCyberlifeResponse" message="tns:PolicyAdministrationPort_StraightThroughCyberlife_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="PolicyAdministrationEndpoint" type="tns:PolicyAdministrationPort">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="StraightThroughCyberlife">
<soap:operation soapAction="http://ACORD.org/Standards/Life/2/PolicyAdministrationPort/StraightThroughCyberlife" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="PolicyAdministration">
<wsdl:port name="PolicyAdministrationEndpoint" binding="tns:PolicyAdministrationEndpoint">
<soap:address location="http://localhost/StraightThroughCyberLife.Web/PolicyAdministration.svc"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
肥皂信封
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns="http://ACORD.org/Standards/Life/2">
<soapenv:Header/>
<soapenv:Body>
<ns:StraightThroughCyberlife> <!-- WHY IS THIS WRAPPING MY TXLife? -->
<!--Optional:-->
<ns:TXLife Version="?">
<!-- 450,000 lines of code removed... I wish it wasn't true -->
</ns:TXLife>
</ns:StraightThroughCyberlife>
</soapenv:Body>
</soapenv:Envelope>
最终目标
<soap:Envelope">
<soap:Body">
<TXLife xmlns="http://ACORD.org/Standards/Life/2>
<TXLifeRequest>
<TransRefGUID></TransRefGUID>
<TransType tc="103">
</TransType>
<TransSubType tc="12345"></TransSubType>
</TXLifeRequest>
<TXLife>
</soap:Body>
</soap:Envelope">
我的目标是使此Accord兼容,但这取决于清理肥皂包,如最后一个肥皂包所示。如果您还想保留一个更好的标题,请告诉我,我会对其进行更新。
谢谢你, 斯蒂芬