0

我正在尝试通过 Web 服务向 OpenGTS 服务器发送 XML 请求。这是请求:

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

这是我使用的 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>

有人可以帮我吗?提前致谢。

4

2 回答 2

1

I was also getting the same exception when trying to make an xml request to opengts web service..I later overcame the problem.

I think you used a saop-based tool (like saopui) to make the request. My suggestion is don't use soap-based request, just make a simple xml request. I mean remove soap headers and soap body tags.. see the below example:

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

like above request you may invoke your request....just remove soap headers and call like below. its working fine

<GTSRequest command="version">
    <Authorization account="raju" user="admin" password="raju"/>
   </GTSRequest>  

Result:

<GTSResponse command="version" result="success">
 <Version>E2.4.0-B26</Version>
 </GTSResponse>

I am using Advanced REST client chrome extension to produce this result

于 2013-08-29T09:04:44.113 回答
0

您传递的 inputXML 数据结构(嵌入在 SOAP 消息中)可能不是实体引用编码的。如果您选择不对嵌套的 XML 结构进行实体引用编码,则第二种选择是使用 CDATA 部分包装内部 XML。当您在 SOAP 中嵌入了嵌套的 XML 字符串时,CDATA 部分是使用 SOAP-UI 的方式。

于 2014-05-04T02:37:37.050 回答