SOAPUI 响应消息

SOAPUI response message

我正在尝试使用 soap UI 调用 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 上放什么

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.

消息如下:

<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 服务

    <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>

你能试试这个吗?

基本上错误是由于请求中 CustomerIdentification 元素的值无效。

根据提供的错误消息和 wsdl 文件,在您发送的请求中为元素 CustomerIdentification 使用以下值之一。

  • 自定义
  • CustomerSESSNOrCompanyNo
  • CustomerNOSSNOrCompanyNo
  • CustomerReferenceNumber
  • CustomerGuid

为了修复错误,您可能还需要根据选择的识别值为 CustomerIdentificationValue 元素提供适当的值。

顺便说一下,您可以通过 右键单击​​并在请求编辑器中验证 来验证 SoapUI 中的 soap 请求(快捷方式是 Alt + v 相同的组合键).