Tuesday, March 16, 2010

Rashes On My 3 Month Sons Cheeck

locator service - Access to Stateless session beans from a POJO (with new EJB 3.1)

[All the features described here apply to JBoss 4.2.3GA]
If different within JBoss published Session Beans as Web Service will be here by default simply generates the appropriate WSDL.
Here is an example of a corresponding SLSB:
@ WebService @ SoapBinding
(parameter style =
SoapBinding
parameter style.. WRAPPED )

public
interface
ExampleService {

     
@WebMethod

     

Public
String getData();
}
@Stateless @WebContext
(contextRoot = "/ExampleWS" ) @WebService

@Remote
(ExampleService. class )
@Local (ExampleService. class
)

public
class
ExampleServiceBean implements ExampleService { @Override
     
public String getData() {            
return
"ExampleData" ; }
} This WSDL can be found at foglender Address: http://localhost:8080/ExampleWS/ExampleServiceBean?wsdl
In the lower section of the WSDL, then the following Section:
... \u0026lt;service name='ExampleServiceBeanService'>
\u0026lt;port binding='tns:ExampleServiceBeanBinding' name='ExampleServiceBeanPort'>
\u0026lt;soap: address location = 'http:// pluto : 8080/ExampleWS/ExampleServiceBean '/> \u0026lt;/ port>
\u0026lt;/ service>
...

pluto is my local Computer name. And that is precisely the problem. Within the WSDL file is used, the DNS name of the server.

If you want to now access outside the private network via Web services to the computer can, "pluto" are not naturally resolved. This occurs, for example, when a Web server is in the DMZ and on AppServer that is within the private network wants to access via web service. In the firewall for this extra 1 port was opened, the WSDL file can still be displayed, then the service is not callable L

Access to the JBoss server is only by IP address possible!
remedy this, the following parameters when starting the server:
-Djboss.bind.address = 192.168.15.11
The 192.168.15.11 is in this Example of course, my local IP address.
The WSDL is then adjusted accordingly and the soap: address location will then use the computer name but not the value for jboss.bind.address.
The parameter has a direct influence on the following configuration file:

\u0026lt;JBOSS_HOME> \\ server \\ default \\ deploy \\ jbossws.sar \\ jbossws.beans \\ META-INF \\ jboss-beans.xml
following section is relevant here:
\u0026lt;- An abstraction of server configuration aspects. ->


\u0026lt;
bean

name
= "WSServerConfig"

class
=
"org.jboss.wsf.stack.jbws.NativeServerConfig"

>

   
<
property

name
= "mbeanServer"

><
inject bean
=
"WSMBeanServerLocator" property = "mbeanServer"
/></ property >         <!--
        The WSDL, that is a required deployment artifact for an endpoint , has a <soap:address>         element which points to the location of the endpoint . JBoss supports rewriting of that SOAP address.               If the content of <soap:address> is a valid URL, JBossWS will not rewrite it unless 'modifySOAPAddress' is true.         If the content of <soap:address> is not a valid URL, JBossWS will rewrite it using the attribute values given below.
       
        If 'webServiceHost' is not set, JBossWS uses requesters protocol host when rewriting the <soap:address> .
    -->
    < property name
=
"webServiceHost" >
${jboss.bind.address}
</ property >
    < property
name
= "modifySOAPAddress"
>
true </ property >
   
    <!--       Set these properties to explicitly define the ports that will be used for rewriting the SOAP address.       Otherwise the ports will be identified by querying the list of installed connectors.
      If multiple connectors are found the port of the first connector is used.       <property name="webServiceSecurePort">8443</property>       <property name="webServicePort">8080</property> - bean>
\u0026lt;/
> alternative to the parameters can jboss.bind.address even at start-b parameters are used.

0 comments:

Post a Comment