0

我开发了 JBOSS ESB 项目并为服务创建了代理并成功调用。

但是,硬编码的 wsdl 位置。

<?xml version="1.0"?>
<jbossesb parameterReloadSecs="5"
    xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.3.1.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.3.1.xsd http://anonsvn.jboss.org/repos/labs/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.3.1.xsd">
    <services>
        <service category="Stock" description="Stock Quote" invmScope="GLOBAL"
            name="Quote">
            <listeners>
                <http-gateway name="StockQuote-GwListener" />
            </listeners>
            <actions mep="RequestResponse">
                <action class="org.jboss.soa.esb.actions.soap.proxy.SOAPProxy"
                    name="proxy">
                    <property name="wsdl"
                        value="http://localhost:8081/service_sample/services/addSoapPort?wsdl" />
                </action>
            </actions>
        </service>
    </services>
</jbossesb>

下面的 wsdl 位置是硬编码的,如何使其可配置?

<property name="wsdl"
                            value="http://localhost:8081/service_sample/services/addSoapPort?wsdl" />

如何管理这个?

我们还需要做其他配置吗?

请帮我..

4

1 回答 1

0

Create a folder named wsdl in your project, and place your wsdls there.

After it you can change your action definition to this:

 <action class="org.jboss.soa.esb.actions.soap.proxy.SOAPProxy" name="proxy">
                <property name="wsdl"
                    value="claspath:///wsdl/your.wsdl" />
                <property name="endpointUrl" value="${service.url}"/>
            </action>

In the endpointUrl you can hard code the url of your webservice, or place it in a property file (as it shown above)

To use a property file you'll need a jboss-service.xml file under META-INF:

<?xml version="1.0" encoding="UTF-8"?>
  <server>
    <mbean code="org.jboss.varia.property.SystemPropertiesService" name="jboss.util:type=Service,name=YourPropertyName">
    <attribute name="URLList">/home/foo/your.properties</attribute>
    <attribute name="Properties" />
</mbean>

In the /home/foo/your.properties file just add the url:

service.url=http://yourservice.url
于 2015-04-17T11:35:33.040 回答