JBOSS融合代理模式

时间:2014-03-11 08:57:43

标签: xsd fuseesb jbossfuse

我尝试使用JBoss Fuse / Camel创建路由器并成功部署。

<camelContext id="blueprintContext"
                trace="false"
                xmlns="http://camel.apache.org/schema/blueprint">
    <route id="httpBridge">
      <from uri="jetty:http://mysystem:8282/CreateAccountService?matchOnUriPrefix=true"/>
      <to uri="jetty:http://mysystem:8080/service/services/CreateAccountService?bridgeEndpoint=true&amp;throwExceptionOnFailure=false"/>
    </route>
  </camelContext>  

能够使用代理访问服务。

我在wsdl中使用了xsd作为数据类型。

<wsdl:types>
<xsd:schema xmlns:fault="http://www.sample.project.com.au/common/message/FaultMessage/v1" xmlns:pref="http://www.sample.project.com.au/services/account/CreateAccount/CreateAccountRequest/v1" xmlns:pref1="http://www.sample.project.com.au/services/account/CreateAccount/CreateAccountResponse/v1" xmlns:pref2="http://www.sample.project.com.au/common/message/TechnicalException/v1" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.sample.project.com.au/services/account/CreateAccount/v1" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.sample.project.com.au/services/account/CreateAccount/v1">
<xsd:import namespace="http://www.sample.project.com.au/services/account/CreateAccount/CreateAccountRequest/v1" schemaLocation="http://mysystem:8080/service/services/CreateAccountService?xsd=CreateAccountRequest.xsd"></xsd:import>
<xsd:import namespace="http://www.sample.project.com.au/services/account/CreateAccount/CreateAccountResponse/v1" schemaLocation="http://mysystem:8080/service/services/CreateAccountService?xsd=CreateAccountResponse.xsd"></xsd:import>
</xsd:schema>
</wsdl:types>

http://mysystem:8282/CreateAccountService?wsdl(代理人)

但是,我可以使用

查看wsdl中的所有xsd详细信息
<xsd:import namespace="http://www.sample.project.com.au/services/account/CreateAccount/CreateAccountRequest/v1" schemaLocation="http://mysystem:8080/service/services/CreateAccountService?xsd=CreateAccountRequest.xsd"></xsd:import>

这是架构的原始网址。

http://mysystem:8080/service/services/CreateAccountService?xsd=CreateAccountRequest.xsd

我也希望隐藏这些细节。

但是,我能够看到所有具有实际网址详细信息的模式。

如何为URI中的所有内容创建代理。

如果我不清楚我的问题,请告诉我。

1 个答案:

答案 0 :(得分:0)

1)

您需要先处理回复邮件(使用邮件翻译器eip http://camel.apache.org/message-translator.html),然后再将其返回给客户端,这样您就可以将邮件正文中的网址从实际网址替换为代理网址

例如,您可以使用具有搜索/替换

的单个方法的bean
public String transformTheMessage(String body) {
  ...
  ... search for the url you want to replace
}

然后在xml文件中定义一个bean并在Camel路由中使用它

<route id="httpBridge">
      <from uri="jetty:http://mysystem:8282/CreateAccountService?matchOnUriPrefix=true"/>
      <to uri="jetty:http://mysystem:8080/service/services/CreateAccountService?bridgeEndpoint=true&amp;throwExceptionOnFailure=false"/>
      <to uri="bean:myBean"/>
    </route>

2)

或者检查请求是否适用于WSDL并执行基于内容的路由器,并从代理服务器上的文件中返回内容 - 该文件具有代码网址硬编码等。 http://camel.apache.org/content-based-router.html

3)

或查看此示例

相关问题