我试图使用soap调用一个web服务,下面是请求的xml:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:uuid:e657a351-ae8c-42c5-b083-ebe5dcda5c0b">
<soapenv:Header/>
<soapenv:Body>
<urn:GetCustomerAccounts>
<urn:CustomerLookup>
<urn:CustomerIdentification>test</urn:CustomerIdentification>
<urn:CustomerIdentificationValue>aptic</urn:CustomerIdentificationValue>
<!--Optional:-->
<urn:JuridicalType>?</urn:JuridicalType>
</urn:CustomerLookup>
<!--Optional:-->
<urn:CustomerOwnerReferenceFilter>?</urn:CustomerOwnerReferenceFilter>
</urn:GetCustomerAccounts>
</soapenv:Body>
</soapenv:Envelope>无论我在customerIdentification和IdentificationValue上放了什么
无效枚举值“test”不能反序列化为'Aptic.WebIntegrationPlatform.Soap.Enums.CustomerIdentificationType类型,请确保存在必要的枚举值,并在类型为 DataContractAttribute属性
这是一个信息:
<Message>The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter urn:uuid:e657a351-ae8c-42c5-b083-ebe5dcda5c0b:CustomerLookup. The InnerException message was 'Invalid enum value 'test' cannot be deserialized into type 'Aptic.WebIntegrationPlatform.Soap.Enums.CustomerIdentificationType'. Ensure that the necessary enum values are present and are marked with EnumMemberAttribute attribute if the type has DataContractAttribute attribute.'. Please see InnerException for more details.</Message>
<StackTrace><![CDATA[at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameterPart(XmlDictionaryReader reader, PartInfo part, Boolean isRequest)
at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameter(XmlDictionaryReader reader, PartInfo part, Boolean isRequest)
at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameters(XmlDictionaryReader reader, PartInfo[] parts, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, String action, MessageDescription messageDescription, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeRequest(Message message, Object[] parameters)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)]]></StackTrace>
<Type>System.ServiceModel.Dispatcher.NetDispatcherFaultException</Type>
</ExceptionDetail>
</detail>对错误有什么想法吗?
这是服务的wsdl
发布于 2017-10-26 02:27:28
基本上,错误是由于请求中的CustomerIdentification元素的无效值造成的。
在您根据提供的错误消息和wsdl文件发送的请求中,使用以下元素CustomerIdentification中的一个值。
为了修复错误,您可能必须为CustomerIdentificationValue元素提供适当的值,以及基于所选的标识值。
顺便说一句,您可以通过右键单击并在请求编辑器中验证SoapUI中的soap请求(快捷方式是Alt + v键的组合)。
发布于 2017-10-25 15:05:50
<xs:simpleType name="CustomerIdentificationType">
<xs:restriction base="xs:string">
<xs:enumeration value="Custom"/>
<xs:enumeration value="CustomerSESSNOrCompanyNo"/>
<xs:enumeration value="CustomerNOSSNOrCompanyNo"/>
<xs:enumeration value="CustomerReferenceNumber"/>
<xs:enumeration value="CustomerGuid"/>
</xs:restriction>
</xs:simpleType>你能试试这个吗?
https://stackoverflow.com/questions/46933225
复制相似问题