Previous topic

Call through ProtocolBuffers

Next topic

FAQs

This Page

Call by SOAP

This topic describes how to call the RaSC service prepared in Work with various network protocols through SOAP. Before starting the tutorial, install soapUI. In addition, the RaSC service to be called through SOAP must be started in advance. Complete Work with various network protocols before starting the tutorial.

First, open the SOAP service page of the RaSC service from the Web browser. Set to ___WAR_NAME___ in the following what was set in Work with various network protocols. (Do not add a backslash character at the end.)

http://localhost:8080/___WAR_NAME___/services

The following page will be shown:

_images/soap_gui.png

Figure 1: SOAP Service Page

Save WSDL file by clicking (wsdl) link. Alternatively, you can obtain it by other means such as curl command.

$ curl -o enju.xml http://localhost:8080/jp.go.nict.rasc.enjuservice/services/EnjuService?wsdl

Confirm the downloaded WSDL file. This example assumes that it is saved as enju.xml.

enju.xml(wsdl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://172.21.20.78:8080/jp.go.nict.rasc.enjuservice/services/EnjuService"
 xmlns:apachesoap="http://xml.apache.org/xml-soap"
 xmlns:impl="http://172.21.20.78:8080/jp.go.nict.rasc.enjuservice/services/EnjuService"
  xmlns:intf="http://172.21.20.78:8080/jp.go.nict.rasc.enjuservice/services/EnjuService"
  xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
  xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--
WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT))-->
 <wsdl:types>
  <schema targetNamespace="http://localhost:8080/jp.go.nict.rasc.enjuservice/services/EnjuService"
   xmlns="http://www.w3.org/2001/XMLSchema">
   <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
   <complexType name="ArrayOf_xsd_string">
    <complexContent>
     <restriction base="soapenc:Array">
      <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>
     </restriction>
    </complexContent>
   </complexType>
  </schema>
 </wsdl:types>
   <wsdl:message name="initResponse">
   </wsdl:message>
   <wsdl:message name="initRequest">
   </wsdl:message>
   <wsdl:message name="analyzeResponse">
      <wsdl:part name="analyzeReturn" type="xsd:string"/>
   </wsdl:message>
   <wsdl:message name="analyzeRequest">
      <wsdl:part name="text" type="xsd:string"/>
   </wsdl:message>
...
  • This example assumes that the host address is localhost. Please change according to your environment.
  • If the highlighted comment is included in the above example, remove it. (It may cause an error in soapUI.)

Then, start soapUI.

_images/soapUI_main.png

Figure 2: soapUI

Select New SOAP Project for the File menu of soapUI.

_images/soapUI_newprj.png

Figure 3: New SOAP Project

Read the saved wsdl file (enju.xml).

_images/soapUI_xmlload.png

Figure 4: Load WSDL

Select analyze - Request 1 from the soapUI navigator.

_images/soapUI_req.png

Figure 5: Enter request

In the soapUI window, replace ? in the part of <text xsi:type=”xsd:string”>?</text> with a character string to be processed.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:prox="http://proxy.sun.com">
   <soapenv:Header/>
   <soapenv:Body>
      <prox:analyze soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <text xsi:type="xsd:string">He runs the company.</text>
      </prox:analyze>
   </soapenv:Body>
</soapenv:Envelope>

Click the [Run] button on soapUI. You will get results in XML format. The highlighted parts are the analysis results.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
       <soapenv:Body>
          <ns1:analyzeResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
           xmlns:ns1="http://proxy.sun.com">
            <analyzeReturn xsi:type="xsd:string">
                    runs    run     VBZ     VB      1       verb_arg12      ARG1    He      he      PRP     PRP     0
                    runs    run     VBZ     VB      1       verb_arg12      ARG2    company company NN      NN      3
                    the     the     DT      DT      2       det_arg1        ARG1    company company NN      NN      3
             </analyzeReturn>
          </ns1:analyzeResponse>
       </soapenv:Body>
    </soapenv:Envelope>