通过SOAP web服务向OpenGTS服务器发送XML请求时出错
我正试图通过web服务向OpenGTS服务器发送一个XML请求。请求如下:通过SOAP web服务向OpenGTS服务器发送XML请求时出错,xml,soap,Xml,Soap,我正试图通过web服务向OpenGTS服务器发送一个XML请求。请求如下: <GTSRequest command="version"> <Authorization account="demo" user="admin" password=""/> </GTSRequest> 当服务器运行时,出现以下错误: <?xml version="1.0" encoding="utf-8"?> <GTSResponse result="
<GTSRequest command="version">
<Authorization account="demo" user="admin" password=""/>
</GTSRequest>
当服务器运行时,出现以下错误:
<?xml version="1.0" encoding="utf-8"?>
<GTSResponse result="error">
<Message code="RQ0031"><![CDATA[SOAP XML syntax error]]></Message>
<Comment><![CDATA[Found SOAP request:(inputXML is missing refer to the WSDL file.]]></Comment>
</GTSResponse>
我和Windev17一起工作。我试图以字符串和XMLDocument的形式发送请求,但出现了相同的错误。
认为这是由于XML语法,我尝试在字符串中使用双引号,在内部引号之前使用反斜杠,使用“+”连接,但我得到了相同的错误
这是我的密码:
inputXML est une chaîne
inputXML = ...
"<GTSRequest command=""commands"">"+...
"<Authorization account=""demo"" user=""admin"" password=""/>"+...
"</GTSRequest>"
gtsServiceRequestReturn est une chaîne
gtsServiceRequestReturn = GTSServiceService.gtsServiceRequest(inputXML)
Info(gtsServiceRequestReturn)
inputXML是最简单的
inputXML=。。。
""+...
""+...
""
gtsServiceRequestReturn最新消息
gtsServiceRequestReturn=GTSServiceService.gtsServiceRequest(inputXML)
信息(gtsServiceRequestReturn)
下面是我使用的WSDL文件的内容
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://service.war.extra.opengts.org" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://service.war.extra.opengts.org" xmlns:intf="http://service.war.extra.opengts.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<schema elementFormDefault="qualified" targetNamespace="http://service.war.extra.opengts.org" xmlns="http://www.w3.org/2001/XMLSchema">
<element name="inputXML" type="xsd:string"/>
<element name="gtsServiceRequestReturn" type="xsd:string"/>
</schema>
</wsdl:types>
<wsdl:message name="gtsServiceRequestResponse">
<wsdl:part element="impl:gtsServiceRequestReturn" name="gtsServiceRequestReturn"/>
</wsdl:message>
<wsdl:message name="gtsServiceRequestRequest">
<wsdl:part element="impl:inputXML" name="inputXML"/>
</wsdl:message>
<wsdl:portType name="GTSService">
<wsdl:operation name="gtsServiceRequest" parameterOrder="inputXML">
<wsdl:input message="impl:gtsServiceRequestRequest" name="gtsServiceRequestRequest"/>
<wsdl:output message="impl:gtsServiceRequestResponse" name="gtsServiceRequestResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="GTSServiceSoapBinding" type="impl:GTSService">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="gtsServiceRequest">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="gtsServiceRequestRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="gtsServiceRequestResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="GTSServiceService">
<wsdl:port binding="impl:GTSServiceSoapBinding" name="GTSService">
<wsdlsoap:address location="http://localhost:8080/track/Service"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
谁能帮帮我吗?提前感谢。我在尝试向opengts web服务发出xml请求时也遇到了同样的异常。我后来克服了这个问题 我认为您使用了基于saop的工具(如saopui)来提出请求。我的建议是不要使用基于soap的请求,只做一个简单的xml请求。我的意思是删除soap头和soap主体标记。。请参见以下示例:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.war.extra.opengts.org">
<soapenv:Header/>
<soapenv:Body>
<GTSRequest command="version">
<Authorization account="raju" user="admin" password="raju"/>
</GTSRequest>
</soapenv:Body>
</soapenv:Envelope>
像上面的请求一样,您可以调用您的请求……只需删除soap头并像下面那样调用即可。工作正常
<GTSRequest command="version">
<Authorization account="raju" user="admin" password="raju"/>
</GTSRequest>
结果:
<GTSResponse command="version" result="success">
<Version>E2.4.0-B26</Version>
</GTSResponse>
E2.4.0-B26
我正在使用Advanced REST client chrome extension生成此结果可能是您传递的inputXML数据结构(嵌入在SOAP消息中)可能不是实体引用编码的。如果您选择不对嵌套的XML结构进行实体引用编码,那么第二个选项是使用CDATA节包装内部XML。当您在SOAP中嵌入嵌套的XML字符串时,CDATA部分是SOAP-UI的使用方式