SOAPUI响应消息

时间:2017-10-25 13:02:48

标签: web-services wsdl soapui xsd-validation

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

以下是信息:

<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

2 个答案:

答案 0 :(得分:3)

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

根据提供的错误消息和wsdl文件,在您要发送的请求中使用以下值之一{/ 1}}。

  • 定制
  • CustomerSESSNOrCompanyNo
  • CustomerNOSSNOrCompanyNo
  • CustomerReferenceNumber
  • CustomerGuid

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

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

答案 1 :(得分:0)

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">

<head>
  <title th:text="#{application_name}"></title>
  <link rel="icon" type="image/x-icon" th:href="@{/static/favicon.ico}"/>

  <script th:src="@{/webjars/jquery/jquery.min.js}"></script>
  <script th:src="@{/webjars/bootstrap/js/bootstrap.min.js}"></script>
  <link rel="stylesheet" th:href="@{/webjars/bootstrap/css/bootstrap.min.css}"/>
  <link rel="stylesheet" th:href="@{/css/mio.css}"/>
  <link rel="stylesheet" th:href="@{/webjars/font-awesome/css/font-awesome.min.css}"/>
</head>

<body>

<div th:replace="~{fragments/header :: header}"></div>

<div class="container">
  <div layout:fragment="content">
    <p>Your page content goes here</p>
  </div>
</div>

<div th:replace="~{fragments/footer :: footer}"></div>

</body>
</html>

你能试试吗?