Forum Discussion

ederbond's avatar
16 years ago

How to pass the Locale in the request

Hello,
I'm trying to passa the language and country to my webservice to get the client Location
on server side.

I'm using WebLogic 9.2 server to implement my webservice.
How do I pass the language and the country in the request ?
And there I'm using the folowing code to get the request locale:


package br;

import java.util.Locale;
import java.util.ResourceBundle;

import javax.jws.HandlerChain;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.namespace.QName;
import javax.xml.rpc.server.ServiceLifecycle;
import javax.xml.rpc.server.ServletEndpointContext;
import javax.xml.rpc.soap.SOAPFaultException;
import javax.xml.soap.Detail;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPFactory;

import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

import weblogic.jws.Context;
import weblogic.wsee.connection.transport.servlet.HttpTransportUtils;
import weblogic.wsee.jws.JwsContext;
import beans.ArgumentRequiredException;
import beans.DefaultExceptionHandler;
import beans.IllegalArgumentException;
import beans.PermissionException;
import beans.ResourceException;
import beans.ResourceName;
import beans.ServiceException;
import beans.ServiceFailureException;
import beans.UnexpectedException;

@WebService
public class TesteService implements ServiceLifecycle
{
private ServletEndpointContext wsctx = null;

public void init(Object context) throws ServiceException
{
wsctx = (ServletEndpointContext) context;
}

public void destroy() {
wsctx = null;
}

public HttpServletRequest getRequest()
{
return HttpTransportUtils.getHttpServletRequest(wsctx.getMessageContext());
}


@WebMethod
public String getDatabaseException() throws SOAPException
{
return getRequest().getLocale().toString();
}
}
No RepliesBe the first to reply