Spring Integration call Web service

I'm still new to Spring Integration and I've few question.

I have a service with WSDL deploy in tomcat server.

and I would like to send parameter from my spring integration flow to that service and receive response back to do next things in the flow.

I should use outbound WS gateway to do this right? and how to config the xml to do this?

i've try temperature example but still don't understand it.

thank you.

///////////////////////////////////////////////////////////////

Here is my config:

     <int:gateway service-interface="com.app.service.IRequester" id="IRequester"
    default-request-channel="requestChannel"  
    default-reply-channel="responseChannel"
    error-channel="errorChannel" >
 </int:gateway>

 <int:service-activator input-channel="requestChannel" id="bu1"
     ref="BU1" method="bu1Method"
     output-channel="buChannel">
</int:service-activator>

 <int:service-activator input-channel="errorChannel" 
      ref="handlerError" method="errorReturnToGateway"
      output-channel="responseChannel" >
  </int:service-activator>

 <int:router id="routingChannel" input-channel="buChannel" ref="RoutingChannel"     method="routingChannel">
     <int:mapping value="firstChannel" channel="channelFirst" />
     <int:mapping value="otherChannel" channel="channelOther" />
 </int:router>

 <int:service-activator id="firstBU" input-channel="channelFirst"
        ref="FirstBU" method="doSomething" output-channel="responseChannel">
 </int:service-activator>
 <int:service-activator id="otherBU" input-channel="channelOther"
        ref="OtherBU" method="doSomething" output-channel="responseChannel">
 </int:service-activator>

I need to change output channel from both firstBU and otherBU activator to call web service which is send a paremeter to that service(paremeter type is Hashmap) and receive same type response.

I don't know how to call web service by using ws:outbound-gateway.Since I have only known to call web service using java way by generate client java class and may be i'll call service in method doSomething.

In my case,Do you think which way is better? And I still want to know how to solve this by use ws:outbound-gateway too.

thank you.

Answers


As far as it is SOAP, so you get deal with XML. And your WSDL provides you the contract - an XSD which XML should be sent to the service and which will be returned as a response.

So, your task to configure <int-ws:outbound-gateway> and provide correct XML as a message payload to the request-channel of that component.

The same is about a response: you get an XML as payload.

However, it is for simple WS Outbound Gateway. You can configure it with marshaller and send to the request-channel some domain POJO and that marshaller takes care about converting that POJO to the XML representation for the SOAP request.

Show, your config, please, and maybe we can help more with your concreate issues.


Need Your Help

How to store a Japanese Character in json_encode?

sql utf-8 json

I'm trying to save a json_encoded strings to the database but whenever i do i get this:

Receiving data from Windows Service and show them to MVC

windows http model-view-controller service

i am new to MVC and i would like some advises to solve my problem.