2015-02-26 3 views
4

Я столкнулся с вышеупомянутой ошибкой при генерации реакции с мылом. Я также хочу сделать fname обязательным, и я попробовал почти все, как minOccurs = 1, nillable: false, но не повезло.Unmarshalling Error: неожиданный элемент (uri: "", local: "user"). Ожидаемые элементы (нет)

Вот мои запрошенные параметры: -

<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"> 
    <Body> 
     <RUser xmlns="http://www.test.org/"> 
      <RInfo xmlns=""> 
       <user> 
        <fname>[string]</fname> 
       </user> 
      </RInfo> 
     </RUser> 
    </Body> 
</Envelope> 

Мой файл WSDL, следуют: -

<?xml version="1.0" encoding="UTF-8"?> 
<wsdl:definitions name="TestServiceService" targetNamespace="http://www.test.org/" 
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
        xmlns:tns="http://www.test.org/" 
        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> 
    <wsdl:types> 
     <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
        xmlns:tns="http://www.test.org/" 
        attributeFormDefault="unqualified" 
        elementFormDefault="unqualified" 
        targetNamespace="http://www.test.org/"> 


      <xs:element name="RUser" type="tns:RUser"/> 
      <xs:element name="RResponse" type="tns:RResponse"/> 

      <xs:complexType name="RUser"> 
       <xs:sequence> 
        <xs:element name="RInfo" type="tns:rInfo"/> 
       </xs:sequence> 
      </xs:complexType> 


      <xs:complexType name="rInfo"> 
       <xs:sequence> 
        <xs:element name="user"> 
        <xs:complexType> 
         <xs:sequence> 
          <xs:element name="fname" type="xs:string" nillable="false"/> 
         </xs:sequence> 
        </xs:complexType> 
        </xs:element> 
       </xs:sequence> 
      </xs:complexType> 


      <xs:complexType name="RResponse"> 
       <xs:sequence> 
        <xs:element minOccurs="1" name="RResult" type="tns:RResult"/> 
       </xs:sequence> 
      </xs:complexType> 
      <xs:complexType name="RResult"> 
       <xs:sequence> 
        <xs:element minOccurs="0" name="rType" type="xs:string"/> 
        <xs:element minOccurs="0" name="ruserID" type="xs:string"/> 
        <xs:element minOccurs="0" name="authFailed" type="xs:string"/> 
        <xs:element minOccurs="0" name="soapMessage" type="xs:string"/> 
       </xs:sequence> 
      </xs:complexType> 

     </xs:schema> 
    </wsdl:types> 



    <wsdl:message name="RUser"> 
     <wsdl:part name="parameters" element="tns:RUser"/> 
    </wsdl:message> 
    <wsdl:message name="RResponse"> 
     <wsdl:part name="parameters" element="tns:RResponse"/> 
    </wsdl:message> 




    <wsdl:portType name="TestServiceWsdlEndpointPortType"> 
     <wsdl:operation name="RUser"> 
      <wsdl:input name="RUser" message="tns:RUser"/> 
      <wsdl:output name="RResponse" message="tns:RResponse"/> 
     </wsdl:operation> 
    </wsdl:portType> 

    <wsdl:binding name="TestServiceWsdlEndpointBinding" type="tns:TestServiceWsdlEndpointPortType"> 
     <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> 

     <wsdl:operation name="RUser"> 
      <soap:operation soapAction="" style="document"/> 
      <wsdl:input name="RUser"> 
       <soap:body use="literal"/> 
      </wsdl:input> 
      <wsdl:output name="RResponse"> 
       <soap:body use="literal"/> 
      </wsdl:output> 
     </wsdl:operation> 

    </wsdl:binding> 

    <wsdl:service name="TestServiceWsdlEndpoint"> 
     <wsdl:port name="TestServiceWsdlPort" binding="tns:TestServiceWsdlEndpointBinding"> 
      <soap:address location="http://localhost:8080/testapp/services/TestServiceWsdl"/> 
     </wsdl:port> 
    </wsdl:service> 

</wsdl:definitions> 

ответ

0

Это должен быть ваш запрос,

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:test="http://www.test.org/"> 
    <soapenv:Header/> 
    <soapenv:Body> 
     <test:RUser> 
     <RInfo> 
      <user> 
       <fname>?</fname> 
      </user> 
     </RInfo> 
     </test:RUser> 
    </soapenv:Body> 
</soapenv:Envelope> 
Смежные вопросы