5
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

SoapUIを使ってレスポンスを確認(今さらだがSoapサーバの環境構築をするの続き)

Last updated at Posted at 2020-03-26

今さらだがSoapサーバの環境構築をする(Eclipse+Axis+Tomcat)の続きです。SoapUIを使ってレスポンスの確認をします。

開発環境

  • Windows 10 Pro
  • Eclipse Version: 2019-03 (4.11.0)
  • Axis 1.7.9
  • Java8
  • Tomcat8
  • SoapUI 5.5.0

参考

いくよー!

1. SOAPプロジェクトの追加

image.png
image.png

2. リクエストを送信

とりあえず、HelloWorldSoap11Bindingの最下層にRequest 1があるので、ダブルクリックすると右ペインにxmlが現れます。▶のボタンを押すとリクエストが送信されるのでやってみます。

image.png
image.png

おそらく、このレスポンスになると思います。

response
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header/>
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode>soapenv:Server</faultcode>
         <faultstring>The ServiceClass object does not implement the required method in the following form: OMElement get(OMElement e)</faultstring>
         <detail/>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>

いろいろ漁ってると、services.xmlというのが原因らしいので、このファイルを修正します。

3. services.xmlの修正

/SoapServerTest/WebContent/WEB-INF/services/HelloWorld/META-INF/services.xmlにあるので、開きます。
messageReciverのmepに定義値を直します。
※axis2.xmlに定義しているmessageReciverのmepと合わせる必要があるらしい。

before
<service name="HelloWorld" >
	<Description>
		Please Type your service description here
	</Description>
	<messageReceivers>
		<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
		<messageReceiver  mep="http://www.w3.org/2004/08/wsdl/in-out"  class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
	<parameter name="ServiceClass" locked="false">HelloWorld</parameter>
</service>
after
<service name="HelloWorld" >
	<Description>
		Please Type your service description here
	</Description>
	<messageReceivers>
<!--
		<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
		<messageReceiver  mep="http://www.w3.org/2004/08/wsdl/in-out"  class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
-->
		<messageReceiver mep="http://www.w3.org/ns/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
		<messageReceiver  mep="http://www.w3.org/ns/wsdl/in-out"  class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
	</messageReceivers>
	<parameter name="ServiceClass" locked="false">HelloWorld</parameter>
</service>

4. SOAPサーバを再起動して、再度SoapUIで確認

2. リクエストを送信を再実行。
image.png

response
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:getResponse xmlns:ns="http://ws.apache.org/axis2">
         <ns:return>Hello World!</ns:return>
      </ns:getResponse>
   </soapenv:Body>
</soapenv:Envelope>

Hello World!が返ってきました!!!やったね!!!!

以上!!!

5
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?