2011-11-04 7 views
7

¿Es posible configurar la ubicación (schemaLocation y soap:addresslocation) en un WSDL de JAX-WS?
Cuando implemente el ejemplo a continuación, 'servername' sería localhost y 'serverport' sería el número de puerto local para la aplicación web.Cambiar schemaLocation and soap: ubicación de dirección en WSDL generado en tiempo de ejecución con JAX-WS

Sin embargo, quiero volver a configurar estos para ser un nombre de servidor proxy y puerto de servidor que redirige al servicio. ¿Es esto posible y cómo lo lograré?

El entorno de despliegue es Tomcat y Apache.

Tengo la siguiente clase de servicio:

@WebService 
public class AuthenticationService { 
.... 
public AuthenticationService(){} 

@WebMethod 
    public AuthenticationResult checkAuthentication(
     @WebParam(name = "authentication") Authentication authentication, 
     @WebParam(name = "privilege") Privilege privilege) { 
    .... 
} 
} 

Cuando corrió, el WSDL se ve así:

<definitions targetNamespace="http://authentication.service.ws.ijs/" name="AuthenticationServiceService"> 
<types> 

    <xsd:schema> 
     <xsd:import namespace="http://authentication.service.ws.ijs/" schemaLocation="http://servername:serverport/WebAppName/AuthenticationService?xsd=1"/> 
    </xsd:schema> 
</types> 

<message name="checkAuthentication"> 
    <part name="parameters" element="tns:checkAuthentication"/> 
</message> 

<message name="checkAuthenticationResponse"> 
    <part name="parameters" element="tns:checkAuthenticationResponse"/> 
</message> 

<portType name="AuthenticationService"> 

    <operation name="checkAuthentication"> 
     <input wsam:Action="http://authentication.service.ws.ijs/AuthenticationService/checkAuthenticationRequest" message="tns:checkAuthentication"/> 
     <output wsam:Action="http://authentication.service.ws.ijs/AuthenticationService/checkAuthenticationResponse" message="tns:checkAuthenticationResponse"/> 
    </operation> 

</portType> 

<binding name="AuthenticationServicePortBinding" type="tns:AuthenticationService"> 
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/> 

    <operation name="checkAuthentication"> 
     <soap:operation soapAction=""/> 

     <input> 
      <soap:body use="literal"/> 
     </input> 

     <output> 
      <soap:body use="literal"/> 
     </output> 
    </operation> 

</binding> 

<service name="AuthenticationServiceService"> 

    <port name="AuthenticationServicePort" binding="tns:AuthenticationServicePortBinding"> 
     <soap:address location="http://servername:serverport/WebAppName/AuthenticationService"/> 
    </port> 
</service> 
</definitions> 

Cualquier ayuda sería muy apreciada.

+0

Para anular el punto final, consulte http://stackoverflow.com/questions/2490737/how-to-change-webservice-url-endpoint – prunge

Respuesta

7

si mantiene el nombre de host original, en su solicitud (por ejemplo usar ProxyPreserveHost On si utiliza mod_proxy) Esto debe fijar sus direcciones URL, si se utiliza el mismo protocolo. Puede tener problemas si su proxy cambia entre https y http.

+1

El cambio entre https y http puede en algunos entornos manejarse mediante la configuración del parámetro de solicitud HTTP X -Forwarded-Proto en el proxy. – Drunix

Cuestiones relacionadas