Web services 在Mule中使用Web服务
我试图添加两个流。一个用于部署Web服务,另一个用于使用它。 这是流的代码Web services 在Mule中使用Web服务,web-services,mule,mule-studio,Web Services,Mule,Mule Studio,我试图添加两个流。一个用于部署Web服务,另一个用于使用它。 这是流的代码 <flow name="servicesFlow2" doc:name="servicesFlow2"> <http:inbound-endpoint exchange-pattern="request-response" host="`localhost`" port="8081" doc:name="HTTP"/> <set-payload value="
<flow name="servicesFlow2" doc:name="servicesFlow2">
<http:inbound-endpoint exchange-pattern="request-response" host="`localhost`" port="8081" doc:name="HTTP"/>
<set-payload value="#[{message.inboundProperties['username'],message.inboundProperties['password']}]" doc:name="Set Payload"/>
<cxf:jaxws-client operation="authentifier" serviceClass="com.logixy.platform.ws.AuthenticationInterface" doc:name="SOAP" port="AuthenticationInterfaceSoapBinding"/>
<http:outbound-endpoint exchange-pattern="request-response" method="POST" address="http://`localhost`:8082" doc:name="HTTP"/>
<mulexml:object-to-xml-transformer doc:name="Object to XML"/>
</flow>
<flow name="servicesFlow1" doc:name="servicesFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="`localhost`" port="8082" doc:name="HTTP"/>
<cxf:simple-service serviceClass="com.logixy.platform.ws.AuthenticationInterface" doc:name="SOAP"/>
<component class="com.logixy.platform.ws.Authenticate" doc:name="Java"/>
</flow>
请帮忙
这是类Authenticate中的authentifier方法:
公共字符串authentifierString用户1,字符串密码1{
试一试{
Class.forName("com.mysql.jdbc.Driver").newInstance();
connection = DriverManager.getConnection(url + dbName, userName,
password);
Statement st = connection.createStatement();
ResultSet res = st
.executeQuery("SELECT * FROM users WHERE username='"
+ user1 + "' and password='" + password1 + "'");
if (res.next()) {
return res.getInt("id") + "";
}
return "0";
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
return "0";
}
另外,这是身份验证界面:
公共接口认证接口{
public String authentifier(String user1, String password1);
public ArrayList<BL> liste_BL(int id_driver);
public ArrayList<String> liste_Client1();
}尝试[{message.inboundProperties['http.query.params']['username'],message.inboundProperties['http.query.params']['password']}]还有一件事……为什么不更改呢感谢您的帮助,错误已经更改,现在我得到了以下信息:java.util.ArrayList无法转换为java.lang.String。无法通过端点路由事件:org.mule.module.cxf.CxfOutboundMessageProcessor。消息负载的类型为:Object[]可以发布您的Authenticate和AuthenticationInterface,以便帮助您检测错误并在此处运行相同的场景来测试它..我添加了代码,提前感谢@AnirBanchewDhary您是否在Authenticate类中实现了AuthenticationInterface?如果是,它应该显示在您的代码中..为什么在e中返回0方法的nd,如return 0;。您可以返回任何其他字符串。。是的,我在Authenticate类中实现了它,但此处未显示。
public String authentifier(String user1, String password1);
public ArrayList<BL> liste_BL(int id_driver);
public ArrayList<String> liste_Client1();
<flow name="servicesFlow2" doc:name="servicesFlow2">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP"/>
<set-payload value="#[{message.inboundProperties['http.query.params']['username'],message.inboundProperties['http.query.params']['password']}]" doc:name="Set Payload"/>
<cxf:jaxws-client operation="authentifier" serviceClass="com.logixy.platform.ws.AuthenticationInterface" doc:name="SOAP" port="AuthenticationInterfaceSoapBinding"/>
<http:outbound-endpoint exchange-pattern="request-response" method="POST" address="http://localhost:8082" doc:name="HTTP"/>
<mulexml:object-to-xml-transformer doc:name="Object to XML"/>
</flow>
<flow name="servicesFlow1" doc:name="servicesFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8082" doc:name="HTTP"/>
<cxf:jaxws-service serviceClass="com.logixy.platform.ws.AuthenticationInterface" doc:name="SOAP"/>
<component class="com.logixy.platform.ws.Authenticate" doc:name="Java"/>
</flow>