简体   繁体   中英

To consume a web service with multiple input arguments in mule

I'm a beginner, I have a mule flow, in which i would like to call SOAP web service operation which has 4 input arguments "public double calculateInterest(double principal, double year, double rate, int appid)".

I tried using a file or http endpoint where i end up in String array, or object array while using set payload. the exception thrown is

cannot be cast to java.lang.Double. Failed to route event via endpoint: org.mule.module.cxf.CxfOutboundMessageProcessor. Message payload is of type: String[]

Could somebody suggest the best way to do it.

see here is an example of a simple webservice :-

<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:core="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="CE-3.3.0" xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd 
http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/current/mule-cxf.xsd 
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd 
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd ">
    <flow name="getCalculationFlow1" doc:name="getCalculationFlow1">
        <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="getCalculation" doc:name="HTTP"/>
        <cxf:jaxws-service serviceClass="com.services.getcalculation.v1.GetCalculation" doc:name="SOAP"/>
        <component class="com.services.schema.getcalculation.v1.GetCalculationImpl" doc:name="Java"/>
    </flow>
</mule>

where com.services.getcalculation.v1.GetCalculation is the webservice class which is generated using Apache CXF from WSDL files and com.services.schema.getcalculation.v1.GetCalculationImpl is the implemantation class of webservice ... hope this help

您可以配置文件或http入站,编写Java组件(删除cxf组件),从有效负载中提取参数,转换为所需的类型,然后从该组件调用Web服务方法。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM