【问题标题】:SOAPUI response messageSOAPUI 响应消息
【发布时间】:2017-10-25 13:02:47
【问题描述】:

我正在尝试使用肥皂 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 属性。

这是消息:

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

【问题讨论】:

  • 你的枚举是什么?似乎“测试”不属于它。您是否尝试过将 CustomerLookup 作为客户标识?或来自 wsdl 的其他值?
  • @A.Joly 我确实尝试了许多选项作为枚举;数字,布尔没有运气。我现在添加了 CustomerLookup 相同的响应。有什么想法吗?
  • 好吧,直到你能找到这个枚举在哪里......
  • @A.Joly 有没有办法从 wsdl 获取这些值信息?
  • 这就是我的局限所在……我对 wsdl 之类的东西不是很熟悉,抱歉 :(

标签: web-services wsdl soapui xsd-validation


【解决方案1】:

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

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

  • 自定义
  • 客户SESSN或公司编号
  • 客户 NOSSN 或公司编号
  • 客户参考号
  • 客户指南

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

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

【讨论】:

  • 完全做到了
  • @trace_le,很高兴它有帮助。
【解决方案2】:
    <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>

你可以试试这个吗?

【讨论】:

  • 我应该在哪里添加这个?
  • 在请求中:自定义
  • 前缀“xs”未定义。第 6 行,位置 92。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-08-02
  • 1970-01-01
  • 2017-01-21
相关资源
最近更新 更多