0

Web サービスを介して XML リクエストを OpenGTS サーバーに送信しようとしています。これは要求です:

<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

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>

この結果を生成するために高度な REST クライアント chrome 拡張機能を使用しています

于 2013-08-29T09:04:44.113 に答える