gpt4 book ai didi

xml - 解码错误 : unexpected element (uri :"", 本地 :"user")。预期元素是(无)

转载 作者:数据小太阳 更新时间:2023-10-29 02:13:46 26 4
gpt4 key购买 nike

在生成 soap 响应时,我一直面临上述错误。我还想让 fname 成为必需项,我已经尝试了几乎所有方法,例如 minOccurs=1,nillable:false 但没有成功。

这是我请求的参数:-

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

最佳答案

这应该是你的要求,

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

关于xml - 解码错误 : unexpected element (uri :"", 本地 :"user")。预期元素是(无),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28742928/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com